MySQL 8.0.39
Source Code Documentation
AckContainer Class Reference

AckContainer stores received acks internally and tell the caller the ack's position when a transaction is fully acknowledged, so it can wake up the waiting transactions. More...

#include <semisync_source.h>

Inheritance diagram for AckContainer:
[legend]

Public Member Functions

 AckContainer ()
 
 ~AckContainer ()
 
void clear ()
 Clear the content of the ack array. More...
 
int resize (unsigned int size, const AckInfo **ackinfo)
 Adjust capacity for the container and report the ack to semisync master, if it is full. More...
 
const AckInfoinsert (int server_id, const char *log_file_name, my_off_t log_file_pos)
 Insert an ack's information into the container and report the minimum ack to semisync master if it is full. More...
 
const AckInfoinsert (const AckInfo &ackinfo)
 
- Public Member Functions inherited from Trace
void function_enter (const char *func_name)
 
int function_exit (const char *func_name, int exit_code)
 
bool function_exit (const char *func_name, bool exit_code)
 
void function_exit (const char *func_name)
 
 Trace ()
 
 Trace (unsigned long trace_level)
 

Private Member Functions

 AckContainer (AckContainer &container)
 
AckContaineroperator= (const AckContainer &container)
 
bool full ()
 
unsigned int size ()
 
void remove_all (const char *log_file_name, my_off_t log_file_pos)
 Remove all acks which equal to the given position. More...
 
unsigned int updateIfExist (int server_id, const char *log_file_name, my_off_t log_file_pos)
 Update a slave's ack into the container if another ack of the slave is already in it. More...
 
AckInfominAck (const char *log_file_name, my_off_t log_file_pos)
 Find the minimum ack which is smaller than given position. More...
 

Private Attributes

AckInfo m_greatest_ack
 
AckInfom_ack_array
 
unsigned int m_size
 
unsigned int m_empty_slot
 

Additional Inherited Members

- Public Attributes inherited from Trace
unsigned long trace_level_
 
- Static Public Attributes inherited from Trace
static const unsigned long kTraceFunction = 0x0040
 
static const unsigned long kTraceGeneral = 0x0001
 
static const unsigned long kTraceDetail = 0x0010
 
static const unsigned long kTraceNetWait = 0x0020
 

Detailed Description

AckContainer stores received acks internally and tell the caller the ack's position when a transaction is fully acknowledged, so it can wake up the waiting transactions.

Constructor & Destructor Documentation

◆ AckContainer() [1/2]

AckContainer::AckContainer ( )
inline

◆ ~AckContainer()

AckContainer::~AckContainer ( )
inline

◆ AckContainer() [2/2]

AckContainer::AckContainer ( AckContainer container)
private

Member Function Documentation

◆ clear()

void AckContainer::clear ( )
inline

Clear the content of the ack array.

◆ full()

bool AckContainer::full ( )
inlineprivate

◆ insert() [1/2]

const AckInfo * AckContainer::insert ( const AckInfo ackinfo)
inline

◆ insert() [2/2]

const AckInfo * AckContainer::insert ( int  server_id,
const char *  log_file_name,
my_off_t  log_file_pos 
)

Insert an ack's information into the container and report the minimum ack to semisync master if it is full.

Parameters
[in]server_idslave server_id of the ack
[in]log_file_namebinlog file name of the ack
[in]log_file_posbinlog file position of the ack
Returns
Pointer of an ack if the ack should be reported to semisync master. Otherwise, NULL is returned.

◆ minAck()

AckInfo * AckContainer::minAck ( const char *  log_file_name,
my_off_t  log_file_pos 
)
inlineprivate

Find the minimum ack which is smaller than given position.

When more than one slots are minimum acks, it returns the one has smallest index.

Parameters
[in]log_file_namebinlog file name
[in]log_file_posbinlog file position
Returns
NULL if no ack is smaller than given position, otherwise return its pointer.

◆ operator=()

AckContainer & AckContainer::operator= ( const AckContainer container)
private

◆ remove_all()

void AckContainer::remove_all ( const char *  log_file_name,
my_off_t  log_file_pos 
)
inlineprivate

Remove all acks which equal to the given position.

Parameters
[in]log_file_namebinlog name of the ack that should be removed
[in]log_file_posbinlog position of the ack that should removed

◆ resize()

int AckContainer::resize ( unsigned int  size,
const AckInfo **  ackinfo 
)

Adjust capacity for the container and report the ack to semisync master, if it is full.

Parameters
[in]sizesize of the container.
ackinfoAcknowledgement information
Returns
0 if succeeds, otherwise fails.

◆ size()

unsigned int AckContainer::size ( )
inlineprivate

◆ updateIfExist()

unsigned int AckContainer::updateIfExist ( int  server_id,
const char *  log_file_name,
my_off_t  log_file_pos 
)
inlineprivate

Update a slave's ack into the container if another ack of the slave is already in it.

Parameters
[in]server_idserver_id of the ack
[in]log_file_namebinlog file name of the ack
[in]log_file_posbinlog file position of the ack
Returns
index of the slot that is updated. if it equals to the size of container, then no slot is updated.

Member Data Documentation

◆ m_ack_array

AckInfo* AckContainer::m_ack_array
private

◆ m_empty_slot

unsigned int AckContainer::m_empty_slot
private

◆ m_greatest_ack

AckInfo AckContainer::m_greatest_ack
private

◆ m_size

unsigned int AckContainer::m_size
private

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