MySQL 8.4.2
Source Code Documentation
Btree_multi::Page_load Class Reference

The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – Page_load::finish – Page_load::commit. More...

#include <btr0mtib.h>

Inheritance diagram for Btree_multi::Page_load:
[legend]

Public Types

using Rec_offsets = ulint *
 

Public Member Functions

 Page_load (dict_index_t *index, Btree_load *btree_load)
 Ctor. More...
 
 ~Page_load () noexcept
 Destructor. More...
 
bool is_corrupted () const
 Check if page is corrupted. More...
 
void print_child_page_nos () noexcept
 Print the child page numbers. More...
 
bool is_memory () const
 Check if state of this page is BUF_BLOCK_MEMORY. More...
 
 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. More...
 
void set_trx_id (const trx_id_t trx_id)
 Set the transaction id. More...
 
void set_flush_observer (Flush_observer *observer)
 Set the flush observer. More...
 
bool is_leaf () const
 
void set_page_no (const page_no_t page_no)
 Set the page number of this object. More...
 
void set_leaf_seg (const fseg_header_t *hdr)
 
void set_top_seg (const fseg_header_t *hdr)
 
dberr_t init () noexcept
 Initialize members and allocate page if needed and start mtr. More...
 
dberr_t init_mem (const page_no_t new_page_no, Page_extent *page_extent) noexcept
 
dberr_t alloc () noexcept
 Allocate a page for this Page_load object. More...
 
dberr_t reinit () noexcept
 Re-initialize this page. More...
 
void reset () noexcept
 Reset this object so that Page_load::init() can be called again on this object. More...
 
dberr_t insert (const dtuple_t *tuple, const big_rec_t *big_rec, size_t rec_size) noexcept
 Insert a tuple in the page. More...
 
void finish () noexcept
 Mark end of insertion to the page. More...
 
dberr_t commit () noexcept
 Commit mtr for a page. More...
 
void rollback () noexcept
 Commit mtr for a page. More...
 
bool need_ext (const dtuple_t *tuple, size_t rec_size) const noexcept
 Check whether the record needs to be stored externally. More...
 
dtuple_tget_node_ptr () noexcept
 Get node pointer. More...
 
dtuple_tget_node_ptr (mem_heap_t *heap) noexcept
 Get node pointer. More...
 
size_t copy_all (const page_t *src_page) noexcept
 Copy all records from page. More...
 
size_t copy_to (std::vector< Page_load * > &to_pages)
 Distribute all records from this page to the given pages. More...
 
void set_next (page_no_t next_page_no) noexcept
 Set next page. More...
 
void set_prev (page_no_t prev_page_no) noexcept
 Set previous page. More...
 
page_no_t get_prev () noexcept
 Get previous page (FIL_PAGE_PREV). More...
 
void latch () noexcept
 Start mtr and latch block. More...
 
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. More...
 
page_no_t get_page_no () const noexcept
 Get page no. More...
 
page_id_t get_page_id () const noexcept
 
size_t get_page_size () const noexcept
 Get the physical page size of the underlying tablespace. More...
 
space_id_t space () const noexcept
 Get the table space ID. More...
 
bool verify_space_id () const
 Obtain tablespace id from the frame and the buffer block and ensure that they are the same. More...
 
size_t get_level () const noexcept
 Get page level. More...
 
void set_level (size_t level) noexcept
 Set the level of this page. More...
 
size_t get_rec_no () const
 Get record no. More...
 
const page_tget_page () const noexcept
 Get page. More...
 
page_tget_page () noexcept
 
void init_for_writing ()
 
size_t get_data_size () const
 
bool is_index_locked () noexcept
 Check if index is X locked. More...
 
size_t copy_records (const rec_t *first_rec) noexcept
 Copy given and all following records. More...
 
dberr_t insert (const rec_t *rec, Rec_offsets offsets) noexcept
 Insert a record in the page, check for duplicates too. More...
 
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. More...
 
void set_min_rec_flag (mtr_t *mtr)
 Set the REC_INFO_MIN_REC_FLAG on the first user record in this page. More...
 
void set_min_rec_flag ()
 Set the REC_INFO_MIN_REC_FLAG on the first user record in this page. More...
 
bool is_min_rec_flag () const
 
void set_level_ctx (Level_ctx *level_ctx)
 Set the level context object for this page load. More...
 
bool has_level_ctx () const
 Check if this page load object contains a level context object. More...
 
void free ()
 Free the memory block. More...
 
dict_index_tindex ()
 
buf_block_tget_block ()
 
void set_page_extent (Page_extent *page_extent)
 
void set_cached ()
 Mark the Page load as cached. More...
 
bool is_cached () const
 

Static Public Member Functions

static Page_loadcreate (Btree_load *btree_load, Page_extent *page_extent)
 A static member function to create this object. More...
 
static void drop (Page_load *page_load)
 Release the page loader. More...
 

Private Attributes

mem_heap_tm_heap {}
 Memory heap for internal allocation. More...
 
dict_index_tm_index {}
 The index B-tree. More...
 
mtr_tm_mtr {}
 The min-transaction. More...
 
trx_id_t m_trx_id {}
 The transaction id. More...
 
buf_block_tm_block {}
 The buffer block. More...
 
page_tm_page {}
 The page. More...
 
rec_tm_cur_rec {}
 The current rec, just before the next insert rec. More...
 
page_no_t m_page_no {}
 The page no. More...
 
size_t m_level {}
 The page level in B-tree. More...
 
const bool m_is_comp {}
 Flag: is page in compact format. More...
 
bytem_heap_top {}
 The heap top in page for next insert. More...
 
size_t m_rec_no {}
 User record no. More...
 
size_t m_free_space {}
 The free space left in the page. More...
 
size_t m_reserved_space {}
 The reserved space for fill factor. More...
 
size_t m_total_data {}
 Total data in the page. More...
 
uint64_t m_modify_clock {}
 The modify clock value of the buffer block when the block is re-pinned. More...
 
Flush_observerm_flush_observer {}
 Flush observer. More...
 
rec_tm_last_slotted_rec {}
 Last record assigned to a slot. More...
 
size_t m_slotted_rec_no {}
 Number of records assigned to slots. More...
 
bool m_modified {}
 Page modified flag. More...
 
Btree_loadm_btree_load {}
 
Level_ctxm_level_ctx {}
 
Page_extentm_page_extent {}
 
std::atomic_bool m_is_cached {false}
 true iff the the Page load is cached. More...
 

Friends

class Btree_load
 

Additional Inherited Members

- 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
 

Detailed Description

The proper function call sequence of Page_load is as below: – Page_load::init – Page_load::insert – Page_load::finish – Page_load::commit.

Member Typedef Documentation

◆ Rec_offsets

Constructor & Destructor Documentation

◆ Page_load() [1/2]

Page_load::Page_load ( dict_index_t index,
Btree_load btree_load 
)

Ctor.

Parameters
[in]indexB-tree index
[in]btree_loadbtree object to which this page belongs.

◆ ~Page_load()

Page_load::~Page_load ( )
noexcept

Destructor.

◆ Page_load() [2/2]

Btree_multi::Page_load::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 
)
inlinenoexcept

Constructor.

Parameters
[in]indexB-tree index
[in]trx_idTransaction id
[in]page_noPage number
[in]levelPage level
[in]observerFlush observer
[in]btree_loadbtree object to which this page belongs.

Member Function Documentation

◆ alloc()

dberr_t Page_load::alloc ( )
noexcept

Allocate a page for this Page_load object.

Returns
DB_SUCCESS on success, error code on failure.

◆ commit()

dberr_t Page_load::commit ( )
noexcept

Commit mtr for a page.

Returns
DB_SUCCESS on success, error code on failure.

◆ copy_all()

size_t Page_load::copy_all ( const page_t src_page)
noexcept

Copy all records from page.

Parameters
[in]src_pagePage with records to copy.

◆ copy_records()

size_t Page_load::copy_records ( const rec_t first_rec)
noexcept

Copy given and all following records.

Parameters
[in]first_recFirst record to copy

◆ copy_to()

size_t Page_load::copy_to ( std::vector< Page_load * > &  to_pages)

Distribute all records from this page to the given pages.

Parameters
[in,out]to_pagesarray of Page_load objects. return total number of records processed.

◆ create()

Page_load * Page_load::create ( Btree_load btree_load,
Page_extent page_extent 
)
static

A static member function to create this object.

Parameters
[in]btree_loadthe bulk load object to which this Page_load belongs.
[in]page_extentpage extent to which this page belongs.

◆ drop()

void Page_load::drop ( Page_load page_load)
static

Release the page loader.

Delete if not cached.

Parameters
[in]page_loadpage loader to delete.

◆ finish()

void Page_load::finish ( )
noexcept

Mark end of insertion to the page.

Scan records to set page dirs, and set page header members. The scan is incremental (slots and records which assignment could be "finalized" are not checked again. Check the m_slotted_rec_no usage, note it could be reset in some cases like during split. Note: we refer to page_copy_rec_list_end_to_created_page.

◆ free()

void Page_load::free ( )

Free the memory block.

◆ get_block()

buf_block_t * Btree_multi::Page_load::get_block ( )
inline

◆ get_data_size()

size_t Btree_multi::Page_load::get_data_size ( ) const
inline

◆ get_level()

size_t Btree_multi::Page_load::get_level ( ) const
inlinenoexcept

Get page level.

◆ get_node_ptr() [1/2]

dtuple_t * Page_load::get_node_ptr ( )
inlinenoexcept

Get node pointer.

Returns
node pointer

◆ get_node_ptr() [2/2]

dtuple_t * Page_load::get_node_ptr ( mem_heap_t heap)
noexcept

Get node pointer.

Parameters
[in]heapallocate node pointer in the given heap.
Returns
node pointer

◆ get_page() [1/2]

const page_t * Btree_multi::Page_load::get_page ( ) const
inlinenoexcept

Get page.

◆ get_page() [2/2]

page_t * Btree_multi::Page_load::get_page ( )
inlinenoexcept

◆ get_page_id()

page_id_t Btree_multi::Page_load::get_page_id ( ) const
inlinenoexcept

◆ get_page_no()

page_no_t Btree_multi::Page_load::get_page_no ( ) const
inlinenoexcept

Get page no.

◆ get_page_size()

size_t Page_load::get_page_size ( ) const
inlinenoexcept

Get the physical page size of the underlying tablespace.

Returns
the physical page size of the tablespace.

◆ get_prev()

page_no_t Page_load::get_prev ( )
noexcept

Get previous page (FIL_PAGE_PREV).

◆ get_rec_no()

size_t Btree_multi::Page_load::get_rec_no ( ) const
inline

Get record no.

◆ has_level_ctx()

bool Btree_multi::Page_load::has_level_ctx ( ) const
inline

Check if this page load object contains a level context object.

Returns
true if the page load contains a level context object.
false if the page load does NOT contain a level context object.

◆ index()

dict_index_t * Btree_multi::Page_load::index ( )
inline

◆ init()

dberr_t Page_load::init ( void  )
noexcept

Initialize members and allocate page if needed and start mtr.

Note
Must be called and only once right after constructor.
Returns
error code

◆ init_for_writing()

void Page_load::init_for_writing ( )

◆ init_mem()

dberr_t Page_load::init_mem ( const page_no_t  new_page_no,
Page_extent page_extent 
)
noexcept

◆ insert() [1/2]

dberr_t Page_load::insert ( const dtuple_t tuple,
const big_rec_t big_rec,
size_t  rec_size 
)
noexcept

Insert a tuple in the page.

Parameters
[in]tupleTuple to insert
[in]big_recExternal record
[in]rec_sizeRecord size
Returns
error code

◆ insert() [2/2]

dberr_t Page_load::insert ( const rec_t rec,
Rec_offsets  offsets 
)
noexcept

Insert a record in the page, check for duplicates too.

Parameters
[in]recRecord
[in]offsetsRecord offsets
Returns
DB_SUCCESS or error code.

◆ is_cached()

bool Btree_multi::Page_load::is_cached ( ) const
inline
Returns
true iff it is a cached Page Load.

◆ is_corrupted()

bool Page_load::is_corrupted ( ) const

Check if page is corrupted.

Returns
true if corrupted, false otherwise.

◆ is_index_locked()

bool Page_load::is_index_locked ( )
noexcept

Check if index is X locked.

Returns
true if index is locked.

◆ is_leaf()

bool Btree_multi::Page_load::is_leaf ( ) const
inline

◆ is_memory()

bool Btree_multi::Page_load::is_memory ( ) const
inline

Check if state of this page is BUF_BLOCK_MEMORY.

Returns
true if page state is BUF_BLOCK_MEMORY, false otherwise.

◆ is_min_rec_flag()

bool Page_load::is_min_rec_flag ( ) const

◆ is_space_available()

bool Page_load::is_space_available ( size_t  rec_size) const
inlinenoexcept

Check if required space is available in the page for the rec to be inserted.

We check fill factor & padding here.

Parameters
[in]rec_sizeRequired space
Returns
true if space is available

◆ latch()

void Btree_multi::Page_load::latch ( )
noexcept

Start mtr and latch block.

◆ need_ext()

bool Page_load::need_ext ( const dtuple_t tuple,
size_t  rec_size 
) const
noexcept

Check whether the record needs to be stored externally.

Returns
false if the entire record can be stored locally on the page

◆ print_child_page_nos()

void Page_load::print_child_page_nos ( )
noexcept

Print the child page numbers.

◆ reinit()

dberr_t Page_load::reinit ( )
noexcept

Re-initialize this page.

◆ reset()

void Page_load::reset ( void  )
noexcept

Reset this object so that Page_load::init() can be called again on this object.

◆ rollback()

void Page_load::rollback ( )
noexcept

Commit mtr for a page.

◆ set_cached()

void Btree_multi::Page_load::set_cached ( )
inline

Mark the Page load as cached.

Flush thread should not free this Page.

◆ set_flush_observer()

void Btree_multi::Page_load::set_flush_observer ( Flush_observer observer)
inline

Set the flush observer.

Parameters
[in]observerthe flush observer object to use.

◆ set_leaf_seg()

void Btree_multi::Page_load::set_leaf_seg ( const fseg_header_t hdr)
inline

◆ set_level()

void Btree_multi::Page_load::set_level ( size_t  level)
inlinenoexcept

Set the level of this page.

◆ set_level_ctx()

void Btree_multi::Page_load::set_level_ctx ( Level_ctx level_ctx)
inline

Set the level context object for this page load.

Parameters
[in]level_ctxthe level context object.

◆ set_min_rec_flag() [1/2]

void Page_load::set_min_rec_flag ( )

Set the REC_INFO_MIN_REC_FLAG on the first user record in this page.

◆ set_min_rec_flag() [2/2]

void Page_load::set_min_rec_flag ( mtr_t mtr)

Set the REC_INFO_MIN_REC_FLAG on the first user record in this page.

Parameters
[in]mtrmini transaction context.

◆ set_next()

void Page_load::set_next ( page_no_t  next_page_no)
noexcept

Set next page.

Parameters
[in]next_page_noNext page no

◆ set_page_extent()

void Btree_multi::Page_load::set_page_extent ( Page_extent page_extent)
inline

◆ set_page_no()

void Page_load::set_page_no ( const page_no_t  page_no)

Set the page number of this object.

◆ set_prev()

void Page_load::set_prev ( page_no_t  prev_page_no)
noexcept

Set previous page.

Parameters
[in]prev_page_noPrevious page no

◆ set_top_seg()

void Btree_multi::Page_load::set_top_seg ( const fseg_header_t hdr)
inline

◆ set_trx_id()

void Btree_multi::Page_load::set_trx_id ( const trx_id_t  trx_id)
inline

Set the transaction id.

Parameters
[in]trx_idthe transaction id to used.

◆ space()

space_id_t Page_load::space ( ) const
inlinenoexcept

Get the table space ID.

Returns
the table space ID.

◆ store_ext()

dberr_t Btree_multi::Page_load::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.

the blob data is logged first, then the record is logged in bulk mode.

Parameters
[in]big_recExternal record
[in]offsetsRecord offsets
Returns
error code

◆ verify_space_id()

bool Page_load::verify_space_id ( ) const

Obtain tablespace id from the frame and the buffer block and ensure that they are the same.

Returns
true if space id is same in both places.

Friends And Related Function Documentation

◆ Btree_load

friend class Btree_load
friend

Member Data Documentation

◆ m_block

buf_block_t* Btree_multi::Page_load::m_block {}
private

The buffer block.

◆ m_btree_load

Btree_load* Btree_multi::Page_load::m_btree_load {}
private

◆ m_cur_rec

rec_t* Btree_multi::Page_load::m_cur_rec {}
private

The current rec, just before the next insert rec.

◆ m_flush_observer

Flush_observer* Btree_multi::Page_load::m_flush_observer {}
private

Flush observer.

◆ m_free_space

size_t Btree_multi::Page_load::m_free_space {}
private

The free space left in the page.

◆ m_heap

mem_heap_t* Btree_multi::Page_load::m_heap {}
private

Memory heap for internal allocation.

◆ m_heap_top

byte* Btree_multi::Page_load::m_heap_top {}
private

The heap top in page for next insert.

◆ m_index

dict_index_t* Btree_multi::Page_load::m_index {}
private

The index B-tree.

◆ m_is_cached

std::atomic_bool Btree_multi::Page_load::m_is_cached {false}
private

true iff the the Page load is cached.

◆ m_is_comp

const bool Btree_multi::Page_load::m_is_comp {}
private

Flag: is page in compact format.

◆ m_last_slotted_rec

rec_t* Btree_multi::Page_load::m_last_slotted_rec {}
private

Last record assigned to a slot.

◆ m_level

size_t Btree_multi::Page_load::m_level {}
private

The page level in B-tree.

◆ m_level_ctx

Level_ctx* Btree_multi::Page_load::m_level_ctx {}
private

◆ m_modified

bool Btree_multi::Page_load::m_modified {}
private

Page modified flag.

◆ m_modify_clock

uint64_t Btree_multi::Page_load::m_modify_clock {}
private

The modify clock value of the buffer block when the block is re-pinned.

◆ m_mtr

mtr_t* Btree_multi::Page_load::m_mtr {}
private

The min-transaction.

◆ m_page

page_t* Btree_multi::Page_load::m_page {}
private

The page.

◆ m_page_extent

Page_extent* Btree_multi::Page_load::m_page_extent {}
private

◆ m_page_no

page_no_t Btree_multi::Page_load::m_page_no {}
private

The page no.

◆ m_rec_no

size_t Btree_multi::Page_load::m_rec_no {}
private

User record no.

◆ m_reserved_space

size_t Btree_multi::Page_load::m_reserved_space {}
private

The reserved space for fill factor.

◆ m_slotted_rec_no

size_t Btree_multi::Page_load::m_slotted_rec_no {}
private

Number of records assigned to slots.

◆ m_total_data

size_t Btree_multi::Page_load::m_total_data {}
private

Total data in the page.

◆ m_trx_id

trx_id_t Btree_multi::Page_load::m_trx_id {}
private

The transaction id.


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