151 size_t iov_size [[maybe_unused]]);
188 std::ostream &
print(std::ostream &out)
const;
224 out <<
"[Page_extent: this=" << (
void *)
this
225 <<
", m_range.first=" <<
m_range.first
226 <<
", m_range.second=" <<
m_range.second
227 <<
", page_loads=" <<
m_page_loads.size() <<
"]" << std::endl;
232 return obj.
print(out);
406 size_t num_threads,
bool in_pages);
422 std::function<
void()> &fn_wait_begin,
423 std::function<
void()> &fn_wait_end);
435 void init(
size_t max_range);
449 bool check(
size_t &num_alloc,
size_t &num_free)
const;
493 bool check(
size_t &n_leaf,
size_t &n_non_leaf,
bool &trigger);
581 void add(
Page_extent *page_extent, std::function<
void()> &fn_wait_begin,
582 std::function<
void()> &fn_wait_end);
688 using Page_loaders = std::vector<Page_load *, ut::allocator<Page_load *>>;
689 using Level_ctxs = std::vector<Level_ctx *, ut::allocator<Level_ctx *>>;
720 size_t flush_queue_size,
773 [[nodiscard]]
dberr_t finish(
bool is_err,
const bool subtree)
noexcept;
789 mtr_t *mtr,
size_t &highest_level);
800 mtr_t *mtr,
size_t &highest_level);
817 bool insert_father)
noexcept;
827 size_t rec_size)
noexcept;
837 big_rec_t *big_rec,
size_t rec_size)
noexcept;
1026 using Btree_loads = std::vector<Btree_load *, ut::allocator<Btree_load *>>;
1072 size_t &total_node_ptrs_size,
size_t level);
1096 if (page_extent == e) {
1198 void reset() noexcept;
1206 size_t rec_size) noexcept;
1226 size_t rec_size) const noexcept;
1475 if (iter->get_page_no() == page_load->
get_page_no()) {
1494 m_btree_load(btree_load),
1495 m_is_leaf(is_leaf) {}
1498 const bool is_leaf,
bool skip_track) {
1500 btree_load, is_leaf);
1504 p->m_is_cached.store(
false);
1509 if (extent ==
nullptr) {
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:47
uint32_t page_no_t
Page number.
Definition: api0api.h:45
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
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:1024
Btree_loads & m_btree_loads
Refernce to the subtrees to be merged.
Definition: btr0mtib.h:1081
std::vector< Btree_load *, ut::allocator< Btree_load * > > Btree_loads
Definition: btr0mtib.h:1026
dict_index_t * m_index
Index which is being built.
Definition: btr0mtib.h:1084
void validate_boundaries()
Validate sub-tree boundaries.
Definition: btr0mtib.cc:2549
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:3015
size_t get_max_free() const
Get the maximum free space available in an empty page in bytes.
Definition: btr0mtib.h:1039
Merger(Btree_loads &loads, dict_index_t *index, trx_t *trx)
Definition: btr0mtib.h:1028
void remove_empty_subtrees()
Remove any empty sub-trees with no records.
Definition: btr0mtib.cc:2536
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:2857
Scoped_heap m_tuple_heap
Memory heap to store node pointers.
Definition: btr0mtib.h:1090
dberr_t merge(bool sort)
Definition: btr0mtib.cc:2482
trx_t * m_trx
Transaction making the changes.
Definition: btr0mtib.h:1087
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:2987
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:2559
Helper to set wait callbacks for the current scope.
Definition: btr0mtib.h:692
~Wait_callbacks()
Definition: btr0mtib.h:703
Wait_callbacks(Btree_load *btree_load, Function &begin, Function &end)
Definition: btr0mtib.h:697
Btree_load * m_btree_load
Btree Load for the wait callbacks.
Definition: btr0mtib.h:710
std::function< void()> Function
Definition: btr0mtib.h:694
Definition: btr0mtib.h:682
~Btree_load() noexcept
Destructor.
Definition: btr0mtib.cc:1504
dict_index_t * m_index
B-tree index.
Definition: btr0mtib.h:974
Bulk_flusher m_bulk_flusher
Definition: btr0mtib.h:990
dberr_t finish(bool is_err, const bool subtree) noexcept
Btree bulk load finish.
Definition: btr0mtib.cc:1835
dberr_t load_root_page(page_no_t last_page_no) noexcept
Set the root page on completion.
Definition: btr0mtib.cc:1711
dberr_t trigger_flusher() const
Trigger flusher thread and check for error.
Definition: btr0mtib.h:744
bool is_tpe_enabled() const
Check if transparent page encryption (TPE) is enabled.
Definition: btr0mtib.cc:2474
Bulk_extent_allocator & m_allocator
Reference to global extent allocator.
Definition: btr0mtib.h:993
bool is_new_level(size_t level) const
Check if a new level is needed.
Definition: btr0mtib.h:884
dberr_t check_key_overlap(const Btree_load *r_btree) const
Definition: btr0mtib.cc:3115
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:1488
dict_index_t * index() const
Get the index object.
Definition: btr0mtib.h:748
size_t get_max_flush_queue_size() const
Definition: btr0mtib.h:957
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:1608
dtuple_t * m_prev_tuple
The previous tuple that has been inserted.
Definition: btr0mtib.h:1008
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:1932
std::ostream & print_right_pages(std::ostream &out) const
Definition: btr0mtib.cc:1893
size_t m_root_level
Root page level.
Definition: btr0mtib.h:982
std::vector< page_no_t, ut::allocator< page_no_t > > m_first_page_nos
First page numbers of each level.
Definition: btr0mtib.h:890
byte m_fseg_hdr_leaf[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:905
void block_put(buf_block_t *block)
Add the given block the internal cache of blocks.
dberr_t init()
Initialize.
Definition: btr0mtib.cc:2023
Bulk_extent_allocator::Type m_alloc_type
Page allocation type.
Definition: btr0mtib.h:967
Page_range_t m_page_range_leaf
Page numbers of the pages that has been allocated in the leaf level.
Definition: btr0mtib.h:899
void get_root_page_stat(Page_stat &stat)
Get information about root page.
Definition: btr0mtib.cc:1943
size_t m_loader_num
Loader number.
Definition: btr0mtib.h:1013
Level_ctxs m_level_ctxs
Context information for each level of the B-tree.
Definition: btr0mtib.h:987
page_no_t get_subtree_root() const
Get the root page number of this tree/subtree.
Definition: btr0mtib.h:754
size_t m_stat_n_pages
Number of pages allocated for this B-tree.
Definition: btr0mtib.h:917
trx_t * m_trx
Transaction id.
Definition: btr0mtib.h:979
dberr_t flush_blobs() noexcept
Flush the blob pages.
mem_heap_t * m_heap_order
Memory heap to be used for sort order checks.
Definition: btr0mtib.h:1002
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:1512
std::list< Page_extent * > m_extents_tracked
Extents that are being tracked.
Definition: btr0mtib.h:996
void track_page_flush(page_no_t page_no)
Save flushed page numbers for debugging purposes.
Definition: btr0mtib.h:733
std::ostream & print_left_pages(std::ostream &out) const
Definition: btr0mtib.cc:1884
ddl::Compare_key m_compare_key
Function object to compare two tuples.
Definition: btr0mtib.h:1005
size_t get_root_level() const
Get the level of the root page.
Definition: btr0mtib.h:758
dberr_t alloc_extent(Page_range_t &page_range, size_t level)
Allocate an extent.
Definition: btr0mtib.cc:691
bool is_extent_tracked(const Page_extent *page_extent) const
Definition: btr0mtib.h:1093
bool m_check_order
If true, check if data is inserted in sorted order.
Definition: btr0mtib.h:999
bool is_tpc_enabled() const
Check if transparent page compression (TPC) is enabled.
Definition: btr0mtib.cc:2464
std::vector< Page_load *, ut::allocator< Page_load * > > Page_loaders
Definition: btr0mtib.h:688
static bool validate_index(dict_index_t *index)
Check size and validate index of limited size.
Definition: btr0mtib.cc:1815
trx_id_t get_trx_id() const
Get the transaction id.
Definition: btr0mtib.cc:1502
void disable_check_order()
If the data is already sorted and checked for duplicates, then we can disable doing it again.
Definition: btr0mtib.h:963
bool is_interrupted() const
Check if the index build operation has been interrupted.
Definition: btr0mtib.cc:3180
uint64_t m_n_recs
Number of records inserted.
Definition: btr0mtib.h:971
Wait_callbacks::Function m_fn_wait_begin
Definition: btr0mtib.h:1018
const char * get_table_name() const
Definition: btr0mtib.h:750
void track_extent(Page_extent *page_extent)
All allocated extents registers with Btree_load.
Definition: btr0mtib.cc:1967
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:3197
fil_space_t * m_space
Definition: btr0mtib.h:976
Page_range_t m_page_range_top
Page numbers of the pages that has been allocated in the non-leaf level.
Definition: btr0mtib.h:903
Wait_callbacks::Function m_fn_wait_end
Definition: btr0mtib.h:1021
void add_to_bulk_flusher(bool finish=false)
Add fully used extents to the bulk flusher.
Definition: btr0mtib.cc:1588
unsigned m_index_online
State of the index.
Definition: btr0mtib.h:911
byte m_fseg_hdr_top[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:906
dberr_t page_commit(Page_load *page_load, Page_load *next_page_load, bool insert_father) noexcept
Commit(finish) a page.
Definition: btr0mtib.cc:1447
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:3296
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:1679
std::string print_pages_in_level(const size_t level) const
Definition: btr0mtib.cc:1762
void print_tree_pages() const
Definition: btr0mtib.cc:1903
Level_ctx * get_level(size_t level) const
Get the level context object.
Definition: btr0mtib.h:1454
const page_size_t m_page_size
Definition: btr0mtib.h:1015
std::vector< Level_ctx *, ut::allocator< Level_ctx * > > Level_ctxs
Definition: btr0mtib.h:689
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:887
size_t m_stat_n_extents
Number of extents allocated for this B-tree.
Definition: btr0mtib.h:914
Definition: btr0mtib.h:386
~Bulk_extent_allocator()
Destructor to ensure thread stop.
Definition: btr0mtib.h:396
Extent_cache m_leaf_extents
Cached leaf extents.
Definition: btr0mtib.h:531
dict_table_t * m_table
Innodb dictionary table object.
Definition: btr0mtib.h:552
std::chrono::microseconds m_allocator_wait_time
Total allocator wait time in micro seconds.
Definition: btr0mtib.h:525
size_t m_allocator_wait_count
Number of times allocator had to wait.
Definition: btr0mtib.h:519
size_t m_concurrency
Number of concurrent consumers.
Definition: btr0mtib.h:558
std::condition_variable m_consumer_condition
Condition variable for extent consumer threads.
Definition: btr0mtib.h:543
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:2322
std::thread m_thread
Bulk extent allocator.
Definition: btr0mtib.h:513
size_t m_consumer_wait_count
Number of times consumer(s) had to wait.
Definition: btr0mtib.h:516
static constexpr size_t S_BULK_EXTEND_SIZE_MAX
Maximum size by which the tablespace is extended each time.
Definition: btr0mtib.h:430
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:2206
dberr_t m_error
Error code, protected by m_mutex.
Definition: btr0mtib.h:549
static constexpr size_t S_MAX_RANGES
Upper bound for max ranges.
Definition: btr0mtib.h:427
trx_t * m_trx
Innodb transaction - used for checking interrupt.
Definition: btr0mtib.h:555
Extent_cache m_non_leaf_extents
Cached non-leaf extents.
Definition: btr0mtib.h:534
void allocator_wait() const
Allocator wait function.
Definition: btr0mtib.cc:2342
dberr_t allocate_extent(bool is_leaf, mtr_t &mtr, Page_range_t &range)
Allocate one extent.
Definition: btr0mtib.cc:2200
bool is_interrupted()
Definition: btr0mtib.cc:2150
dberr_t allocate_page(bool is_leaf, Page_range_t &range)
Allocate one page.
Definition: btr0mtib.cc:2154
dberr_t run()
Exetent thread executor.
Definition: btr0mtib.cc:2410
void start()
Definition: btr0mtib.cc:2117
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:537
Type m_type
Page range type.
Definition: btr0mtib.h:528
Type
Definition: btr0mtib.h:388
@ EXTENT
Allocate by extent.
uint64_t init(dict_table_t *table, trx_t *trx, size_t size, size_t num_threads, bool in_pages)
Check size and set extent allocator size parameters.
Definition: btr0mtib.cc:2047
bool m_stop
Flag to indicate if the bulk allocator thread should stop.
Definition: btr0mtib.h:546
std::chrono::microseconds m_consumer_wait_time
Total consumer wait time in micro seconds.
Definition: btr0mtib.h:522
dberr_t allocate_extents(bool is_leaf, size_t num_extents)
Allocate extents and fill the cache.
Definition: btr0mtib.cc:2361
void stop()
Stop extent allocator thread, if active.
Definition: btr0mtib.cc:2125
std::condition_variable m_allocator_condition
Condition variable for allocator thread.
Definition: btr0mtib.h:540
Definition: btr0mtib.h:561
void do_work(fil_node_t *node, void *iov, size_t iov_size)
Do the actual work of flushing.
Definition: btr0mtib.cc:109
dberr_t check_and_notify() const
Check for flusher error and wake up flusher thread.
Definition: btr0mtib.cc:127
dberr_t m_error
Error code, protected by m_mutex.
Definition: btr0mtib.h:638
size_t m_pages_flushed
Number of pages flushed.
Definition: btr0mtib.h:664
space_id_t m_space_id
Bulk flusher is specific to a tablespace for now.
Definition: btr0mtib.h:667
std::atomic< bool > m_is_error
Set if error is encountered during flush.
Definition: btr0mtib.h:635
std::atomic< bool > m_stop
Flag to indicate if the bulk flusher thread should stop.
Definition: btr0mtib.h:632
dberr_t get_error() const
Definition: btr0mtib.cc:78
dberr_t run()
Thread main function.
Definition: btr0mtib.cc:179
size_t m_id
Flusher ID.
Definition: btr0mtib.h:670
bool is_error() const
Definition: btr0mtib.h:599
bool should_i_stop() const
Check if the bulk flush thread should stop working.
Definition: btr0mtib.h:612
size_t m_n_sleep
Number of times slept.
Definition: btr0mtib.h:652
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:624
~Bulk_flusher()
Destructor.
Definition: btr0mtib.cc:92
void set_error(dberr_t error_code)
Set error code.
Definition: btr0mtib.cc:83
std::vector< Page_extent * > m_queue
This queue is protected by the m_mutex.
Definition: btr0mtib.h:621
std::thread m_flush_thread
Bulk flusher thread.
Definition: btr0mtib.h:649
size_t m_max_queue_size
Maximum queue size, defaults to 4.
Definition: btr0mtib.h:661
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:64
std::chrono::microseconds m_wait_time
Total sleep time in micro seconds.
Definition: btr0mtib.h:655
bool is_work_available()
Check if work is available for the bulk flusher thread.
Definition: btr0mtib.cc:163
std::vector< Page_extent * > m_priv_queue
Private queue (private to the bulk flush thread) containing the extents to flush.
Definition: btr0mtib.h:646
void wait_to_stop()
Wait till the bulk flush thread stops.
Definition: btr0mtib.cc:103
std::vector< page_no_t > m_flushed_page_nos
Vector of page numbers that are flushed by this Bulk_flusher object.
Definition: btr0mtib.h:675
size_t get_max_queue_size() const
Get the maximum allowed queue size.
Definition: btr0mtib.h:593
std::condition_variable m_condition
Condition variable to wait upon.
Definition: btr0mtib.h:627
void info()
Print useful information to the server log file while exiting.
Definition: btr0mtib.cc:2032
void wait()
When no work is available, put the thread to sleep.
Definition: btr0mtib.cc:240
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:138
static constexpr std::chrono::milliseconds s_sleep_duration
The sleep duration in milliseconds.
Definition: btr0mtib.h:658
The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – P...
Definition: btr0mtib.h:1108
dberr_t init_mem(const page_no_t new_page_no, Page_extent *page_extent) noexcept
Definition: btr0mtib.cc:891
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:1291
buf_block_t * get_block()
Definition: btr0mtib.h:1357
space_id_t space() const noexcept
Get the table space ID.
Definition: btr0mtib.h:1447
void rollback() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1310
bool is_corrupted() const
Check if page is corrupted.
Definition: btr0mtib.cc:285
trx_id_t m_trx_id
The transaction id.
Definition: btr0mtib.h:1380
byte * m_heap_top
The heap top in page for next insert.
Definition: btr0mtib.h:1401
size_t get_level() const noexcept
Get page level.
Definition: btr0mtib.h:1288
rec_t * m_last_slotted_rec
Last record assigned to a slot.
Definition: btr0mtib.h:1423
dict_index_t * index()
Definition: btr0mtib.h:1355
void set_level_ctx(Level_ctx *level_ctx)
Set the level context object for this page load.
Definition: btr0mtib.h:1345
void set_trx_id(const trx_id_t trx_id)
Set the transaction id.
Definition: btr0mtib.h:1162
size_t copy_to(std::vector< Page_load * > &to_pages)
Distribute all records from this page to the given pages.
Definition: btr0mtib.cc:1348
size_t copy_records(const rec_t *first_rec) noexcept
Copy given and all following records.
Definition: btr0mtib.cc:1379
void set_flush_observer(Flush_observer *observer)
Set the flush observer.
Definition: btr0mtib.h:1166
void set_page_extent(Page_extent *page_extent)
Definition: btr0mtib.h:1359
size_t get_rec_no() const
Get record no.
Definition: btr0mtib.h:1294
void set_min_rec_flag()
Set the REC_INFO_MIN_REC_FLAG on the first user record in this page.
Definition: btr0mtib.cc:1913
page_no_t get_page_no() const noexcept
Get page no.
Definition: btr0mtib.h:1267
void set_next(page_no_t next_page_no) noexcept
Set next page.
Definition: btr0mtib.cc:1398
size_t get_page_size() const noexcept
Get the physical page size of the underlying tablespace.
Definition: btr0mtib.h:1449
dict_index_t * m_index
The index B-tree.
Definition: btr0mtib.h:1374
size_t m_slotted_rec_no
Number of records assigned to slots.
Definition: btr0mtib.h:1426
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:1193
Flush_observer * m_flush_observer
Flush observer.
Definition: btr0mtib.h:1420
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:3185
void free()
Free the memory block.
Definition: btr0mtib.cc:1961
uint64_t m_modify_clock
The modify clock value of the buffer block when the block is re-pinned.
Definition: btr0mtib.h:1417
void set_prev(page_no_t prev_page_no) noexcept
Set previous page.
Definition: btr0mtib.cc:1402
bool has_level_ctx() const
Check if this page load object contains a level context object.
Definition: btr0mtib.h:1350
Page_load(dict_index_t *index, Btree_load *btree_load)
Ctor.
Definition: btr0mtib.cc:884
size_t m_rec_no
User record no.
Definition: btr0mtib.h:1404
std::atomic_bool m_is_cached
true iff the the Page load is cached.
Definition: btr0mtib.h:1438
static void drop(Page_load *page_load)
Release the page loader.
Definition: btr0mtib.cc:665
bool is_memory() const
Check if state of this page is BUF_BLOCK_MEMORY.
Definition: btr0mtib.h:1129
bool is_leaf() const
Definition: btr0mtib.h:1170
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:1410
void reset() noexcept
Reset this object so that Page_load::init() can be called again on this object.
Definition: btr0mtib.cc:1028
size_t get_data_size() const
Definition: btr0mtib.h:1307
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:1431
size_t m_level
The page level in B-tree.
Definition: btr0mtib.h:1395
rec_t * m_cur_rec
The current rec, just before the next insert rec.
Definition: btr0mtib.h:1389
dberr_t alloc() noexcept
Allocate a page for this Page_load object.
Definition: btr0mtib.cc:981
void set_page_no(const page_no_t page_no)
Set the page number of this object.
Definition: btr0mtib.cc:875
size_t m_reserved_space
The reserved space for fill factor.
Definition: btr0mtib.h:1410
mem_heap_t * m_heap
Memory heap for internal allocation.
Definition: btr0mtib.h:1371
static Page_load * create(Btree_load *btree_load, Page_extent *page_extent)
A static member function to create this object.
Definition: btr0mtib.cc:655
page_id_t get_page_id() const noexcept
Definition: btr0mtib.h:1268
void latch() noexcept
Start mtr and latch block.
Page_extent * m_page_extent
Definition: btr0mtib.h:1435
bool is_cached() const
Definition: btr0mtib.h:1367
page_t * get_page() noexcept
Definition: btr0mtib.h:1301
bool is_index_locked() noexcept
Check if index is X locked.
Definition: btr0mtib.cc:1438
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:1147
void set_top_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1178
dberr_t reinit() noexcept
Re-initialize this page.
Definition: btr0mtib.cc:960
~Page_load() noexcept
Destructor.
Definition: btr0mtib.cc:3169
void set_leaf_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1175
bool is_min_rec_flag() const
Definition: btr0mtib.cc:1915
dberr_t commit() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1280
size_t copy_all(const page_t *src_page) noexcept
Copy all records from page.
Definition: btr0mtib.cc:1339
size_t m_free_space
The free space left in the page.
Definition: btr0mtib.h:1407
void set_cached()
Mark the Page load as cached.
Definition: btr0mtib.h:1364
const bool m_is_comp
Flag: is page in compact format.
Definition: btr0mtib.h:1398
Btree_load * m_btree_load
Definition: btr0mtib.h:1431
page_no_t get_prev() noexcept
Get previous page (FIL_PAGE_PREV).
Definition: btr0mtib.cc:1406
mtr_t * m_mtr
The min-transaction.
Definition: btr0mtib.h:1377
const page_t * get_page() const noexcept
Get page.
Definition: btr0mtib.h:1297
bool m_modified
Page modified flag.
Definition: btr0mtib.h:1429
buf_block_t * m_block
The buffer block.
Definition: btr0mtib.h:1383
void print_child_page_nos() noexcept
Print the child page numbers.
Definition: btr0mtib.cc:1323
page_no_t m_page_no
The page no.
Definition: btr0mtib.h:1392
Level_ctx * m_level_ctx
Definition: btr0mtib.h:1433
dberr_t init() noexcept
Initialize members and allocate page if needed and start mtr.
Definition: btr0mtib.cc:1060
size_t m_total_data
Total data in the page.
Definition: btr0mtib.h:1413
void init_for_writing()
Definition: btr0mtib.cc:300
void finish() noexcept
Mark end of insertion to the page.
Definition: btr0mtib.cc:1225
page_t * m_page
The page.
Definition: btr0mtib.h:1386
dtuple_t * get_node_ptr() noexcept
Get node pointer.
Definition: btr0mtib.h:1443
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:270
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:304
page_id_t id
Page id.
Definition: buf0buf.h:1376
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
const char * p
Definition: ctype-mb.cc:1235
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.
bool is_blob(enum_field_types sql_type)
Definition: field.h:4766
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1159
#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
Definition: btr0mtib.cc:56
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:231
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
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:2874
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:809
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:1522
dict_index_t * m_index
Definition: btr0mtib.h:1525
bool operator()(const Btree_load *l_btree, const Btree_load *r_btree)
Definition: btr0mtib.cc:1978
Btree_load_compare(dict_index_t *index)
Definition: btr0mtib.h:1523
Definition: btr0mtib.h:432
bool is_empty() const
Definition: btr0mtib.h:438
size_t m_max_range
Maximum number of ranges to pre-allocate.
Definition: btr0mtib.h:466
void init(size_t max_range)
Initialize cache.
Definition: btr0mtib.cc:2039
bool check(size_t &num_alloc, size_t &num_free) const
Check for number of extents to be allocated and cached.
Definition: btr0mtib.cc:2303
std::array< Page_range_t, S_MAX_RANGES > m_ranges
Cached page ranges already allocated to the segment.
Definition: btr0mtib.h:463
std::atomic< size_t > m_num_consumed
Total number of ranges allocated.
Definition: btr0mtib.h:472
void set_range(size_t index, Page_range_t &range)
Set allocated range(extent) in cache.
Definition: btr0mtib.cc:2294
std::atomic< size_t > m_num_allocated
Total number of ranges allocated.
Definition: btr0mtib.h:469
bool is_full() const
Definition: btr0mtib.h:441
bool get_range(Page_range_t &range, bool &alloc_trigger)
Get one page range from the cache.
Definition: btr0mtib.cc:2274
Context information for each level.
Definition: btr0mtib.h:265
size_t m_stat_n_extents
Number of extents allocated at this level.
Definition: btr0mtib.h:369
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:845
dict_index_t * m_index
The index which is being built.
Definition: btr0mtib.h:354
void build_page_cache()
Build page loader cache for current exent.
Definition: btr0mtib.cc:758
bool load_extent_from_cache()
Load one extent from extent cache.
Definition: btr0mtib.cc:705
dberr_t init()
Initialize.
Definition: btr0mtib.cc:798
Btree_load * m_btree_load
A back pointer to conceptually higher level btree load object.
Definition: btr0mtib.h:363
void set_current_page_load(Page_load *sibling)
Definition: btr0mtib.h:382
page_no_t m_last_page
The page_no of the last page in this level.
Definition: btr0mtib.h:351
~Level_ctx()
Destructor.
Definition: btr0mtib.cc:3167
const size_t m_level
The B-tree level whose context information is stored in this obj.
Definition: btr0mtib.h:357
void build_extent_cache()
Build the extent cache.
Definition: btr0mtib.cc:772
void free_page_load()
Free the current page load.
Definition: btr0mtib.cc:686
Page_load * create_page_load()
Definition: btr0mtib.cc:672
std::vector< page_no_t > m_pages_allocated
Definition: btr0mtib.h:376
trx_id_t get_trx_id() const
Definition: btr0mtib.h:1483
static void destroy(Level_ctx *obj)
Static member function to destroy a Level_ctx object.
Definition: btr0mtib.cc:641
std::vector< Page_extent * > m_cached_extents
Pre allocated extents to prevent repeated allocation and free.
Definition: btr0mtib.h:345
dberr_t alloc_page_num(page_no_t &page_no)
Allocate a page number.
Definition: btr0mtib.cc:575
Level_ctx(dict_index_t *index, size_t level, Btree_load *btree_load)
Constructor.
Definition: btr0mtib.h:284
bool m_extent_full
True if the current extent is full.
Definition: btr0mtib.h:372
dberr_t alloc_extent()
Allocate one extent in the relevant file segment.
Definition: btr0mtib.cc:612
size_t m_stat_n_pages
Number of pages allocated at this level.
Definition: btr0mtib.h:366
bool is_page_tracked(const page_no_t &page_no) const
Definition: btr0mtib.cc:606
Page_load * m_page_load
The Page_load of the current page being loaded.
Definition: btr0mtib.h:360
Page_load * get_page_load_from_cache()
Get a free page loader from cache.
Definition: btr0mtib.cc:740
Page_extent * m_page_extent
The current extent that is being loaded.
Definition: btr0mtib.h:328
page_no_t m_first_page
The page_no of the first page in this level.
Definition: btr0mtib.h:348
Page_load * get_page_load() const
Definition: btr0mtib.h:380
bool is_leaf() const
Check if this is leaf level.
Definition: btr0mtib.h:299
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:633
Allocate, use, manage and flush one extent pages (FSP_EXTENT_SIZE).
Definition: btr0mtib.h:58
Page_extent(Btree_load *btree_load, const bool is_leaf)
Constructor.
Definition: btr0mtib.h:1491
static void drop(Page_extent *extent)
Release the page extent.
Definition: btr0mtib.h:1508
const bool m_is_leaf
Definition: btr0mtib.h:192
void set_cached()
Mark the extent as cached.
Definition: btr0mtib.h:172
size_t m_next_cached_page_load_index
Next cached page load index.
Definition: btr0mtib.h:200
std::atomic_bool m_is_free
true if the cached entry is free to be used.
Definition: btr0mtib.h:196
std::vector< Page_load * > m_page_loads
All the page loaders of the used pages.
Definition: btr0mtib.h:78
bool is_null() const
Definition: btr0mtib.h:104
bool is_valid() const
Check if the range is valid.
Definition: btr0mtib.h:212
dberr_t flush(fil_node_t *node, void *iov, size_t iov_size)
Flush the used pages to disk.
Definition: btr0mtib.cc:497
page_no_t alloc()
Allocate a page number.
Definition: btr0mtib.h:244
void init()
Initialize the next page number to be allocated.
Definition: btr0mtib.h:252
bool is_page_loads_full() const
Definition: btr0mtib.h:118
std::ostream & print(std::ostream &out) const
Definition: btr0mtib.h:223
dberr_t destroy()
Free all resources.
Definition: btr0mtib.cc:565
std::pair< page_no_t, page_no_t > Page_range_t
Definition: btr0mtib.h:59
std::vector< Page_load * > m_cached_page_loads
Cached page loads.
Definition: btr0mtib.h:198
size_t used_pages() const
Calculate the number of used pages.
Definition: btr0mtib.h:98
page_no_t page_count() const
Number of pages in this extent.
Definition: btr0mtib.h:260
dberr_t flush_one_by_one(fil_node_t *node)
Flush one page at a time.
Definition: btr0mtib.cc:381
dberr_t bulk_flush(fil_node_t *node, void *iov, size_t iov_size)
Flush 1 extent pages at a time.
Definition: btr0mtib.cc:482
page_no_t m_page_no
Next page number to be used.
Definition: btr0mtib.h:71
void reset_range(const Page_range_t &range)
Reset the range with the given value.
Definition: btr0mtib.h:235
Page_range_t m_range
Page numbers of the pages that has been allocated in this extent.
Definition: btr0mtib.h:75
bool is_fully_used() const
Check if no more pages are there to be used.
Definition: btr0mtib.h:117
bool is_free() const
Definition: btr0mtib.h:179
void destroy_cached()
Free any cached page load entries.
Definition: btr0mtib.cc:557
void append(Page_load *page_load)
Save a page_load.
Definition: btr0mtib.h:1468
Page_range_t pages_to_free() const
void set_state(bool free)
Set and unset free state of a cached extent.
Definition: btr0mtib.h:176
std::atomic_bool m_is_cached
true iff the the extent is cached.
Definition: btr0mtib.h:194
bool is_cached() const
Definition: btr0mtib.h:182
void reset_cached_page_loads()
Reaset page load cache to free all.
Definition: btr0mtib.h:185
space_id_t space() const
Definition: btr0mtib.h:1487
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:1497
~Page_extent()
Destructor.
Definition: btr0mtib.h:205
Btree_load * m_btree_load
Definition: btr0mtib.h:191
Information about a buffer page.
Definition: btr0mtib.h:1460
size_t m_n_recs
Number of user records in the page.
Definition: btr0mtib.h:1462
size_t m_data_size
Number of bytes of data.
Definition: btr0mtib.h:1465
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:838
The buffer control block structure.
Definition: buf0buf.h:1747
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:1753
bool is_memory() const noexcept
Definition: buf0buf.h:1993
Compare the keys of an index.
Definition: ddl0impl-compare.h:41
Data structure for an index.
Definition: dict0mem.h:1046
unsigned space
space where the index tree is placed
Definition: dict0mem.h:1063
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1060
page_size_t get_page_size() const
Get the page size of the tablespace to which this index belongs.
Definition: dict0mem.cc:895
Data structure for a database table.
Definition: dict0mem.h:1909
table_name_t name
Table name.
Definition: dict0mem.h:1984
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:682
File node of a tablespace or the log data space.
Definition: fil0fil.h:155
Tablespace or log data space.
Definition: fil0fil.h:238
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:472
Definition: trx0trx.h:684
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:564