MySQL 8.0.39
Source Code Documentation
Buf_fetch< T > Struct Template Reference

This class implements the rules for fetching the pages from the buffer pool depending on the context. More...

Public Member Functions

 Buf_fetch (const page_id_t &page_id, const page_size_t &page_size) noexcept
 Constructor. More...
 
buf_block_tsingle_page ()
 For fetching a single page. More...
 

Public Attributes

const page_id_tm_page_id
 ID of page to lookup. More...
 
const page_size_tm_page_size
 Size of page on disk. More...
 
const bool m_is_temp_space {}
 true if page belongs to a temporary tablespace. More...
 
ulint m_rw_latch
 Latch mode required on the page. More...
 
buf_block_tm_guess {}
 Hint about page to fetch. More...
 
Page_fetch m_mode
 Fetch mode. More...
 
const char * m_file {}
 File from where called. More...
 
ulint m_line {}
 Line number in file from where called. More...
 
mtr_tm_mtr {}
 Mini-transaction covering the fetch. More...
 
bool m_dirty_with_no_latch {}
 Mark page as dirty even if page is being pinned without any latch. More...
 
size_t m_retries {}
 Number of retries before giving up. More...
 
buf_pool_tm_buf_pool {}
 Buffer pool to fetch from. More...
 
rw_lock_tm_hash_lock {}
 Hash table lock. More...
 
friend T
 

Private Member Functions

buf_block_tlookup ()
 Lookup page in the hash table. More...
 
buf_block_tis_on_watch ()
 Get page if it's in the buffer pool or set a watch on it. More...
 
void read_page ()
 Initiate a read request from persistent store. More...
 
dberr_t zip_page_handler (buf_block_t *&fix_block)
 
dberr_t check_state (buf_block_t *&block)
 Check block state. More...
 
void temp_space_page_handler (buf_block_t *block)
 Temporary table pages have different latching rules because they are not redo logged. More...
 
void mtr_add_page (buf_block_t *block)
 Add the page to the mini-transaction along with latching context. More...
 
bool is_optimistic () const
 Check if fetch mode is an optimistic fetch. More...
 
dberr_t debug_check (buf_block_t *fix_block)
 

Detailed Description

template<typename T>
struct Buf_fetch< T >

This class implements the rules for fetching the pages from the buffer pool depending on the context.

It will set the page latches as requested, detect and handle stale reads and initiate read requests if required.

Constructor & Destructor Documentation

◆ Buf_fetch()

template<typename T >
Buf_fetch< T >::Buf_fetch ( const page_id_t page_id,
const page_size_t page_size 
)
inlinenoexcept

Constructor.

Parameters
[in]page_idID of page to fetch.
[in]page_sizeSize of page on disk.

Member Function Documentation

◆ check_state()

template<typename T >
dberr_t Buf_fetch< T >::check_state ( buf_block_t *&  block)
private

Check block state.

Returns
DB_SUCCESS or error code.

◆ debug_check()

template<typename T >
dberr_t Buf_fetch< T >::debug_check ( buf_block_t fix_block)
private

◆ is_on_watch()

template<typename T >
buf_block_t * Buf_fetch< T >::is_on_watch
private

Get page if it's in the buffer pool or set a watch on it.

Returns
block that is being watched or nullptr.

◆ is_optimistic()

template<typename T >
bool Buf_fetch< T >::is_optimistic
private

Check if fetch mode is an optimistic fetch.

Returns
true if it's an optimistic fetch.

◆ lookup()

template<typename T >
buf_block_t * Buf_fetch< T >::lookup
private

Lookup page in the hash table.

Returns
block if found or nullptr if not found.

◆ mtr_add_page()

template<typename T >
void Buf_fetch< T >::mtr_add_page ( buf_block_t block)
private

Add the page to the mini-transaction along with latching context.

Parameters
[in,out]blockBlock for which to add the latching context.

◆ read_page()

template<typename T >
void Buf_fetch< T >::read_page
private

Initiate a read request from persistent store.

◆ single_page()

template<typename T >
buf_block_t * Buf_fetch< T >::single_page

For fetching a single page.

Returns
block from pool on success or nullptr on failure.

◆ temp_space_page_handler()

template<typename T >
void Buf_fetch< T >::temp_space_page_handler ( buf_block_t block)
private

Temporary table pages have different latching rules because they are not redo logged.

Parameters
[in,out]blockTemporary tablespace to fetch.

◆ zip_page_handler()

template<typename T >
dberr_t Buf_fetch< T >::zip_page_handler ( buf_block_t *&  fix_block)
private

Member Data Documentation

◆ m_buf_pool

template<typename T >
buf_pool_t* Buf_fetch< T >::m_buf_pool {}

Buffer pool to fetch from.

◆ m_dirty_with_no_latch

template<typename T >
bool Buf_fetch< T >::m_dirty_with_no_latch {}

Mark page as dirty even if page is being pinned without any latch.

◆ m_file

template<typename T >
const char* Buf_fetch< T >::m_file {}

File from where called.

◆ m_guess

template<typename T >
buf_block_t* Buf_fetch< T >::m_guess {}

Hint about page to fetch.

◆ m_hash_lock

template<typename T >
rw_lock_t* Buf_fetch< T >::m_hash_lock {}

Hash table lock.

◆ m_is_temp_space

template<typename T >
const bool Buf_fetch< T >::m_is_temp_space {}

true if page belongs to a temporary tablespace.

◆ m_line

template<typename T >
ulint Buf_fetch< T >::m_line {}

Line number in file from where called.

◆ m_mode

template<typename T >
Page_fetch Buf_fetch< T >::m_mode

Fetch mode.

◆ m_mtr

template<typename T >
mtr_t* Buf_fetch< T >::m_mtr {}

Mini-transaction covering the fetch.

◆ m_page_id

template<typename T >
const page_id_t& Buf_fetch< T >::m_page_id

ID of page to lookup.

◆ m_page_size

template<typename T >
const page_size_t& Buf_fetch< T >::m_page_size

Size of page on disk.

◆ m_retries

template<typename T >
size_t Buf_fetch< T >::m_retries {}

Number of retries before giving up.

◆ m_rw_latch

template<typename T >
ulint Buf_fetch< T >::m_rw_latch

Latch mode required on the page.

◆ T

template<typename T >
friend Buf_fetch< T >::T

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