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);
499 size_t num_threads,
bool in_pages);
515 std::function<
void()> &fn_wait_begin,
516 std::function<
void()> &fn_wait_end);
528 void init(
size_t max_range);
542 bool check(
size_t &num_alloc,
size_t &num_free)
const;
586 bool check(
size_t &n_leaf,
size_t &n_non_leaf,
bool &trigger);
674 void add(
Page_extent *page_extent, std::function<
void()> &fn_wait_begin,
675 std::function<
void()> &fn_wait_end);
808 const byte *data = (
const byte *)dfield->
data;
931 using Page_loaders = std::vector<Page_load *, ut::allocator<Page_load *>>;
932 using Level_ctxs = std::vector<Level_ctx *, ut::allocator<Level_ctx *>>;
963 size_t flush_queue_size,
1016 [[nodiscard]]
dberr_t finish(
bool is_err,
const bool subtree)
noexcept;
1032 mtr_t *mtr,
size_t &highest_level);
1043 mtr_t *mtr,
size_t &highest_level);
1060 bool insert_father)
noexcept;
1070 size_t rec_size)
noexcept;
1080 big_rec_t *big_rec,
size_t rec_size)
noexcept;
1275 using Btree_loads = std::vector<Btree_load *, ut::allocator<Btree_load *>>;
1321 size_t &total_node_ptrs_size,
size_t level);
1345 if (page_extent == e) {
1458 void reset() noexcept;
1466 size_t rec_size) noexcept;
1486 size_t rec_size) const noexcept;
1741 if (iter->get_page_no() == page_load->
get_page_no()) {
1761 m_btree_load(btree_load),
1762 m_is_leaf(is_leaf) {
1767 const bool is_leaf,
bool skip_track) {
1769 btree_load, is_leaf);
1773 p->m_is_cached.store(
false);
1778 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: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:1273
Btree_loads & m_btree_loads
Refernce to the subtrees to be merged.
Definition: btr0mtib.h:1330
std::vector< Btree_load *, ut::allocator< Btree_load * > > Btree_loads
Definition: btr0mtib.h:1275
dict_index_t * m_index
Index which is being built.
Definition: btr0mtib.h:1333
void validate_boundaries()
Validate sub-tree boundaries.
Definition: btr0mtib.cc:2707
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:3173
size_t get_max_free() const
Get the maximum free space available in an empty page in bytes.
Definition: btr0mtib.h:1288
Merger(Btree_loads &loads, dict_index_t *index, trx_t *trx)
Definition: btr0mtib.h:1277
void remove_empty_subtrees()
Remove any empty sub-trees with no records.
Definition: btr0mtib.cc:2694
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:3015
Scoped_heap m_tuple_heap
Memory heap to store node pointers.
Definition: btr0mtib.h:1339
dberr_t merge(bool sort)
Definition: btr0mtib.cc:2640
trx_t * m_trx
Transaction making the changes.
Definition: btr0mtib.h:1336
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:3145
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:2717
Helper to set wait callbacks for the current scope.
Definition: btr0mtib.h:935
~Wait_callbacks()
Definition: btr0mtib.h:946
Wait_callbacks(Btree_load *btree_load, Function &begin, Function &end)
Definition: btr0mtib.h:940
Btree_load * m_btree_load
Btree Load for the wait callbacks.
Definition: btr0mtib.h:953
std::function< void()> Function
Definition: btr0mtib.h:937
Definition: btr0mtib.h:893
~Btree_load() noexcept
Destructor.
Definition: btr0mtib.cc:1646
dict_index_t * m_index
B-tree index.
Definition: btr0mtib.h:1217
Bulk_flusher m_bulk_flusher
Definition: btr0mtib.h:1268
dberr_t finish(bool is_err, const bool subtree) noexcept
Btree bulk load finish.
Definition: btr0mtib.cc:1984
dberr_t load_root_page(page_no_t last_page_no) noexcept
Set the root page on completion.
Definition: btr0mtib.cc:1860
dberr_t trigger_flusher() const
Trigger flusher thread and check for error.
Definition: btr0mtib.h:987
bool is_tpe_enabled() const
Check if transparent page encryption (TPE) is enabled.
Definition: btr0mtib.cc:2632
Bulk_extent_allocator & m_allocator
Reference to global extent allocator.
Definition: btr0mtib.h:1233
bool is_new_level(size_t level) const
Check if a new level is needed.
Definition: btr0mtib.h:1127
dberr_t check_key_overlap(const Btree_load *r_btree) const
Definition: btr0mtib.cc:3273
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:1629
dict_index_t * index() const
Get the index object.
Definition: btr0mtib.h:991
size_t get_max_flush_queue_size() const
Definition: btr0mtib.h:1200
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:1756
dtuple_t * m_prev_tuple
The previous tuple that has been inserted.
Definition: btr0mtib.h:1248
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:2084
std::ostream & print_right_pages(std::ostream &out) const
Definition: btr0mtib.cc:2045
size_t m_root_level
Root page level.
Definition: btr0mtib.h:1225
std::vector< page_no_t, ut::allocator< page_no_t > > m_first_page_nos
First page numbers of each level.
Definition: btr0mtib.h:1133
byte m_fseg_hdr_leaf[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:1148
void block_put(buf_block_t *block)
Add the given block the internal cache of blocks.
dberr_t init()
Initialize.
Definition: btr0mtib.cc:2177
Bulk_extent_allocator::Type m_alloc_type
Page allocation type.
Definition: btr0mtib.h:1210
Page_range_t m_page_range_leaf
Page numbers of the pages that has been allocated in the leaf level.
Definition: btr0mtib.h:1142
void get_root_page_stat(Page_stat &stat)
Get information about root page.
Definition: btr0mtib.cc:2095
size_t m_loader_num
Loader number.
Definition: btr0mtib.h:1253
Level_ctxs m_level_ctxs
Context information for each level of the B-tree.
Definition: btr0mtib.h:1230
page_no_t get_subtree_root() const
Get the root page number of this tree/subtree.
Definition: btr0mtib.h:997
size_t m_stat_n_pages
Number of pages allocated for this B-tree.
Definition: btr0mtib.h:1160
trx_t * m_trx
Transaction id.
Definition: btr0mtib.h:1222
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:906
mem_heap_t * m_heap_order
Memory heap to be used for sort order checks.
Definition: btr0mtib.h:1242
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:1654
std::list< Page_extent * > m_extents_tracked
Extents that are being tracked.
Definition: btr0mtib.h:1236
void track_page_flush(page_no_t page_no)
Save flushed page numbers for debugging purposes.
Definition: btr0mtib.h:976
std::ostream & print_left_pages(std::ostream &out) const
Definition: btr0mtib.cc:2036
ddl::Compare_key m_compare_key
Function object to compare two tuples.
Definition: btr0mtib.h:1245
bulk::Blob_inserter m_blob_inserter
Blob inserter that will be used to handle all the externally stored fields of InnoDB.
Definition: btr0mtib.h:1265
size_t get_root_level() const
Get the level of the root page.
Definition: btr0mtib.h:1001
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:1342
dberr_t insert_blob(lob::ref_t &ref, const dfield_t *dfield)
Definition: btr0mtib.h:898
bool m_check_order
If true, check if data is inserted in sorted order.
Definition: btr0mtib.h:1239
bool is_tpc_enabled() const
Check if transparent page compression (TPC) is enabled.
Definition: btr0mtib.cc:2622
std::vector< Page_load *, ut::allocator< Page_load * > > Page_loaders
Definition: btr0mtib.h:931
static bool validate_index(dict_index_t *index)
Check size and validate index of limited size.
Definition: btr0mtib.cc:1964
trx_id_t get_trx_id() const
Get the transaction id.
Definition: btr0mtib.cc:1644
void disable_check_order()
If the data is already sorted and checked for duplicates, then we can disable doing it again.
Definition: btr0mtib.h:1206
bool is_interrupted() const
Check if the index build operation has been interrupted.
Definition: btr0mtib.cc:3338
uint64_t m_n_recs
Number of records inserted.
Definition: btr0mtib.h:1214
Wait_callbacks::Function m_fn_wait_begin
Definition: btr0mtib.h:1258
const char * get_table_name() const
Definition: btr0mtib.h:993
void track_extent(Page_extent *page_extent)
All allocated extents registers with Btree_load.
Definition: btr0mtib.cc:2121
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:3355
fil_space_t * m_space
Definition: btr0mtib.h:1219
Page_range_t m_page_range_top
Page numbers of the pages that has been allocated in the non-leaf level.
Definition: btr0mtib.h:1146
Wait_callbacks::Function m_fn_wait_end
Definition: btr0mtib.h:1261
void add_to_bulk_flusher(bool finish=false)
Add fully used extents to the bulk flusher.
Definition: btr0mtib.cc:1733
unsigned m_index_online
State of the index.
Definition: btr0mtib.h:1154
byte m_fseg_hdr_top[FSEG_HEADER_SIZE]
Definition: btr0mtib.h:1149
dberr_t page_commit(Page_load *page_load, Page_load *next_page_load, bool insert_father) noexcept
Commit(finish) a page.
Definition: btr0mtib.cc:1588
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:3454
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:1828
std::string print_pages_in_level(const size_t level) const
Definition: btr0mtib.cc:1911
void print_tree_pages() const
Definition: btr0mtib.cc:2055
Level_ctx * get_level(size_t level) const
Get the level context object.
Definition: btr0mtib.h:1721
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:926
const page_size_t m_page_size
Definition: btr0mtib.h:1255
std::vector< Level_ctx *, ut::allocator< Level_ctx * > > Level_ctxs
Definition: btr0mtib.h:932
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:1130
size_t m_stat_n_extents
Number of extents allocated for this B-tree.
Definition: btr0mtib.h:1157
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:916
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:624
dict_table_t * m_table
Innodb dictionary table object.
Definition: btr0mtib.h:645
std::chrono::microseconds m_allocator_wait_time
Total allocator wait time in micro seconds.
Definition: btr0mtib.h:618
size_t m_allocator_wait_count
Number of times allocator had to wait.
Definition: btr0mtib.h:612
size_t m_concurrency
Number of concurrent consumers.
Definition: btr0mtib.h:651
std::condition_variable m_consumer_condition
Condition variable for extent consumer threads.
Definition: btr0mtib.h:636
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:2480
std::thread m_thread
Bulk extent allocator.
Definition: btr0mtib.h:606
size_t m_consumer_wait_count
Number of times consumer(s) had to wait.
Definition: btr0mtib.h:609
static constexpr size_t S_BULK_EXTEND_SIZE_MAX
Maximum size by which the tablespace is extended each time.
Definition: btr0mtib.h:523
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:2364
dberr_t m_error
Error code, protected by m_mutex.
Definition: btr0mtib.h:642
static constexpr size_t S_MAX_RANGES
Upper bound for max ranges.
Definition: btr0mtib.h:520
trx_t * m_trx
Innodb transaction - used for checking interrupt.
Definition: btr0mtib.h:648
Extent_cache m_non_leaf_extents
Cached non-leaf extents.
Definition: btr0mtib.h:627
void allocator_wait() const
Allocator wait function.
Definition: btr0mtib.cc:2500
dberr_t allocate_extent(bool is_leaf, mtr_t &mtr, Page_range_t &range)
Allocate one extent.
Definition: btr0mtib.cc:2358
bool is_interrupted()
Definition: btr0mtib.cc:2308
dberr_t allocate_page(bool is_leaf, Page_range_t &range)
Allocate one page.
Definition: btr0mtib.cc:2312
dberr_t run()
Extent thread executor.
Definition: btr0mtib.cc:2568
void start()
Definition: btr0mtib.cc:2275
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:630
Type m_type
Page range type.
Definition: btr0mtib.h:621
Type
Definition: btr0mtib.h:481
@ 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:2205
bool m_stop
Flag to indicate if the bulk allocator thread should stop.
Definition: btr0mtib.h:639
std::chrono::microseconds m_consumer_wait_time
Total consumer wait time in micro seconds.
Definition: btr0mtib.h:615
dberr_t allocate_extents(bool is_leaf, size_t num_extents)
Allocate extents and fill the cache.
Definition: btr0mtib.cc:2519
void stop()
Stop extent allocator thread, if active.
Definition: btr0mtib.cc:2283
std::condition_variable m_allocator_condition
Condition variable for allocator thread.
Definition: btr0mtib.h:633
Definition: btr0mtib.h:654
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:742
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:768
space_id_t m_space_id
Bulk flusher is specific to a tablespace for now.
Definition: btr0mtib.h:771
std::atomic< bool > m_is_error
Set if error is encountered during flush.
Definition: btr0mtib.h:739
std::atomic< bool > m_stop
Flag to indicate if the bulk flusher thread should stop.
Definition: btr0mtib.h:736
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:728
dberr_t run()
Thread main function.
Definition: btr0mtib.cc:220
size_t m_id
Flusher ID.
Definition: btr0mtib.h:774
bool is_error() const
Definition: btr0mtib.h:692
Page_extent * get_free_extent()
Definition: btr0mtib.cc:159
std::mutex m_free_mutex
This mutex protects the m_free_queue.
Definition: btr0mtib.h:731
bool should_i_stop() const
Check if the bulk flush thread should stop working.
Definition: btr0mtib.h:709
size_t m_n_sleep
Number of times slept.
Definition: btr0mtib.h:756
std::mutex m_mutex
This mutex protects the m_queue.
Definition: btr0mtib.h:721
~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:718
std::thread m_flush_thread
Bulk flusher thread.
Definition: btr0mtib.h:753
size_t m_max_queue_size
Maximum queue size, defaults to 4.
Definition: btr0mtib.h:765
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:759
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:750
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:779
size_t get_max_queue_size() const
Get the maximum allowed queue size.
Definition: btr0mtib.h:686
std::condition_variable m_condition
Condition variable to wait upon.
Definition: btr0mtib.h:724
void info()
Print useful information to the server log file while exiting.
Definition: btr0mtib.cc:2190
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:762
The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – P...
Definition: btr0mtib.h:1357
dberr_t init_mem(const page_no_t new_page_no, Page_extent *page_extent) noexcept
Definition: btr0mtib.cc:996
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:1558
buf_block_t * get_block()
Definition: btr0mtib.h:1624
space_id_t space() const noexcept
Get the table space ID.
Definition: btr0mtib.h:1714
void rollback() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1416
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:1647
byte * m_heap_top
The heap top in page for next insert.
Definition: btr0mtib.h:1668
size_t get_level() const noexcept
Get page level.
Definition: btr0mtib.h:1555
rec_t * m_last_slotted_rec
Last record assigned to a slot.
Definition: btr0mtib.h:1690
bool make_ext(dtuple_t *tuple)
Store externally the first possible field of the given tuple.
Definition: btr0mtib.cc:1540
dict_index_t * index()
Definition: btr0mtib.h:1622
void set_level_ctx(Level_ctx *level_ctx)
Set the level context object for this page load.
Definition: btr0mtib.h:1612
void set_trx_id(const trx_id_t trx_id)
Set the transaction id.
Definition: btr0mtib.h:1411
size_t copy_to(std::vector< Page_load * > &to_pages)
Distribute all records from this page to the given pages.
Definition: btr0mtib.cc:1454
size_t copy_records(const rec_t *first_rec) noexcept
Copy given and all following records.
Definition: btr0mtib.cc:1485
void set_flush_observer(Flush_observer *observer)
Set the flush observer.
Definition: btr0mtib.h:1419
void set_page_extent(Page_extent *page_extent)
Definition: btr0mtib.h:1626
size_t get_rec_no() const
Get record no.
Definition: btr0mtib.h:1561
trx_id_t get_trx_id() const
Get the current transaction identifier.
Definition: btr0mtib.h:1415
void set_min_rec_flag()
Set the REC_INFO_MIN_REC_FLAG on the first user record in this page.
Definition: btr0mtib.cc:2065
page_no_t get_page_no() const noexcept
Get the page number of this page load object.
Definition: btr0mtib.h:1533
void set_next(page_no_t next_page_no) noexcept
Set next page.
Definition: btr0mtib.cc:1504
size_t get_page_size() const noexcept
Get the physical page size of the underlying tablespace.
Definition: btr0mtib.h:1716
dict_index_t * m_index
The index B-tree.
Definition: btr0mtib.h:1641
size_t m_slotted_rec_no
Number of records assigned to slots.
Definition: btr0mtib.h:1693
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:1299
Flush_observer * m_flush_observer
Flush observer.
Definition: btr0mtib.h:1687
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:3343
void free()
Free the memory block.
Definition: btr0mtib.cc:2113
uint64_t m_modify_clock
The modify clock value of the buffer block when the block is re-pinned.
Definition: btr0mtib.h:1684
void set_prev(page_no_t prev_page_no) noexcept
Set previous page.
Definition: btr0mtib.cc:1508
bool has_level_ctx() const
Check if this page load object contains a level context object.
Definition: btr0mtib.h:1617
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:1671
std::atomic_bool m_is_cached
true iff the the Page load is cached.
Definition: btr0mtib.h:1705
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:1378
bool is_leaf() const
Definition: btr0mtib.h:1423
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:1516
void reset() noexcept
Reset this object so that Page_load::init() can be called again on this object.
Definition: btr0mtib.cc:1134
size_t get_data_size() const
Definition: btr0mtib.h:1574
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:1572
size_t m_level
The page level in B-tree.
Definition: btr0mtib.h:1662
rec_t * m_cur_rec
The current rec, just before the next insert rec.
Definition: btr0mtib.h:1656
dberr_t alloc() noexcept
Allocate a page for this Page_load object.
Definition: btr0mtib.cc:1087
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:1677
mem_heap_t * m_heap
Memory heap for internal allocation.
Definition: btr0mtib.h:1638
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:1535
void latch() noexcept
Start mtr and latch block.
Page_extent * m_page_extent
Definition: btr0mtib.h:1702
bool is_cached() const
Definition: btr0mtib.h:1634
page_t * get_page() noexcept
Definition: btr0mtib.h:1568
bool is_index_locked() noexcept
Check if index is X locked.
Definition: btr0mtib.cc:1579
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:1396
void set_top_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1431
dberr_t reinit() noexcept
Re-initialize this page.
Definition: btr0mtib.cc:1066
~Page_load() noexcept
Destructor.
Definition: btr0mtib.cc:3327
void set_leaf_seg(const fseg_header_t *hdr)
Definition: btr0mtib.h:1428
bool is_min_rec_flag() const
Definition: btr0mtib.cc:2067
dberr_t commit() noexcept
Commit mtr for a page.
Definition: btr0mtib.cc:1386
size_t copy_all(const page_t *src_page) noexcept
Copy all records from page.
Definition: btr0mtib.cc:1445
size_t m_free_space
The free space left in the page.
Definition: btr0mtib.h:1674
void set_cached()
Mark the Page load as cached.
Definition: btr0mtib.h:1631
const bool m_is_comp
Flag: is page in compact format.
Definition: btr0mtib.h:1665
Btree_load * m_btree_load
Definition: btr0mtib.h:1698
page_no_t get_prev() noexcept
Get previous page (FIL_PAGE_PREV).
Definition: btr0mtib.cc:1512
mtr_t * m_mtr
The min-transaction.
Definition: btr0mtib.h:1644
const page_t * get_page() const noexcept
Get page.
Definition: btr0mtib.h:1564
bool m_modified
Page modified flag.
Definition: btr0mtib.h:1696
buf_block_t * m_block
The buffer block.
Definition: btr0mtib.h:1650
void print_child_page_nos() noexcept
Print the child page numbers.
Definition: btr0mtib.cc:1429
page_no_t m_page_no
The page no.
Definition: btr0mtib.h:1659
Level_ctx * m_level_ctx
Definition: btr0mtib.h:1700
dberr_t init() noexcept
Initialize members and allocate page if needed and start mtr.
Definition: btr0mtib.cc:1166
size_t m_total_data
Total data in the page.
Definition: btr0mtib.h:1680
void init_for_writing()
Definition: btr0mtib.cc:341
void finish() noexcept
Mark end of insertion to the page.
Definition: btr0mtib.cc:1331
page_t * m_page
The page.
Definition: btr0mtib.h:1653
dtuple_t * get_node_ptr() noexcept
Get node pointer.
Definition: btr0mtib.h:1710
Used to insert many blobs into InnoDB.
Definition: btr0mtib.h:788
Page_load * alloc_data_page()
Allocate a data page.
Definition: btr0mtib.cc:3919
Page_range_t m_page_range_first
Definition: btr0mtib.h:865
Page_load * alloc_first_page()
Allocate a LOB first page.
Definition: btr0mtib.cc:3899
Page_load * alloc_index_page()
Allocate a LOB index page.
Definition: btr0mtib.cc:3903
ut::Object_cache< Page_load > m_page_load_cache
Cache of Page_load objects.
Definition: btr0mtib.h:879
Page_extent * alloc_free_extent()
Definition: btr0mtib.cc:3858
Blob_inserter(Btree_load &btree_load)
Constructor.
Definition: btr0mtib.cc:3699
Page_load * alloc_page_from_extent(Page_extent *&m_page_extent)
Definition: btr0mtib.cc:3867
trx_id_t get_trx_id() const
Get the current transaction id.
Definition: btr0mtib.h:1809
~Blob_inserter()
Definition: btr0mtib.cc:3946
Page_extent * m_page_extent_first
Page extent from which to allocate first pages of blobs.
Definition: btr0mtib.h:863
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:3824
ut::Object_cache< Page_extent > m_page_extent_cache
Cache of Page_extent objects.
Definition: btr0mtib.h:882
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:3830
void finish()
Definition: btr0mtib.cc:3927
std::list< Page_extent * > m_index_extents
Page extent from which to allocate index pages of blobs.
Definition: btr0mtib.h:873
Blob_context m_blob
The current blob being inserted.
Definition: btr0mtib.h:876
dberr_t insert_blob(lob::ref_t &ref, const dfield_t *dfield)
Definition: btr0mtib.h:802
dberr_t open_blob(Blob_context &blob_ctx, lob::ref_t &ref)
Create a blob.
Definition: btr0mtib.cc:3819
dberr_t init()
Initialize by allocating necessary resources.
Definition: btr0mtib.cc:3706
Btree_load & m_btree_load
Definition: btr0mtib.h:859
ut::unique_ptr< Blob_handle > m_blob_handle
Only one blob handle per sub-tree.
Definition: btr0mtib.h:885
Page_extent * m_page_extent_data
Page extent from which to allocate data pages of blobs.
Definition: btr0mtib.h:869
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:274
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: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
A class to manage objects of type T.
Definition: ut0object_cache.h:40
const char * p
Definition: ctype-mb.cc:1225
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:1156
#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
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
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:1791
dict_index_t * m_index
Definition: btr0mtib.h:1794
bool operator()(const Btree_load *l_btree, const Btree_load *r_btree)
Definition: btr0mtib.cc:2132
Btree_load_compare(dict_index_t *index)
Definition: btr0mtib.h:1792
Definition: btr0mtib.h:525
bool is_empty() const
Definition: btr0mtib.h:531
size_t m_max_range
Maximum number of ranges to pre-allocate.
Definition: btr0mtib.h:559
void init(size_t max_range)
Initialize cache.
Definition: btr0mtib.cc:2197
bool check(size_t &num_alloc, size_t &num_free) const
Check for number of extents to be allocated and cached.
Definition: btr0mtib.cc:2461
std::array< Page_range_t, S_MAX_RANGES > m_ranges
Cached page ranges already allocated to the segment.
Definition: btr0mtib.h:556
std::atomic< size_t > m_num_consumed
Total number of ranges allocated.
Definition: btr0mtib.h:565
void set_range(size_t index, Page_range_t &range)
Set allocated range(extent) in cache.
Definition: btr0mtib.cc:2452
std::atomic< size_t > m_num_allocated
Total number of ranges allocated.
Definition: btr0mtib.h:562
bool is_full() const
Definition: btr0mtib.h:534
bool get_range(Page_range_t &range, bool &alloc_trigger)
Get one page range from the cache.
Definition: btr0mtib.cc:2432
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:3325
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:1750
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:1758
static void drop(Page_extent *extent)
Release the page extent.
Definition: btr0mtib.h:1777
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:1735
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:1802
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:1754
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:1766
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:1727
size_t m_n_recs
Number of user records in the page.
Definition: btr0mtib.h:1729
size_t m_data_size
Number of bytes of data.
Definition: btr0mtib.h:1732
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:852
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
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
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:895
Data structure for a database table.
Definition: dict0mem.h:1904
table_name_t name
Table name.
Definition: dict0mem.h:1979
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:155
Tablespace or log data space.
Definition: fil0fil.h:235
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.