MySQL 9.1.0
Source Code Documentation
Btree_load Class Reference

#include <btr0load.h>

Inheritance diagram for Btree_load:
[legend]

Classes

struct  Cursor
 Interface to consume from. More...
 

Public Types

using Page_loaders = std::vector< Page_load *, ut::allocator< Page_load * > >
 

Public Member Functions

 Btree_load (dict_index_t *index, trx_id_t trx_id, Flush_observer *observer) noexcept
 Constructor. More...
 
 ~Btree_load () noexcept
 Destructor. More...
 
dberr_t build (Cursor &cursor) noexcept
 Load the btree from the cursor. More...
 
dberr_t finish (dberr_t err) noexcept
 Btree bulk load finish. More...
 
void release () noexcept
 Release latch on the rightmost leaf page in the index tree. More...
 
void latch () noexcept
 Re-latch latch on the rightmost leaf page in the index tree. More...
 
dberr_t insert (dtuple_t *dtuple, size_t level) noexcept
 Insert a tuple to a page in a level. More...
 
uint64_t get_n_recs () noexcept
 Public getter function to return number of records inserted. More...
 

Private Member Functions

dberr_t load_root_page (page_no_t last_page_no) noexcept
 Set the root page on completion. More...
 
dberr_t page_split (Page_load *page_load, Page_load *next_page_load) noexcept
 Split a page. More...
 
dberr_t page_commit (Page_load *page_load, Page_load *next_page_load, bool insert_father) noexcept
 Commit(finish) a page. More...
 
dberr_t prepare_space (Page_load *&page_load, size_t level, size_t rec_size) noexcept
 Prepare space to insert a tuple. More...
 
dberr_t insert (Page_load *page_load, dtuple_t *tuple, big_rec_t *big_rec, size_t rec_size) noexcept
 Insert a tuple to a page. More...
 
void log_free_check () noexcept
 Log free check. More...
 
dberr_t finalize_page_loads (dberr_t err, page_no_t &last_page_no) noexcept
 Btree page bulk load finish. More...
 
- Private Member Functions inherited from ut::Non_copyable
 Non_copyable (const Non_copyable &)=delete
 
Non_copyableoperator= (const Non_copyable &)=delete
 
 Non_copyable ()=default
 
 ~Non_copyable ()=default
 

Private Attributes

uint64_t m_n_recs {}
 Number of records inserted. More...
 
dict_index_tm_index {}
 B-tree index. More...
 
trx_id_t m_trx_id {}
 Transaction id. More...
 
size_t m_root_level {}
 Root page level. More...
 
Flush_observerm_flush_observer {}
 Flush observer. More...
 
Page_loaders m_page_loaders {}
 Page cursor vector for all level. More...
 
unsigned m_index_online {}
 State of the index. More...
 

Detailed Description

Note
We should call commit(false) for a Page_load object, which is not in m_page_loaders after page_commit, and we will commit or abort Page_load objects in function "finish".

Member Typedef Documentation

◆ Page_loaders

Constructor & Destructor Documentation

◆ Btree_load()

Btree_load::Btree_load ( dict_index_t index,
trx_id_t  trx_id,
Flush_observer observer 
)
noexcept

Constructor.

Parameters
[in]indexB-tree index.
[in]trx_idTransaction id.
[in]observerFlush observer

◆ ~Btree_load()

Btree_load::~Btree_load ( )
noexcept

Destructor.

Member Function Documentation

◆ build()

dberr_t Btree_load::build ( Cursor cursor)
noexcept

Load the btree from the cursor.

Parameters
[in,out]cursorCursor to read tuples from.
Returns
DB_SUCCESS or error code.

◆ finalize_page_loads()

dberr_t Btree_load::finalize_page_loads ( dberr_t  err,
page_no_t last_page_no 
)
privatenoexcept

Btree page bulk load finish.

Commits the last page in each level if no error occurs. Also releases all page bulks.

Parameters
[in]errWhether bulk load was successful until now
[out]last_page_noLast page number
Returns
error code

◆ finish()

dberr_t Btree_load::finish ( dberr_t  err)
noexcept

Btree bulk load finish.

We commit the last page in each level and copy the last page in top level to the root page of the index if no error occurs.

Parameters
[in]errWhether bulk load was successful until now
Returns
error code

◆ get_n_recs()

uint64_t Btree_load::get_n_recs ( )
inlinenoexcept

Public getter function to return number of records inserted.

Returns
Number of records inserted

◆ insert() [1/2]

dberr_t Btree_load::insert ( dtuple_t dtuple,
size_t  level 
)
noexcept

Insert a tuple to a page in a level.

Parameters
[in]dtupleTuple to insert
[in]levelB-tree level
Returns
error code

◆ insert() [2/2]

dberr_t Btree_load::insert ( Page_load page_load,
dtuple_t tuple,
big_rec_t big_rec,
size_t  rec_size 
)
privatenoexcept

Insert a tuple to a page.

Parameters
[in]page_loadPage bulk object
[in]tupleTuple to insert
[in]big_recBig record vector, maybe NULL if there is no Data to be stored externally.
[in]rec_sizeRecord size
Returns
error code

◆ latch()

void Btree_load::latch ( )
noexcept

Re-latch latch on the rightmost leaf page in the index tree.

◆ load_root_page()

dberr_t Btree_load::load_root_page ( page_no_t  last_page_no)
privatenoexcept

Set the root page on completion.

Parameters
[in]last_page_noLast page number (the new root).
Returns
DB_SUCCESS or error code.

◆ log_free_check()

void Btree_load::log_free_check ( )
privatenoexcept

Log free check.

◆ page_commit()

dberr_t Btree_load::page_commit ( Page_load page_load,
Page_load next_page_load,
bool  insert_father 
)
privatenoexcept

Commit(finish) a page.

We set next/prev page no, compress a page of compressed table and split the page if compression fails, insert a node pointer to father page if needed, and commit mini-transaction.

Parameters
[in]page_loadPage to commit
[in]next_page_loadNext page
[in]insert_fatherFlag whether need to insert node ptr
Returns
error code

◆ page_split()

dberr_t Btree_load::page_split ( Page_load page_load,
Page_load next_page_load 
)
privatenoexcept

Split a page.

Parameters
[in]page_loadPage to split
[in]next_page_loadNext page
Returns
error code

◆ prepare_space()

dberr_t Btree_load::prepare_space ( Page_load *&  page_load,
size_t  level,
size_t  rec_size 
)
privatenoexcept

Prepare space to insert a tuple.

Parameters
[in,out]page_loadPage bulk that will be used to store the record. It may be replaced if there is not enough space to hold the record.
[in]levelB-tree level
[in]rec_sizeRecord size
Returns
error code

◆ release()

void Btree_load::release ( )
noexcept

Release latch on the rightmost leaf page in the index tree.

Member Data Documentation

◆ m_flush_observer

Flush_observer* Btree_load::m_flush_observer {}
private

Flush observer.

◆ m_index

dict_index_t* Btree_load::m_index {}
private

B-tree index.

◆ m_index_online

unsigned Btree_load::m_index_online {}
private

State of the index.

Used for asserting at the end of a bulk load operation to ensure that the online status of the index does not change

◆ m_n_recs

uint64_t Btree_load::m_n_recs {}
private

Number of records inserted.

◆ m_page_loaders

Page_loaders Btree_load::m_page_loaders {}
private

Page cursor vector for all level.

◆ m_root_level

size_t Btree_load::m_root_level {}
private

Root page level.

◆ m_trx_id

trx_id_t Btree_load::m_trx_id {}
private

Transaction id.


The documentation for this class was generated from the following files: