MySQL 8.4.2
Source Code Documentation
gr::Gtid_generator Class Reference

This class is responsible for generating GTIDs in the Certifier. More...

#include <gtid_generator.h>

Public Member Functions

std::pair< rpl_gno, mysql::utils::Return_statusget_next_available_gtid (const char *member_uuid, rpl_sidno sidno, const Gtid_set &gtid_set)
 This method is used to get the next valid GNO for the given sidno, for the transaction originating from the group member identified by the 'member_uuid'. More...
 
void recompute (const Gtid_set &gtid_set)
 This function recomputes generator state. More...
 
void initialize (uint64 gtid_assignment_block_size)
 This is initialization function that will be called in the certifier. More...
 
auto get_gtid_assignment_block_size () const
 Accesses gtid assignment block size the Gtid_generator was initialized with. More...
 

Private Attributes

std::unordered_map< rpl_sidno, Gtid_generator_for_sidnom_gtid_generator_for_sidno
 GTID bookkeeping for each sidno. More...
 
uint64 m_gtid_assignment_block_size = 1
 The group GTID assignment block size. More...
 

Detailed Description

This class is responsible for generating GTIDs in the Certifier.

Gtid certifier uses one instance of this class for generation of GTIDs. Gtid generator keeps track of free GTIDs for specific sidnos for each GR member. To achieve that, it consults gtid_set provided. When gtid generation is requested, GTID generator will reserve for each member a block of free GTIDS of size provided during the initialization (gtid_assignment_block_size). Recalculation of GTID blocks may be requested by the call to the "reset" function. New GTID may be generated by the call to the "get_next_available_gtid" function. Access to Gtid_generator must be synchronized by the user.

Member Function Documentation

◆ get_gtid_assignment_block_size()

auto gr::Gtid_generator::get_gtid_assignment_block_size ( ) const
inline

Accesses gtid assignment block size the Gtid_generator was initialized with.

Returns
Gtid assignment block size

◆ get_next_available_gtid()

std::pair< rpl_gno, mysql::utils::Return_status > gr::Gtid_generator::get_next_available_gtid ( const char *  member_uuid,
rpl_sidno  sidno,
const Gtid_set gtid_set 
)

This method is used to get the next valid GNO for the given sidno, for the transaction originating from the group member identified by the 'member_uuid'.

This method may consult gtid_set for the list of available GTIDs

Parameters
member_uuidThe UUID of the member from which this transaction originates. It will be NULL on View_change_log_event.
sidnoThe sidno that will be used on GTID
gtid_setGtid set under consideration
Returns
A pair of:
  • Generated gno and OK in case gno generation was possible
  • invalid gno and ERROR: (-1) when there are no available gnos for this SIDNO (-2) when assigned GTIDs block is exhausted

◆ initialize()

void gr::Gtid_generator::initialize ( uint64  gtid_assignment_block_size)

This is initialization function that will be called in the certifier.

Parameters
gtid_assignment_block_sizeThis is the size of gtid assignment block

◆ recompute()

void gr::Gtid_generator::recompute ( const Gtid_set gtid_set)

This function recomputes generator state.

Parameters
gtid_setGtid set under consideration

Member Data Documentation

◆ m_gtid_assignment_block_size

uint64 gr::Gtid_generator::m_gtid_assignment_block_size = 1
private

The group GTID assignment block size.

◆ m_gtid_generator_for_sidno

std::unordered_map<rpl_sidno, Gtid_generator_for_sidno> gr::Gtid_generator::m_gtid_generator_for_sidno
private

GTID bookkeeping for each sidno.


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