MySQL 8.0.39
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...
 
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...
 

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
 
 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_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.

◆ 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.

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: