187 size_t iov_size [[maybe_unused]]);
224 std::ostream &
print(std::ostream &out)
const;
263 std::vector<page_no_t> &page_numbers)
const {
265 page_numbers.push_back(i);
273 const size_t idx = page_no -
m_range.first;
287 const size_t idx = page_no -
m_range.first;
314 out <<
"[Page_extent: this=" << (
void *)
this
315 <<
", m_range.first=" <<
m_range.first
316 <<
", m_range.second=" <<
m_range.second
317 <<
", page_loads=" <<
m_page_loads.size() <<
"]" << std::endl;
322 return obj.
print(out);
500 size_t size,
size_t num_threads,
bool in_pages);
516 std::function<
void()> &fn_wait_begin,
517 std::function<
void()> &fn_wait_end);
529 void init(
size_t max_range);
543 bool check(
size_t &num_alloc,
size_t &num_free)
const;
587 bool check(
size_t &n_leaf,
size_t &n_non_leaf,
bool &trigger);
676 void add(
Page_extent *page_extent, std::function<
void()> &fn_wait_begin,
677 std::function<
void()> &fn_wait_end);
810 const byte *data = (
const byte *)dfield->
data;
933 using Page_loaders = std::vector<Page_load *, ut::allocator<Page_load *>>;
934 using Level_ctxs = std::vector<Level_ctx *, ut::allocator<Level_ctx *>>;
965 size_t flush_queue_size,
1020 [[nodiscard]]
dberr_t finish(
bool is_err,
const bool subtree)
noexcept;
1036 mtr_t *mtr,
size_t &highest_level);
1047 mtr_t *mtr,
size_t &highest_level);
1064 bool insert_father)
noexcept;
1074 size_t rec_size)
noexcept;
1084 big_rec_t *big_rec,
size_t rec_size)
noexcept;
1279 using Btree_loads = std::vector<Btree_load *, ut::allocator<Btree_load *>>;
1325 size_t &total_node_ptrs_size,
size_t level);
1349 if (page_extent == e) {
1462 void reset() noexcept;
1470 size_t rec_size) noexcept;
1490 size_t rec_size) const noexcept;
1745 if (iter->get_page_no() == page_load->
get_page_no()) {
1765 m_btree_load(btree_load),
1766 m_is_leaf(is_leaf) {
1771 const bool is_leaf,
bool skip_track) {
1773 btree_load, is_leaf);
1777 p->m_is_cached.store(
false);
1782 if (extent ==
nullptr) {
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
uint32_t page_no_t
Page number.
Definition: api0api.h:46
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
std::pair< page_no_t, page_no_t > Page_range_t
Definition: btr0btr.h:131
static buf_frame_t * buf_block_get_frame(const buf_block_t *block)
Gets a pointer to the memory frame of a block.
Definition: btr0load.h:51
Definition: btr0mtib.h:1277
Btree_loads & m_btree_loads
Refernce to the subtrees to be merged.
Definition: btr0mtib.h:1334
std::vector< Btree_load *, ut::allocator< Btree_load * > > Btree_loads
Definition: btr0mtib.h:1279
const trx_t * m_trx
Transaction making the changes.
Definition: btr0mtib.h:1340
dict_index_t * m_index
Index which is being built.
Definition: btr0mtib.h:1337
void validate_boundaries()
Validate sub-tree boundaries.
Definition: btr0mtib.cc:2698
dberr_t insert_node_ptrs(std::vector< dtuple_t * > &all_node_ptrs, size_t &total_node_ptrs_size, size_t level)
Insert the given list of node pointers into pages at the given level.
Definition: btr0mtib.cc:3164
Merger(Btree_loads &loads, dict_index_t *index, const trx_t *trx)
Definition: btr0mtib.h:1281
size_t get_max_free() const
Get the maximum free space available in an empty page in bytes.
Definition: btr0mtib.h:1292
void remove_empty_subtrees()
Remove any empty sub-trees with no records.
Definition: btr0mtib.cc:2685
dberr_t add_root_for_subtrees(const size_t highest_level)
Create root node for the stiched sub-trees by combining the nodes at highest level creating another l...
Definition: btr0mtib.cc:3006
Scoped_heap m_tuple_heap
Memory heap to store node pointers.
Definition: btr0mtib.h:1343
dberr_t merge(bool sort)
Definition: btr0mtib.cc:2631
void link_right_sibling(const page_no_t l_page_no, const page_no_t r_page_no)
Load the left page and update its FIL_PAGE_NEXT.
Definition: btr0mtib.cc:3136
dberr_t subtree_link_levels(size_t &highest_level)
Stich sub-trees together to form a tree with one or multiple nodes at highest leve.
Definition: btr0mtib.cc:2708
Helper to set wait callbacks for the current scope.
Definition: btr0mtib.h:937
~Wait_callbacks()
Definition: btr0mtib.h:948
Wait_callbacks(Btree_load *btree_load, Function &begin, Function &end)
Definition: btr0mtib.h:942
Btree_load * m_btree_load
Btree Load for the wait callbacks.
Definition: btr0mtib.h:955
std::function< void()> Function
Definition: btr0mtib.h:939
Definition: btr0mtib.h:895
~Btree_load() noexcept
Destructor.
Definition: btr0mtib.cc:1640
dict_index_t * m_index
B-tree index.
Definition: btr0mtib.h:1221
Bulk_flusher m_bulk_flusher
Definition: btr0mtib.h:1272
dberr_t finish(bool is_err, const bool subtree) noexcept
Btree bulk load finish.
Definition: btr0mtib.cc:1978
dberr_t load_root_page(page_no_t last_page_no) noexcept
Set the root page on completion.
Definition: btr0mtib.cc:1854
dberr_t trigger_flusher() const
Trigger flusher thread and check for error.
Definition: btr0mtib.h:989
bool is_tpe_enabled() const
Check if transparent page encryption (TPE) is enabled.
Definition: btr0mtib.cc:2623
Bulk_extent_allocator & m_allocator
Reference to global extent allocator.
Definition: btr0mtib.h:1237
bool is_new_level(size_t level) const
Check if a new level is needed.
Definition: btr0mtib.h:1131
bool is_pk() const
Definition: btr0mtib.h:991
dberr_t check_key_overlap(const Btree_load *r_btree) const
Definition: btr0mtib.cc:3264
Btree_load(dict_index_t *index, trx_t *trx, size_t loader_num, size_t flush_queue_size, Bulk_extent_allocator &allocator) noexcept
Constructor.
Definition: btr0mtib.cc:1622
dict_index_t * index() const
Get the index object.
Definition: btr0mtib.h:995
size_t get_max_flush_queue_size() const
Definition: btr0mtib.h:1204
void block_remove(const page_no_t page_no)
Remove the given block from the internal cache of blocks.
dberr_t insert(dtuple_t *dtuple, size_t level) noexcept
Insert a tuple to a page in a level.
Definition: btr0mtib.cc:1750
dtuple_t * m_prev_tuple
The previous tuple that has been inserted.
Definition: btr0mtib.h:1252
void force_evict(const Page_range_t &range, const bool dirty_is_ok=true)
Evict all the pages in the given range from the buffer pool.
Definition: btr0mtib.cc:2077
std::ostream & print_right_pages(std::ostream &out) const
Definition: btr0mtib.cc:2038
size_t m_root_level
Root page level.
Definition: btr0mtib.h:1229
std::vector< page_no_t, ut::allocator< page_no_t > > m_first_page_nos
First page numbers of each level.
Definition: btr0mtib.h:1137
byte m_fseg_hdr_leaf[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:1152
void block_put(buf_block_t *block)
Add the given block the internal cache of blocks.
dberr_t init()
Initialize.
Definition: btr0mtib.cc:2170
Bulk_extent_allocator::Type m_alloc_type
Page allocation type.
Definition: btr0mtib.h:1214
Page_range_t m_page_range_leaf
Page numbers of the pages that has been allocated in the leaf level.
Definition: btr0mtib.h:1146
void get_root_page_stat(Page_stat &stat)
Get information about root page.
Definition: btr0mtib.cc:2088
size_t m_loader_num
Loader number.
Definition: btr0mtib.h:1257
Level_ctxs m_level_ctxs
Context information for each level of the B-tree.
Definition: btr0mtib.h:1234
page_no_t get_subtree_root() const
Get the root page number of this tree/subtree.
Definition: btr0mtib.h:1001
size_t m_stat_n_pages
Number of pages allocated for this B-tree.
Definition: btr0mtib.h:1164
trx_t * m_trx
Transaction id.
Definition: btr0mtib.h:1226
dberr_t flush_blobs() noexcept
Flush the blob pages.
dberr_t open_blob(Blob_context &blob_ctx, lob::ref_t &ref)
Create a blob.
Definition: btr0mtib.h:908
mem_heap_t * m_heap_order
Memory heap to be used for sort order checks.
Definition: btr0mtib.h:1246
dberr_t prepare_space(Page_load *&page_load, size_t level, size_t rec_size) noexcept
Prepare space to insert a tuple.
Definition: btr0mtib.cc:1648
std::list< Page_extent * > m_extents_tracked
Extents that are being tracked.
Definition: btr0mtib.h:1240
void track_page_flush(page_no_t page_no)
Save flushed page numbers for debugging purposes.
Definition: btr0mtib.h:978
std::ostream & print_left_pages(std::ostream &out) const
Definition: btr0mtib.cc:2029
ddl::Compare_key m_compare_key
Function object to compare two tuples.
Definition: btr0mtib.h:1249
bulk::Blob_inserter m_blob_inserter
Blob inserter that will be used to handle all the externally stored fields of InnoDB.
Definition: btr0mtib.h:1269
size_t get_root_level() const
Get the level of the root page.
Definition: btr0mtib.h:1005
dberr_t alloc_extent(Page_range_t &page_range, size_t level)
Allocate an extent.
Definition: btr0mtib.cc:735
bool is_extent_tracked(const Page_extent *page_extent) const
Definition: btr0mtib.h:1346
dberr_t insert_blob(lob::ref_t &ref, const dfield_t *dfield)
Definition: btr0mtib.h:900
bool m_check_order
If true, check if data is inserted in sorted order.
Definition: btr0mtib.h:1243
bool is_tpc_enabled() const
Check if transparent page compression (TPC) is enabled.
Definition: btr0mtib.cc:2613
std::vector< Page_load *, ut::allocator< Page_load * > > Page_loaders
Definition: btr0mtib.h:933
static bool validate_index(dict_index_t *index)
Check size and validate index of limited size.
Definition: btr0mtib.cc:1958
trx_id_t get_trx_id() const
Get the transaction id.
Definition: btr0mtib.cc:1638
void disable_check_order()
If the data is already sorted and checked for duplicates, then we can disable doing it again.
Definition: btr0mtib.h:1210
bool is_interrupted() const
Check if the index build operation has been interrupted.
Definition: btr0mtib.cc:3329
uint64_t m_n_recs
Number of records inserted.
Definition: btr0mtib.h:1218
Wait_callbacks::Function m_fn_wait_begin
Definition: btr0mtib.h:1262
const char * get_table_name() const
Definition: btr0mtib.h:997
void track_extent(Page_extent *page_extent)
All allocated extents registers with Btree_load.
Definition: btr0mtib.cc:2114
void split_rightmost(buf_block_t *block, size_t level, dtuple_t *node_ptr, mtr_t *mtr, size_t &highest_level)
Split the right most block of the tree at the given level.
Definition: btr0mtib.cc:3346
fil_space_t * m_space
Definition: btr0mtib.h:1223
Page_range_t m_page_range_top
Page numbers of the pages that has been allocated in the non-leaf level.
Definition: btr0mtib.h:1150
Wait_callbacks::Function m_fn_wait_end
Definition: btr0mtib.h:1265
void add_to_bulk_flusher(bool finish=false)
Add fully used extents to the bulk flusher.
Definition: btr0mtib.cc:1727
unsigned m_index_online
State of the index.
Definition: btr0mtib.h:1158
byte m_fseg_hdr_top[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:1153
dberr_t page_commit(Page_load *page_load, Page_load *next_page_load, bool insert_father) noexcept
Commit(finish) a page.
Definition: btr0mtib.cc:1581
void split_leftmost(buf_block_t *&block, size_t level, dtuple_t *node_ptr, mtr_t *mtr, size_t &highest_level)
Split the left most block of the tree at the given level.
Definition: btr0mtib.cc:3445
dberr_t fil_io(buf_block_t *block) noexcept
Initiate a direct file write operation.
dberr_t finalize_page_loads(bool is_err, page_no_t &last_page_no) noexcept
Btree page bulk load finish.
Definition: btr0mtib.cc:1822
std::string print_pages_in_level(const size_t level) const
Definition: btr0mtib.cc:1905
void print_tree_pages() const
Definition: btr0mtib.cc:2048
Level_ctx * get_level(size_t level) const
Get the level context object.
Definition: btr0mtib.h:1725
dberr_t close_blob(Blob_context blob_ctx, lob::ref_t &ref)
Indicate that the blob has been completed, so that resources can be removed, and as necessary flushin...
Definition: btr0mtib.h:928
const page_size_t m_page_size
Definition: btr0mtib.h:1259
std::vector< Level_ctx *, ut::allocator< Level_ctx * > > Level_ctxs
Definition: btr0mtib.h:934
buf_block_t * block_get(page_no_t page_no) const noexcept
Search for a BUF_BLOCK_MEMORY block with given page number in the local cache.
std::vector< page_no_t, ut::allocator< page_no_t > > m_last_page_nos
Last page numbers of each level.
Definition: btr0mtib.h:1134
size_t m_stat_n_extents
Number of extents allocated for this B-tree.
Definition: btr0mtib.h:1161
dberr_t write_blob(Blob_context blob_ctx, lob::ref_t &ref, const byte *data, size_t len)
Write data into the blob.
Definition: btr0mtib.h:918
Definition: btr0mtib.h:479
~Bulk_extent_allocator()
Destructor to ensure thread stop.
Definition: btr0mtib.h:489
Extent_cache m_leaf_extents
Cached leaf extents.
Definition: btr0mtib.h:625
dict_table_t * m_table
Innodb dictionary table object.
Definition: btr0mtib.h:646
std::chrono::microseconds m_allocator_wait_time
Total allocator wait time in micro seconds.
Definition: btr0mtib.h:619
size_t m_allocator_wait_count
Number of times allocator had to wait.
Definition: btr0mtib.h:613
size_t m_concurrency
Number of concurrent consumers.
Definition: btr0mtib.h:653
uint64_t init(dict_table_t *table, dict_index_t *index, trx_t *trx, size_t size, size_t num_threads, bool in_pages)
Check size and set extent allocator size parameters.
Definition: btr0mtib.cc:2198
std::condition_variable m_consumer_condition
Condition variable for extent consumer threads.
Definition: btr0mtib.h:637
bool check(size_t &n_leaf, size_t &n_non_leaf, bool &trigger)
Check if leaf and non-leaf extent cache needs to be filled.
Definition: btr0mtib.cc:2472
std::thread m_thread
Bulk extent allocator.
Definition: btr0mtib.h:607
size_t m_consumer_wait_count
Number of times consumer(s) had to wait.
Definition: btr0mtib.h:610
static constexpr size_t S_BULK_EXTEND_SIZE_MAX
Maximum size by which the tablespace is extended each time.
Definition: btr0mtib.h:524
dberr_t allocate(bool is_leaf, bool alloc_page, Page_range_t &range, std::function< void()> &fn_wait_begin, std::function< void()> &fn_wait_end)
Allocate a page range - currently ans Extent.
Definition: btr0mtib.cc:2356
dberr_t m_error
Error code, protected by m_mutex.
Definition: btr0mtib.h:643
static constexpr size_t S_MAX_RANGES
Upper bound for max ranges.
Definition: btr0mtib.h:521
dict_index_t * m_index
Definition: btr0mtib.h:647
trx_t * m_trx
Innodb transaction - used for checking interrupt.
Definition: btr0mtib.h:650
Extent_cache m_non_leaf_extents
Cached non-leaf extents.
Definition: btr0mtib.h:628
void allocator_wait() const
Allocator wait function.
Definition: btr0mtib.cc:2492
dberr_t allocate_extent(bool is_leaf, mtr_t &mtr, Page_range_t &range)
Allocate one extent.
Definition: btr0mtib.cc:2351
bool is_interrupted()
Definition: btr0mtib.cc:2302
dberr_t allocate_page(bool is_leaf, Page_range_t &range)
Allocate one page.
Definition: btr0mtib.cc:2306
dberr_t run()
Extent thread executor.
Definition: btr0mtib.cc:2559
void start()
Definition: btr0mtib.cc:2269
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:631
Type m_type
Page range type.
Definition: btr0mtib.h:622
Type
Definition: btr0mtib.h:481
@ EXTENT
Allocate by extent.
bool m_stop
Flag to indicate if the bulk allocator thread should stop.
Definition: btr0mtib.h:640
std::chrono::microseconds m_consumer_wait_time
Total consumer wait time in micro seconds.
Definition: btr0mtib.h:616
dberr_t allocate_extents(bool is_leaf, size_t num_extents)
Allocate extents and fill the cache.
Definition: btr0mtib.cc:2511
void stop()
Stop extent allocator thread, if active.
Definition: btr0mtib.cc:2277
std::condition_variable m_allocator_condition
Condition variable for allocator thread.
Definition: btr0mtib.h:634
Definition: btr0mtib.h:656
void do_work(fil_node_t *node, void *iov, size_t iov_size)
Do the actual work of flushing.
Definition: btr0mtib.cc:121
dberr_t check_and_notify() const
Check for flusher error and wake up flusher thread.
Definition: btr0mtib.cc:148
dberr_t m_error
Error code, protected by m_mutex.
Definition: btr0mtib.h:744
void add_to_free_queue(Page_extent *page_extent)
Definition: btr0mtib.cc:169
size_t m_pages_flushed
Number of pages flushed.
Definition: btr0mtib.h:770
space_id_t m_space_id
Bulk flusher is specific to a tablespace for now.
Definition: btr0mtib.h:773
std::atomic< bool > m_is_error
Set if error is encountered during flush.
Definition: btr0mtib.h:741
std::atomic< bool > m_stop
Flag to indicate if the bulk flusher thread should stop.
Definition: btr0mtib.h:738
dberr_t get_error() const
Definition: btr0mtib.cc:83
std::vector< Page_extent * > m_free_queue
This queue is protected by the m_free_mutex.
Definition: btr0mtib.h:730
dberr_t run()
Thread main function.
Definition: btr0mtib.cc:220
size_t m_id
Flusher ID.
Definition: btr0mtib.h:776
bool is_error() const
Definition: btr0mtib.h:694
Page_extent * get_free_extent()
Definition: btr0mtib.cc:159
std::mutex m_free_mutex
This mutex protects the m_free_queue.
Definition: btr0mtib.h:733
bool should_i_stop() const
Check if the bulk flush thread should stop working.
Definition: btr0mtib.h:711
size_t m_n_sleep
Number of times slept.
Definition: btr0mtib.h:758
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:723
~Bulk_flusher()
Destructor.
Definition: btr0mtib.cc:97
void set_error(dberr_t error_code)
Set error code.
Definition: btr0mtib.cc:88
std::vector< Page_extent * > m_queue
This queue is protected by the m_mutex.
Definition: btr0mtib.h:720
std::thread m_flush_thread
Bulk flusher thread.
Definition: btr0mtib.h:755
size_t m_max_queue_size
Maximum queue size, defaults to 4.
Definition: btr0mtib.h:767
void start(space_id_t space_id, size_t index, size_t queue_size)
Start a new thread to do the flush work.
Definition: btr0mtib.cc:69
std::chrono::microseconds m_wait_time
Total sleep time in micro seconds.
Definition: btr0mtib.h:761
bool is_work_available()
Check if work is available for the bulk flusher thread.
Definition: btr0mtib.cc:204
std::vector< Page_extent * > m_priv_queue
Private queue (private to the bulk flush thread) containing the extents to flush.
Definition: btr0mtib.h:752
void wait_to_stop()
Wait till the bulk flush thread stops.
Definition: btr0mtib.cc:108
std::vector< page_no_t > m_flushed_page_nos
Vector of page numbers that are flushed by this Bulk_flusher object.
Definition: btr0mtib.h:781
size_t get_max_queue_size() const
Get the maximum allowed queue size.
Definition: btr0mtib.h:688
std::condition_variable m_condition
Condition variable to wait upon.
Definition: btr0mtib.h:726
void info()
Print useful information to the server log file while exiting.
Definition: btr0mtib.cc:2183
void wait()
When no work is available, put the thread to sleep.
Definition: btr0mtib.cc:281
void add(Page_extent *page_extent, std::function< void()> &fn_wait_begin, std::function< void()> &fn_wait_end)
Add a page extent to the bulk flush queue.
Definition: btr0mtib.cc:174
static constexpr std::chrono::milliseconds s_sleep_duration
The sleep duration in milliseconds.
Definition: btr0mtib.h:764
The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – P...
Definition: btr0mtib.h:1361
dberr_t init_mem(const page_no_t new_page_no, Page_extent *page_extent) noexcept
Definition: btr0mtib.cc:997
dberr_t store_ext(const big_rec_t *big_rec, Rec_offsets offsets) noexcept
Store external record Since the record is not logged yet, so we don't log update to the record.
void set_level(size_t level) noexcept
Set the level of this page.
Definition: btr0mtib.h:1562
buf_block_t * get_block()
Definition: btr0mtib.h:1628
space_id_t space() const noexcept
Get the table space ID.
Definition: btr0mtib.h:1718
void rollback() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1423
dberr_t init_mem_blob(const page_no_t page_no, Page_extent *page_extent) noexcept
Initialize a memory block to be used for storing blobs.
Definition: btr0mtib.cc:960
bool is_corrupted() const
Check if page is corrupted.
Definition: btr0mtib.cc:326
trx_id_t m_trx_id
The transaction id.
Definition: btr0mtib.h:1651
byte * m_heap_top
The heap top in page for next insert.
Definition: btr0mtib.h:1672
size_t get_level() const noexcept
Get page level.
Definition: btr0mtib.h:1559
rec_t * m_last_slotted_rec
Last record assigned to a slot.
Definition: btr0mtib.h:1694
bool make_ext(dtuple_t *tuple)
Store externally the first possible field of the given tuple.
Definition: btr0mtib.cc:1547
dict_index_t * index()
Definition: btr0mtib.h:1626
void set_level_ctx(Level_ctx *level_ctx)
Set the level context object for this page load.
Definition: btr0mtib.h:1616
void set_trx_id(const trx_id_t trx_id)
Set the transaction id.
Definition: btr0mtib.h:1415
size_t copy_to(std::vector< Page_load * > &to_pages)
Distribute all records from this page to the given pages.
Definition: btr0mtib.cc:1461
size_t copy_records(const rec_t *first_rec) noexcept
Copy given and all following records.
Definition: btr0mtib.cc:1492
void set_flush_observer(Flush_observer *observer)
Set the flush observer.
Definition: btr0mtib.h:1423
void set_page_extent(Page_extent *page_extent)
Definition: btr0mtib.h:1630
size_t get_rec_no() const
Get record no.
Definition: btr0mtib.h:1565
trx_id_t get_trx_id() const
Get the current transaction identifier.
Definition: btr0mtib.h:1419
void set_min_rec_flag()
Set the REC_INFO_MIN_REC_FLAG on the first user record in this page.
Definition: btr0mtib.cc:2058
page_no_t get_page_no() const noexcept
Get the page number of this page load object.
Definition: btr0mtib.h:1537
void set_next(page_no_t next_page_no) noexcept
Set next page.
Definition: btr0mtib.cc:1511
size_t get_page_size() const noexcept
Get the physical page size of the underlying tablespace.
Definition: btr0mtib.h:1720
dict_index_t * m_index
The index B-tree.
Definition: btr0mtib.h:1645
size_t m_slotted_rec_no
Number of records assigned to slots.
Definition: btr0mtib.h:1697
dberr_t insert(const dtuple_t *tuple, const big_rec_t *big_rec, size_t rec_size) noexcept
Insert a tuple in the page.
Definition: btr0mtib.cc:1302
Flush_observer * m_flush_observer
Flush observer.
Definition: btr0mtib.h:1691
bool verify_space_id() const
Obtain tablespace id from the frame and the buffer block and ensure that they are the same.
Definition: btr0mtib.cc:3334
void free()
Free the memory block.
Definition: btr0mtib.cc:2106
uint64_t m_modify_clock
The modify clock value of the buffer block when the block is re-pinned.
Definition: btr0mtib.h:1688
void set_prev(page_no_t prev_page_no) noexcept
Set previous page.
Definition: btr0mtib.cc:1515
bool has_level_ctx() const
Check if this page load object contains a level context object.
Definition: btr0mtib.h:1621
Page_load(dict_index_t *index, Btree_load *btree_load)
Ctor.
Definition: btr0mtib.cc:928
size_t m_rec_no
User record no.
Definition: btr0mtib.h:1675
std::atomic_bool m_is_cached
true iff the the Page load is cached.
Definition: btr0mtib.h:1709
static void drop(Page_load *page_load)
Release the page loader.
Definition: btr0mtib.cc:709
bool is_memory() const
Check if state of this page is BUF_BLOCK_MEMORY.
Definition: btr0mtib.h:1382
bool is_leaf() const
Definition: btr0mtib.h:1427
bool is_space_available(size_t rec_size) const noexcept
Check if required space is available in the page for the rec to be inserted.
Definition: btr0mtib.cc:1523
void reset() noexcept
Reset this object so that Page_load::init() can be called again on this object.
Definition: btr0mtib.cc:1137
size_t get_data_size() const
Definition: btr0mtib.h:1578
bool need_ext(const dtuple_t *tuple, size_t rec_size) const noexcept
Check whether the record needs to be stored externally.
Definition: btr0mtib.cc:1565
size_t m_level
The page level in B-tree.
Definition: btr0mtib.h:1666
rec_t * m_cur_rec
The current rec, just before the next insert rec.
Definition: btr0mtib.h:1660
dberr_t alloc() noexcept
Allocate a page for this Page_load object.
Definition: btr0mtib.cc:1090
void set_page_no(const page_no_t page_no)
Set the page number of this object.
Definition: btr0mtib.cc:919
size_t m_reserved_space
The reserved space for fill factor.
Definition: btr0mtib.h:1681
mem_heap_t * m_heap
Memory heap for internal allocation.
Definition: btr0mtib.h:1642
static Page_load * create(Btree_load *btree_load, Page_extent *page_extent)
A static member function to create this object.
Definition: btr0mtib.cc:699
page_id_t get_page_id() const noexcept
Definition: btr0mtib.h:1539
void latch() noexcept
Start mtr and latch block.
Page_extent * m_page_extent
Definition: btr0mtib.h:1706
bool is_cached() const
Definition: btr0mtib.h:1638
page_t * get_page() noexcept
Definition: btr0mtib.h:1572
bool is_index_locked() noexcept
Check if index is X locked.
Definition: btr0mtib.cc:1572
Page_load(dict_index_t *index, trx_id_t trx_id, page_no_t page_no, size_t level, Flush_observer *observer, Btree_load *btree_load=nullptr) noexcept
Constructor.
Definition: btr0mtib.h:1400
void set_top_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1435
dberr_t reinit() noexcept
Re-initialize this page.
Definition: btr0mtib.cc:1069
~Page_load() noexcept
Destructor.
Definition: btr0mtib.cc:3318
void set_leaf_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1432
bool is_min_rec_flag() const
Definition: btr0mtib.cc:2060
dberr_t commit() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1393
size_t copy_all(const page_t *src_page) noexcept
Copy all records from page.
Definition: btr0mtib.cc:1452
size_t m_free_space
The free space left in the page.
Definition: btr0mtib.h:1678
void set_cached()
Mark the Page load as cached.
Definition: btr0mtib.h:1635
const bool m_is_comp
Flag: is page in compact format.
Definition: btr0mtib.h:1669
Btree_load * m_btree_load
Definition: btr0mtib.h:1702
page_no_t get_prev() noexcept
Get previous page (FIL_PAGE_PREV).
Definition: btr0mtib.cc:1519
mtr_t * m_mtr
The min-transaction.
Definition: btr0mtib.h:1648
const page_t * get_page() const noexcept
Get page.
Definition: btr0mtib.h:1568
bool m_modified
Page modified flag.
Definition: btr0mtib.h:1700
buf_block_t * m_block
The buffer block.
Definition: btr0mtib.h:1654
void print_child_page_nos() noexcept
Print the child page numbers.
Definition: btr0mtib.cc:1436
page_no_t m_page_no
The page no.
Definition: btr0mtib.h:1663
Level_ctx * m_level_ctx
Definition: btr0mtib.h:1704
dberr_t init() noexcept
Initialize members and allocate page if needed and start mtr.
Definition: btr0mtib.cc:1169
size_t m_total_data
Total data in the page.
Definition: btr0mtib.h:1684
void init_for_writing()
Definition: btr0mtib.cc:341
void finish() noexcept
Mark end of insertion to the page.
Definition: btr0mtib.cc:1334
page_t * m_page
The page.
Definition: btr0mtib.h:1657
dtuple_t * get_node_ptr() noexcept
Get node pointer.
Definition: btr0mtib.h:1714
Used to insert many blobs into InnoDB.
Definition: btr0mtib.h:790
Page_load * alloc_data_page()
Allocate a data page.
Definition: btr0mtib.cc:3910
Page_range_t m_page_range_first
Definition: btr0mtib.h:867
Page_load * alloc_first_page()
Allocate a LOB first page.
Definition: btr0mtib.cc:3890
Page_load * alloc_index_page()
Allocate a LOB index page.
Definition: btr0mtib.cc:3894
ut::Object_cache< Page_load > m_page_load_cache
Cache of Page_load objects.
Definition: btr0mtib.h:881
Page_extent * alloc_free_extent()
Definition: btr0mtib.cc:3849
Blob_inserter(Btree_load &btree_load)
Constructor.
Definition: btr0mtib.cc:3690
Page_load * alloc_page_from_extent(Page_extent *&m_page_extent)
Definition: btr0mtib.cc:3858
trx_id_t get_trx_id() const
Get the current transaction id.
Definition: btr0mtib.h:1813
~Blob_inserter()
Definition: btr0mtib.cc:3937
Page_extent * m_page_extent_first
Page extent from which to allocate first pages of blobs.
Definition: btr0mtib.h:865
dberr_t write_blob(Blob_context blob_ctx, lob::ref_t &ref, const byte *data, size_t len)
Write data into the blob.
Definition: btr0mtib.cc:3815
ut::Object_cache< Page_extent > m_page_extent_cache
Cache of Page_extent objects.
Definition: btr0mtib.h:884
dberr_t close_blob(Blob_context blob_ctx, lob::ref_t &ref)
Indicate that the blob has been completed, so that resources can be removed, and as necessary flushin...
Definition: btr0mtib.cc:3821
void finish()
Definition: btr0mtib.cc:3918
std::list< Page_extent * > m_index_extents
Page extent from which to allocate index pages of blobs.
Definition: btr0mtib.h:875
Blob_context m_blob
The current blob being inserted.
Definition: btr0mtib.h:878
dberr_t insert_blob(lob::ref_t &ref, const dfield_t *dfield)
Definition: btr0mtib.h:804
dberr_t open_blob(Blob_context &blob_ctx, lob::ref_t &ref)
Create a blob.
Definition: btr0mtib.cc:3810
dberr_t init()
Initialize by allocating necessary resources.
Definition: btr0mtib.cc:3697
Btree_load & m_btree_load
Definition: btr0mtib.h:861
ut::unique_ptr< Blob_handle > m_blob_handle
Only one blob handle per sub-tree.
Definition: btr0mtib.h:887
Page_extent * m_page_extent_data
Page extent from which to allocate data pages of blobs.
Definition: btr0mtib.h:871
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:258
The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – P...
Definition: btr0load.cc:54
A helper RAII wrapper for otherwise difficult to use sequence of:
Definition: rem0rec.h:292
page_id_t id
Page id.
Definition: buf0buf.h:1387
Page identifier.
Definition: buf0types.h:207
Page size descriptor.
Definition: page0size.h:50
size_t physical() const
Retrieve the physical page size (on-disk).
Definition: page0size.h:121
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:41
A class to manage objects of type T.
Definition: ut0object_cache.h:40
const char * p
Definition: ctype-mb.cc:1227
dberr_t
Definition: db0err.h:39
@ DB_SUCCESS
Definition: db0err.h:43
static bool dict_table_is_comp(const dict_table_t *table)
Check whether the table uses the compact page format.
static ulint dict_index_is_spatial(const dict_index_t *index)
Check whether the index is a Spatial Index.
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1161
#define FSP_EXTENT_SIZE
File space extent size in pages page size | file space extent size -------—+--------------------— 4 K...
Definition: fsp0types.h:64
constexpr uint32_t FSEG_HEADER_SIZE
Length of the file system header, in bytes.
Definition: fsp0types.h:94
byte fseg_header_t
Data type for file segment header.
Definition: fsp0types.h:85
#define free(A)
Definition: lexyy.cc:915
For bulk loading large objects.
Implements the large objects (LOB) module.
Definition: btr0mtib.cc:56
void * Blob_context
Definition: btr0mtib.h:60
void bulk_load_enable_slow_io_debug()
Definition: btr0mtib.cc:60
void bulk_load_disable_slow_io_debug()
Definition: btr0mtib.cc:61
std::ostream & operator<<(std::ostream &out, const Page_extent &obj)
Definition: btr0mtib.h:321
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Used for bulk load of data.
Definition: fut0lst.cc:411
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:75
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:905
std::chrono::milliseconds milliseconds
Definition: authorize_manager.cc:68
const char * begin(const char *const c)
Definition: base64.h:44
size_t size(const char *const c)
Definition: base64.h:46
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
Definition: gcs_xcom_synode.h:64
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:811
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2440
static ulint page_get_free_space_of_empty(bool comp)
Calculates free space if a page is emptied.
static ulint page_get_data_size(const page_t *page)
Returns the sum of the sizes of the records in the record list excluding the infimum and supremum rec...
constexpr uint32_t PAGE_HEADER
index page header starts at this offset
Definition: page0types.h:53
constexpr uint32_t PAGE_BTR_SEG_LEAF
file segment header for the leaf pages in a B-tree: defined only on the root page of a B-tree,...
Definition: page0types.h:90
constexpr uint32_t PAGE_BTR_SEG_TOP
Definition: page0types.h:98
byte page_t
Type of the index page.
Definition: page0types.h:152
byte rec_t
Definition: rem0types.h:41
Function object to compare two Btree_load objects.
Definition: btr0mtib.h:1795
dict_index_t * m_index
Definition: btr0mtib.h:1798
bool operator()(const Btree_load *l_btree, const Btree_load *r_btree)
Definition: btr0mtib.cc:2125
Btree_load_compare(dict_index_t *index)
Definition: btr0mtib.h:1796
Definition: btr0mtib.h:526
bool is_empty() const
Definition: btr0mtib.h:532
size_t m_max_range
Maximum number of ranges to pre-allocate.
Definition: btr0mtib.h:560
void init(size_t max_range)
Initialize cache.
Definition: btr0mtib.cc:2190
bool check(size_t &num_alloc, size_t &num_free) const
Check for number of extents to be allocated and cached.
Definition: btr0mtib.cc:2453
std::array< Page_range_t, S_MAX_RANGES > m_ranges
Cached page ranges already allocated to the segment.
Definition: btr0mtib.h:557
std::atomic< size_t > m_num_consumed
Total number of ranges allocated.
Definition: btr0mtib.h:566
void set_range(size_t index, Page_range_t &range)
Set allocated range(extent) in cache.
Definition: btr0mtib.cc:2444
std::atomic< size_t > m_num_allocated
Total number of ranges allocated.
Definition: btr0mtib.h:563
bool is_full() const
Definition: btr0mtib.h:535
bool get_range(Page_range_t &range, bool &alloc_trigger)
Get one page range from the cache.
Definition: btr0mtib.cc:2424
Context information for each level.
Definition: btr0mtib.h:358
size_t m_stat_n_extents
Number of extents allocated at this level.
Definition: btr0mtib.h:462
buf_block_t * alloc(const page_no_t new_page_no) noexcept
Allocate private memory buffer (BUF_BLOCK_MEMORY) block for given page number.
Definition: btr0mtib.cc:889
dict_index_t * m_index
The index which is being built.
Definition: btr0mtib.h:447
void build_page_cache()
Build page loader cache for current exent.
Definition: btr0mtib.cc:802
bool load_extent_from_cache()
Load one extent from extent cache.
Definition: btr0mtib.cc:749
dberr_t init()
Initialize.
Definition: btr0mtib.cc:842
Btree_load * m_btree_load
A back pointer to conceptually higher level btree load object.
Definition: btr0mtib.h:456
void set_current_page_load(Page_load *sibling)
Definition: btr0mtib.h:475
page_no_t m_last_page
The page_no of the last page in this level.
Definition: btr0mtib.h:444
~Level_ctx()
Destructor.
Definition: btr0mtib.cc:3316
const size_t m_level
The B-tree level whose context information is stored in this obj.
Definition: btr0mtib.h:450
void build_extent_cache()
Build the extent cache.
Definition: btr0mtib.cc:816
void free_page_load()
Free the current page load.
Definition: btr0mtib.cc:730
Page_load * create_page_load()
Definition: btr0mtib.cc:716
std::vector< page_no_t > m_pages_allocated
Definition: btr0mtib.h:469
trx_id_t get_trx_id() const
Definition: btr0mtib.h:1754
static void destroy(Level_ctx *obj)
Static member function to destroy a Level_ctx object.
Definition: btr0mtib.cc:685
std::vector< Page_extent * > m_cached_extents
Pre allocated extents to prevent repeated allocation and free.
Definition: btr0mtib.h:438
dberr_t alloc_page_num(page_no_t &page_no)
Allocate a page number.
Definition: btr0mtib.cc:618
Level_ctx(dict_index_t *index, size_t level, Btree_load *btree_load)
Constructor.
Definition: btr0mtib.h:377
bool m_extent_full
True if the current extent is full.
Definition: btr0mtib.h:465
dberr_t alloc_extent()
Allocate one extent in the relevant file segment.
Definition: btr0mtib.cc:655
size_t m_stat_n_pages
Number of pages allocated at this level.
Definition: btr0mtib.h:459
bool is_page_tracked(const page_no_t &page_no) const
Definition: btr0mtib.cc:649
Page_load * m_page_load
The Page_load of the current page being loaded.
Definition: btr0mtib.h:453
Page_load * get_page_load_from_cache()
Get a free page loader from cache.
Definition: btr0mtib.cc:784
Page_extent * m_page_extent
The current extent that is being loaded.
Definition: btr0mtib.h:421
page_no_t m_first_page
The page_no of the first page in this level.
Definition: btr0mtib.h:441
Page_load * get_page_load() const
Definition: btr0mtib.h:473
bool is_leaf() const
Check if this is leaf level.
Definition: btr0mtib.h:392
static Level_ctx * create(dict_index_t *index, size_t level, Btree_load *btree_load)
Static member function construct a Level_ctx object.
Definition: btr0mtib.cc:677
Allocate, use, manage and flush one extent pages (FSP_EXTENT_SIZE).
Definition: btr0mtib.h:67
Page_extent(Btree_load *btree_load, const bool is_leaf)
Constructor.
Definition: btr0mtib.h:1762
static void drop(Page_extent *extent)
Release the page extent.
Definition: btr0mtib.h:1781
bool is_blob() const
Check if this is a blob extent.
Definition: btr0mtib.h:231
void set_cached()
Mark the extent as cached.
Definition: btr0mtib.h:208
size_t m_next_cached_page_load_index
Next cached page load index.
Definition: btr0mtib.h:254
void get_page_numbers(std::vector< page_no_t > &page_numbers) const
Definition: btr0mtib.h:262
std::atomic_bool m_is_free
true if the cached entry is free to be used.
Definition: btr0mtib.h:250
std::vector< Page_load * > m_page_loads
All the page loaders of the used pages.
Definition: btr0mtib.h:87
bool is_null() const
Definition: btr0mtib.h:121
bool is_valid() const
Check if the range is valid.
Definition: btr0mtib.h:302
bool m_is_blob
True if this extent is used for blobs.
Definition: btr0mtib.h:257
dberr_t flush(fil_node_t *node, void *iov, size_t iov_size)
Flush the used pages to disk.
Definition: btr0mtib.cc:537
bool is_any_used() const
Check if there are any pages used.
Definition: btr0mtib.h:153
page_no_t alloc()
Allocate a page number.
Definition: btr0mtib.h:334
void init()
Initialize the next page number to be allocated.
Definition: btr0mtib.h:344
std::ostream & print(std::ostream &out) const
Definition: btr0mtib.h:313
dberr_t destroy()
Free all resources.
Definition: btr0mtib.cc:608
std::pair< page_no_t, page_no_t > Page_range_t
Definition: btr0mtib.h:68
std::vector< Page_load * > m_cached_page_loads
Cached page loads.
Definition: btr0mtib.h:252
size_t used_pages() const
Calculate the number of used pages.
Definition: btr0mtib.h:109
void set_page_load(page_no_t page_no, Page_load *page_load)
Member of Page_extent.
Definition: btr0mtib.h:269
page_no_t page_count() const
Number of pages in this extent.
Definition: btr0mtib.h:353
dberr_t flush_one_by_one(fil_node_t *node)
Flush one page at a time.
Definition: btr0mtib.cc:421
dberr_t bulk_flush(fil_node_t *node, void *iov, size_t iov_size)
Flush 1 extent pages at a time.
Definition: btr0mtib.cc:522
page_no_t m_page_no
Next page number to be used.
Definition: btr0mtib.h:80
void set_blob()
Mark that this extent is used for blobs.
Definition: btr0mtib.h:227
void reset_range(const Page_range_t &range)
Reset the range with the given value.
Definition: btr0mtib.h:325
std::atomic_bool m_is_owned_by_bulk_flusher
True if this extent has been handed over to the bulk flusher.
Definition: btr0mtib.h:238
Page_range_t m_range
Page numbers of the pages that has been allocated in this extent.
Definition: btr0mtib.h:84
bool is_fully_used() const
Check if no more pages are there to be used.
Definition: btr0mtib.h:148
bool is_free() const
Definition: btr0mtib.h:215
void destroy_cached()
Free any cached page load entries.
Definition: btr0mtib.cc:600
void append(Page_load *page_load)
Save a page_load.
Definition: btr0mtib.h:1739
Page_range_t pages_to_free() const
size_t last() const
Get the index of the first unused page load.
Definition: btr0mtib.h:115
void set_state(bool free)
Set and unset free state of a cached extent.
Definition: btr0mtib.h:212
std::atomic_bool m_is_cached
true iff the the extent is cached.
Definition: btr0mtib.h:248
void free_memory_blocks()
Free the BUF_BLOCK_MEMORY blocks used by this extent.
Definition: btr0mtib.h:1806
bool is_btree_load_nullptr() const
Definition: btr0mtib.h:89
bool is_cached() const
Definition: btr0mtib.h:218
void reset_cached_page_loads()
Reset page load cache to free all.
Definition: btr0mtib.h:221
space_id_t space() const
Definition: btr0mtib.h:1758
static Page_extent * create(Btree_load *btree_load, const bool is_leaf, const bool is_blob)
Create an object of type Page_extent in the heap.
Definition: btr0mtib.h:1770
Page_load * get_page_load(page_no_t page_no)
Member of Page_extent.
Definition: btr0mtib.h:284
~Page_extent()
Destructor.
Definition: btr0mtib.h:294
Btree_load * m_btree_load
Definition: btr0mtib.h:242
bool m_is_leaf
true if this extent belongs to leaf segment.
Definition: btr0mtib.h:245
Information about a buffer page.
Definition: btr0mtib.h:1731
size_t m_n_recs
Number of user records in the page.
Definition: btr0mtib.h:1733
size_t m_data_size
Number of bytes of data.
Definition: btr0mtib.h:1736
Heap wrapper that destroys the heap instance when it goes out of scope.
Definition: mem0mem.h:439
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:854
The buffer control block structure.
Definition: buf0buf.h:1764
buf_page_t page
page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t o...
Definition: buf0buf.h:1770
bool is_memory() const noexcept
Definition: buf0buf.h:2011
Compare the keys of an index.
Definition: ddl0impl-compare.h:41
Structure for an SQL data field.
Definition: data0data.h:617
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:623
void * data
pointer to data
Definition: data0data.h:618
Data structure for an index.
Definition: dict0mem.h:1041
unsigned space
space where the index tree is placed
Definition: dict0mem.h:1058
bool is_clustered() const
Definition: dict0mem.h:1306
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1055
page_size_t get_page_size() const
Get the page size of the tablespace to which this index belongs.
Definition: dict0mem.cc:917
Data structure for a database table.
Definition: dict0mem.h:1913
table_name_t name
Table name.
Definition: dict0mem.h:1988
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
File node of a tablespace or the log data space.
Definition: fil0fil.h:160
Tablespace or log data space.
Definition: fil0fil.h:240
The struct 'lob::ref_t' represents an external field reference.
Definition: lob0lob.h:198
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
Definition: gen_lex_token.cc:149
char * m_name
The name in internal representation.
Definition: dict0mem.h:467
Definition: trx0trx.h:675
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
Utilities related to class lifecycle.
#define UT_LOCATION_HERE
Definition: ut0core.h:73
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:566
Manage a cache of objects.