MySQL 9.0.0
Source Code Documentation
buf_block_t Struct Reference

The buffer control block structure. More...

#include <buf0buf.h>

Classes

struct  ahi_t
 Structure that holds most AHI-related fields. More...
 

Public Member Functions

uint64_t get_modify_clock (bool single_threaded) const noexcept
 Get the modified clock (version) value. More...
 
const page_id_tget_page_id () const
 Get the page number and space id of the current buffer block. More...
 
page_no_t get_page_no () const
 Get the page number of the current buffer block. More...
 
page_no_t get_next_page_no () const
 Get the next page number of the current buffer block. More...
 
page_no_t get_prev_page_no () const
 Get the prev page number of the current buffer block. More...
 
page_type_t get_page_type () const
 Get the page type of the current buffer block. More...
 
void mark_for_read_io ()
 Mark the frame with jumbled page_id, while initiating i/o read (BUF_IO_READ). More...
 
uint16_t get_page_level () const
 
bool is_leaf () const
 
bool is_root () const
 
bool is_index_page () const
 
bool is_empty () const
 Check if this index page is empty. More...
 
const char * get_page_type_str () const noexcept
 Get the page type of the current buffer block as string. More...
 
page_zip_des_tget_page_zip () noexcept
 Gets the compressed page descriptor corresponding to an uncompressed page if applicable. More...
 
page_zip_des_t const * get_page_zip () const noexcept
 Const version. More...
 
bool is_memory () const noexcept
 

Public Attributes

struct buf_block_t::ahi_t ahi
 
std::atomic< uint32_t > n_hash_helps
 Counter which controls how many times the current prefix recommendation would help in searches. More...
 
bool made_dirty_with_no_latch
 true if block has been made dirty without acquiring X/SX latch as the block belongs to temporary tablespace and block is always accessed by a single thread. More...
 
BPageMutex mutex
 mutex protecting this block: state (also protected by the buffer pool mutex), io_fix, buf_fix_count, and accessed; we introduce this new mutex in InnoDB-5.1 to relieve contention on the buffer pool mutex More...
 
Debug fields
rw_lock_t debug_latch
 In the debug version, each thread which bufferfixes the block acquires an s-latch here; so we can use the debug utilities in sync0rw. More...
 
Optimistic search field
uint64_t modify_clock
 This clock is incremented every time a pointer to a record on the page may become obsolete; this is used in the optimistic cursor positioning: if the modify clock has not changed, we know that the pointer is still valid; this field may be changed if the thread (1) owns the LRU list mutex and the page is not bufferfixed, or (2) the thread has an x-latch on the block, or (3) the block must belong to an intrinsic table. More...
 

General fields

buf_page_t page
 page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t or buf_block_t More...
 
BPageLock lock
 read-write lock of the buffer frame More...
 
byteframe
 pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_PAGE_SIZE More...
 
bool in_unzip_LRU_list
 true if the page is in the decompressed LRU list; used in debugging More...
 
bool in_withdraw_list
 
bool was_freed () const
 Check if the buffer block was freed. More...
 
bool is_compact () const
 Determine whether the page is in new-style compact format. More...
 
 UT_LIST_NODE_T (buf_block_t) unzip_LRU
 node of the decompressed LRU list; a block is in the unzip_LRU list if page.state == BUF_BLOCK_FILE_PAGE and page.zip.data != NULL. More...
 

Detailed Description

The buffer control block structure.

Member Function Documentation

◆ get_modify_clock()

uint64_t buf_block_t::get_modify_clock ( bool  single_threaded) const
inlinenoexcept

Get the modified clock (version) value.

Parameters
[in]single_threadedThread can only be written to or read by a single thread
Returns
the modified clock vlue.

◆ get_next_page_no()

page_no_t buf_block_t::get_next_page_no ( ) const
inline

Get the next page number of the current buffer block.

Returns
next page number of the current buffer block.

◆ get_page_id()

const page_id_t & buf_block_t::get_page_id ( ) const
inline

Get the page number and space id of the current buffer block.

Returns
page number of the current buffer block.

◆ get_page_level()

uint16_t buf_block_t::get_page_level ( ) const

◆ get_page_no()

page_no_t buf_block_t::get_page_no ( ) const
inline

Get the page number of the current buffer block.

Returns
page number of the current buffer block.

◆ get_page_type()

page_type_t buf_block_t::get_page_type ( ) const
inline

Get the page type of the current buffer block.

Returns
page type of the current buffer block.

◆ get_page_type_str()

const char * buf_block_t::get_page_type_str ( ) const
noexcept

Get the page type of the current buffer block as string.

Returns
page type of the current buffer block as string.

◆ get_page_zip() [1/2]

page_zip_des_t const * buf_block_t::get_page_zip ( ) const
inlinenoexcept

Const version.

Returns
page descriptor or nullptr.

◆ get_page_zip() [2/2]

page_zip_des_t * buf_block_t::get_page_zip ( )
inlinenoexcept

Gets the compressed page descriptor corresponding to an uncompressed page if applicable.

Returns
page descriptor or nullptr.

◆ get_prev_page_no()

page_no_t buf_block_t::get_prev_page_no ( ) const
inline

Get the prev page number of the current buffer block.

Returns
prev page number of the current buffer block.

◆ is_compact()

bool buf_block_t::is_compact ( ) const

Determine whether the page is in new-style compact format.

Returns
true if the page is in compact format
false if it is in old-style format

◆ is_empty()

bool buf_block_t::is_empty ( void  ) const

Check if this index page is empty.

An index page is considered empty if the next record of an infimum record is supremum record. Presence of del-marked records will make the page non-empty.

Returns
true if this index page is empty.

◆ is_index_page()

bool buf_block_t::is_index_page ( ) const
inline

◆ is_leaf()

bool buf_block_t::is_leaf ( ) const
inline

◆ is_memory()

bool buf_block_t::is_memory ( ) const
inlinenoexcept

◆ is_root()

bool buf_block_t::is_root ( ) const
inline

◆ mark_for_read_io()

void buf_block_t::mark_for_read_io ( )
inline

Mark the frame with jumbled page_id, while initiating i/o read (BUF_IO_READ).

◆ UT_LIST_NODE_T()

buf_block_t::UT_LIST_NODE_T ( buf_block_t  )

node of the decompressed LRU list; a block is in the unzip_LRU list if page.state == BUF_BLOCK_FILE_PAGE and page.zip.data != NULL.

Protected by both LRU_list_mutex and the block mutex.

◆ was_freed()

bool buf_block_t::was_freed ( ) const
inline

Check if the buffer block was freed.

Returns
true if the block was freed, false otherwise.

Member Data Documentation

◆ ahi

struct buf_block_t::ahi_t buf_block_t::ahi

◆ debug_latch

rw_lock_t buf_block_t::debug_latch

In the debug version, each thread which bufferfixes the block acquires an s-latch here; so we can use the debug utilities in sync0rw.

◆ frame

byte* buf_block_t::frame

pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_PAGE_SIZE

◆ in_unzip_LRU_list

bool buf_block_t::in_unzip_LRU_list

true if the page is in the decompressed LRU list; used in debugging

◆ in_withdraw_list

bool buf_block_t::in_withdraw_list

◆ lock

BPageLock buf_block_t::lock

read-write lock of the buffer frame

◆ made_dirty_with_no_latch

bool buf_block_t::made_dirty_with_no_latch

true if block has been made dirty without acquiring X/SX latch as the block belongs to temporary tablespace and block is always accessed by a single thread.

◆ modify_clock

uint64_t buf_block_t::modify_clock

This clock is incremented every time a pointer to a record on the page may become obsolete; this is used in the optimistic cursor positioning: if the modify clock has not changed, we know that the pointer is still valid; this field may be changed if the thread (1) owns the LRU list mutex and the page is not bufferfixed, or (2) the thread has an x-latch on the block, or (3) the block must belong to an intrinsic table.

◆ mutex

BPageMutex buf_block_t::mutex

mutex protecting this block: state (also protected by the buffer pool mutex), io_fix, buf_fix_count, and accessed; we introduce this new mutex in InnoDB-5.1 to relieve contention on the buffer pool mutex

◆ n_hash_helps

std::atomic<uint32_t> buf_block_t::n_hash_helps

Counter which controls how many times the current prefix recommendation would help in searches.

If it is helpful enough, it will be used as the actual prefix to build hash for this block. It is modified similarly as recommended_prefix_info, that is only while having S- or X- latch on block's lock. Because it is modified concurrently, it may not have fully reliable count, but it is enough for this use case. Mind the n_hash_helps is AHI-related, and should be in the ahi_t struct above, but having it outside causes the made_dirty_with_no_latch to occupy the common 8byte aligned 8byte long space, so basically it saves us 8bytes of the object that is used in high volumes.

◆ page

buf_page_t buf_block_t::page

page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t or buf_block_t


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