MySQL 9.1.0
Source Code Documentation
cs::index::Locked_sidno_set Class Reference

Set that keeps track of TSID locks taken in the current scope. More...

#include <locked_sidno_set.h>

Public Member Functions

 Locked_sidno_set (Gtid_state &gtid_state)
 
 Locked_sidno_set (Locked_sidno_set &src)=delete
 
void add_lock_for_sidno (rpl_sidno sidno)
 Adds a given sidno to the internal set, does not acquire ownership. More...
 
void lock ()
 Locks recorded sidno locks, in order. More...
 
 ~Locked_sidno_set ()
 Destructor, releases all locks kept in the set. More...
 

Protected Types

using Set_type = std::set< rpl_sidno >
 Type of the set used. More...
 

Protected Attributes

Set_type m_sidno_set
 SIDs for which lock will be acquired. More...
 
std::reference_wrapper< Gtid_statem_gtid_state
 Reference to the current Gtid_state object (avoids using the global gtid_state variable in the class) More...
 
bool m_locked = false
 Is set currently locked? More...
 

Detailed Description

Set that keeps track of TSID locks taken in the current scope.

Provides dead-lock free mechanism for added sidnos, as sidnos are ordered in the set insuring a deterministic lock order Locks are added to the set by execution of the add_lock_for_sidno. Later, the user may call lock(), which will lock all recorded sidno locks. Locks will be released in destructor.

Used to optimize TSID locking/unlocking scheme (e.g. in assign_automatic_gtids_to_flush_group) to avoid constant locking/unlocking of TSID locks during the commit flush stage

Member Typedef Documentation

◆ Set_type

using cs::index::Locked_sidno_set::Set_type = std::set<rpl_sidno>
protected

Type of the set used.

Constructor & Destructor Documentation

◆ Locked_sidno_set() [1/2]

cs::index::Locked_sidno_set::Locked_sidno_set ( Gtid_state gtid_state)

◆ Locked_sidno_set() [2/2]

cs::index::Locked_sidno_set::Locked_sidno_set ( Locked_sidno_set src)
delete

◆ ~Locked_sidno_set()

cs::index::Locked_sidno_set::~Locked_sidno_set ( )

Destructor, releases all locks kept in the set.

Member Function Documentation

◆ add_lock_for_sidno()

void cs::index::Locked_sidno_set::add_lock_for_sidno ( rpl_sidno  sidno)

Adds a given sidno to the internal set, does not acquire ownership.

Parameters
sidnoTSID being considered

may be called several times for one sidno

◆ lock()

void cs::index::Locked_sidno_set::lock ( )

Locks recorded sidno locks, in order.

In case set is already locked, function does not take any action

Member Data Documentation

◆ m_gtid_state

std::reference_wrapper<Gtid_state> cs::index::Locked_sidno_set::m_gtid_state
protected

Reference to the current Gtid_state object (avoids using the global gtid_state variable in the class)

◆ m_locked

bool cs::index::Locked_sidno_set::m_locked = false
protected

Is set currently locked?

◆ m_sidno_set

Set_type cs::index::Locked_sidno_set::m_sidno_set
protected

SIDs for which lock will be acquired.


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