MySQL 8.4.2
Source Code Documentation
Innodb_trx_scan_state Class Reference

State of a given scan. More...

Public Member Functions

 Innodb_trx_scan_state ()
 
 ~Innodb_trx_scan_state ()=default
 
scan_pass get_pass ()
 
void prepare_scan ()
 Prepare the scan: Sets the m_scan_pass used by get_pass() to determine which list caller should iterate, and [m_start_trx_id_range, m_end_trx_id_range) range used by trx_in_range(trx), which the caller should use to check if trx is in range. More...
 
bool trx_in_range (const trx_t *trx)
 Check if a transaction belongs to the current range. More...
 

Static Public Attributes

static constexpr trx_id_t SCAN_RANGE = 256
 

Private Member Functions

template<typename Trx_list >
bool prepare_end_of_range (Trx_list &trx_list)
 

Private Attributes

scan_pass m_scan_pass
 Current scan pass. More...
 
uint64_t m_start_trx_immutable_id_range
 Start of the current range (inclusive). More...
 
uint64_t m_end_trx_immutable_id_range
 End of the current range (exclusive). More...
 

Detailed Description

State of a given scan.

Scans are restartable, and done in multiple calls. Overall, the code scans separately:

  • the RW trx list
  • the MySQL trx list For each list, the scan is done by ranges of trx_immutable_id(trx) values. Saving the current scan state allows to resume where the previous scan ended. The typical usage is: state.prepare_scan(); for (trx : trx list for state.get_pass() ){ if(state.trx_in_range(trx)){ process trx } } It's callers responsibility to handle that the two lists aren't disjoint. The range of trx_immutable_id(..) values to be included in scan is decided by prepare_scan(..) so that it contains SCAN_RANGE transactions from current list.

Constructor & Destructor Documentation

◆ Innodb_trx_scan_state()

Innodb_trx_scan_state::Innodb_trx_scan_state ( )
inline

◆ ~Innodb_trx_scan_state()

Innodb_trx_scan_state::~Innodb_trx_scan_state ( )
default

Member Function Documentation

◆ get_pass()

scan_pass Innodb_trx_scan_state::get_pass ( )
inline

◆ prepare_end_of_range()

template<typename Trx_list >
bool Innodb_trx_scan_state::prepare_end_of_range ( Trx_list &  trx_list)
inlineprivate

◆ prepare_scan()

void Innodb_trx_scan_state::prepare_scan ( )
inline

Prepare the scan: Sets the m_scan_pass used by get_pass() to determine which list caller should iterate, and [m_start_trx_id_range, m_end_trx_id_range) range used by trx_in_range(trx), which the caller should use to check if trx is in range.

The range will contain at most SCAN_RANGE elements. Caller must hold trx_sys->mutex. When there are no more TRX for this pass, advances to the next pass.

◆ trx_in_range()

bool Innodb_trx_scan_state::trx_in_range ( const trx_t trx)
inline

Check if a transaction belongs to the current range.

Parameters
[in]trxTransaction to evaluate
Returns
True if transaction is within range.

Member Data Documentation

◆ m_end_trx_immutable_id_range

uint64_t Innodb_trx_scan_state::m_end_trx_immutable_id_range
private

End of the current range (exclusive).

◆ m_scan_pass

scan_pass Innodb_trx_scan_state::m_scan_pass
private

Current scan pass.

◆ m_start_trx_immutable_id_range

uint64_t Innodb_trx_scan_state::m_start_trx_immutable_id_range
private

Start of the current range (inclusive).

◆ SCAN_RANGE

constexpr trx_id_t Innodb_trx_scan_state::SCAN_RANGE = 256
staticconstexpr

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