MySQL 9.1.0
Source Code Documentation
buf_page_t::Latching_rules_helpers Class Reference

The purpose of this class is to hide the knowledge that Buf_io_fix_latching_rules even exists from users of buf_page_t class, while also avoiding having to tediously repeat yourself in each place where buf_page_t's implementation needs to pass typical arguments to Buf_io_fix_latching_rules such as owned_latches or current state, which require access to private fields of buf_page_t. More...

Static Public Member Functions

static Buf_io_fix_latching_rules::latches_set_t get_owned_latches (const buf_page_t &page)
 Retrieves the set of latches held by current thread which are relevant to latching rules for the io_fix field of a given page. More...
 
static void assert_latches_let_distinguish (const buf_page_t &page, const Buf_io_fix_latching_rules::nodes_set_t &A, const Buf_io_fix_latching_rules::nodes_set_t &B)
 Checks if the current thread owns latches which are sufficient for a given page to meaningfully ask a question if page's io_fix value belongs to set A as opposed to set B. More...
 
static void assert_latches_let_distinguish (const buf_page_t &page, const Buf_io_fix_latching_rules::nodes_set_t &A)
 This is a convenience function the special case of the. More...
 
static void on_transition_to (const buf_page_t &page, const Buf_io_fix_latching_rules::node_t &new_state)
 Verifies that the current thread holds one of allowed sets of latches for a given transition from current page's io_fix state to new_state. More...
 

Detailed Description

The purpose of this class is to hide the knowledge that Buf_io_fix_latching_rules even exists from users of buf_page_t class, while also avoiding having to tediously repeat yourself in each place where buf_page_t's implementation needs to pass typical arguments to Buf_io_fix_latching_rules such as owned_latches or current state, which require access to private fields of buf_page_t.

So, the members of Latching_rules_helpers are conceptually like private methods of buf_page_t, but not exposed in the buf0buf.h file, so nobody else has to know about them.

Member Function Documentation

◆ assert_latches_let_distinguish() [1/2]

static void buf_page_t::Latching_rules_helpers::assert_latches_let_distinguish ( const buf_page_t page,
const Buf_io_fix_latching_rules::nodes_set_t A 
)
inlinestatic

This is a convenience function the special case of the.

See also
own_latches_to_distinguish(page,A,B) where B is the complement of A.
Parameters
[in]pagethe page which has the io_fix field we care about
[in]Aa set of buf_io_fix values

◆ assert_latches_let_distinguish() [2/2]

static void buf_page_t::Latching_rules_helpers::assert_latches_let_distinguish ( const buf_page_t page,
const Buf_io_fix_latching_rules::nodes_set_t A,
const Buf_io_fix_latching_rules::nodes_set_t B 
)
inlinestatic

Checks if the current thread owns latches which are sufficient for a given page to meaningfully ask a question if page's io_fix value belongs to set A as opposed to set B.

In particular it assumes that current thread indeed holds the latches preventing a state transition from A to outside of A, and from B to outside of B. Otherwise it prints error message to stderr and triggers assertion failure.

Parameters
[in]pagethe page which has the io_fix field we care about
[in]Afirst set of buf_io_fix values
[in]Bsecond set of buf_io_fix values

◆ get_owned_latches()

static Buf_io_fix_latching_rules::latches_set_t buf_page_t::Latching_rules_helpers::get_owned_latches ( const buf_page_t page)
inlinestatic

Retrieves the set of latches held by current thread which are relevant to latching rules for the io_fix field of a given page.

Parameters
[in]pagethe page which has the io_fix field we care about
Returns
the latches currently held by current thread

◆ on_transition_to()

static void buf_page_t::Latching_rules_helpers::on_transition_to ( const buf_page_t page,
const Buf_io_fix_latching_rules::node_t new_state 
)
inlinestatic

Verifies that the current thread holds one of allowed sets of latches for a given transition from current page's io_fix state to new_state.

Otherwise prints an error to std::cerr and triggers assertion failure

Parameters
[in]pagethe page which will change io_fix state
[in]new_statethe new desired state of io_fix for this page

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