MySQL 9.1.0
Source Code Documentation
Gtid_monitoring_info Class Reference

Stores information to monitor a transaction during the different replication stages. More...

#include <rpl_gtid.h>

Public Member Functions

 Gtid_monitoring_info (mysql_mutex_t *atomic_mutex_arg=nullptr)
 Create this GTID monitoring info object. More...
 
 ~Gtid_monitoring_info ()
 Destroy this GTID monitoring info object. More...
 
void atomic_lock ()
 Lock this object when no thread mutex is used to arbitrate the access. More...
 
void atomic_unlock ()
 Unlock this object when no thread mutex is used to arbitrate the access. More...
 
void clear ()
 Clear all monitoring information. More...
 
void clear_processing_trx ()
 Clear only the processing_trx monitoring info. More...
 
void clear_last_processed_trx ()
 Clear only the last_processed_trx monitoring info. More...
 
void start (Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg, bool skipped_arg=false)
 Sets the initial monitoring information. More...
 
void update (mysql::binlog::event::compression::type t, size_t payload_size, size_t uncompressed_size)
 
void finish ()
 Sets the final information, copy processing info to last_processed and clears processing info. More...
 
void copy_info_to (Trx_monitoring_info *processing_dest, Trx_monitoring_info *last_processed_dest)
 Copies both processing_trx and last_processed_trx info to other Trx_monitoring_info structures. More...
 
void copy_info_to (Gtid_monitoring_info *dest)
 Copies all monitoring info to other Gtid_monitoring_info object. More...
 
bool is_processing_trx_set ()
 Returns true if the processing_trx is set, false otherwise. More...
 
const Gtidget_processing_trx_gtid ()
 Returns the GTID of the processing_trx. More...
 
void store_transient_error (uint transient_errno_arg, const char *transient_err_message_arg, ulong trans_retries_arg)
 Stores the information about the last transient error in the current transaction, namely: the error number, message and total number of retries. More...
 

Protected Attributes

Trx_monitoring_infoprocessing_trx
 Holds information about transaction being processed. More...
 
Trx_monitoring_infolast_processed_trx
 Holds information about the last processed transaction. More...
 

Private Attributes

mysql_mutex_tatomic_mutex
 Mutex arbitrating the atomic access to the object. More...
 
std::atomic< bool > atomic_locked {false}
 The atomic locked flag. More...
 
bool is_locked = false
 Flag to assert the atomic lock behavior. More...
 

Detailed Description

Stores information to monitor a transaction during the different replication stages.

Constructor & Destructor Documentation

◆ Gtid_monitoring_info()

Gtid_monitoring_info::Gtid_monitoring_info ( mysql_mutex_t atomic_mutex_arg = nullptr)

Create this GTID monitoring info object.

Parameters
atomic_mutex_argWhen specified, this object will rely on the mutex to arbitrate the read/update access to object data. This will be used by the receiver thread, relying on mi->data_lock. When no mutex is specified, the object will rely on its own atomic mechanism.

◆ ~Gtid_monitoring_info()

Gtid_monitoring_info::~Gtid_monitoring_info ( )

Destroy this GTID monitoring info object.

Member Function Documentation

◆ atomic_lock()

void Gtid_monitoring_info::atomic_lock ( )

Lock this object when no thread mutex is used to arbitrate the access.

◆ atomic_unlock()

void Gtid_monitoring_info::atomic_unlock ( )

Unlock this object when no thread mutex is used to arbitrate the access.

◆ clear()

void Gtid_monitoring_info::clear ( )

Clear all monitoring information.

◆ clear_last_processed_trx()

void Gtid_monitoring_info::clear_last_processed_trx ( )

Clear only the last_processed_trx monitoring info.

◆ clear_processing_trx()

void Gtid_monitoring_info::clear_processing_trx ( )

Clear only the processing_trx monitoring info.

◆ copy_info_to() [1/2]

void Gtid_monitoring_info::copy_info_to ( Gtid_monitoring_info dest)

Copies all monitoring info to other Gtid_monitoring_info object.

Parameters
[out]destThe destination Gtid_monitoring_info.

◆ copy_info_to() [2/2]

void Gtid_monitoring_info::copy_info_to ( Trx_monitoring_info processing_dest,
Trx_monitoring_info last_processed_dest 
)

Copies both processing_trx and last_processed_trx info to other Trx_monitoring_info structures.

Parameters
[out]processing_destThe destination of processing_trx.
[out]last_processed_destThe destination of last_processed_trx.

◆ finish()

void Gtid_monitoring_info::finish ( )

Sets the final information, copy processing info to last_processed and clears processing info.

◆ get_processing_trx_gtid()

const Gtid * Gtid_monitoring_info::get_processing_trx_gtid ( )

Returns the GTID of the processing_trx.

◆ is_processing_trx_set()

bool Gtid_monitoring_info::is_processing_trx_set ( )

Returns true if the processing_trx is set, false otherwise.

◆ start()

void Gtid_monitoring_info::start ( Gtid  gtid_arg,
ulonglong  original_ts_arg,
ulonglong  immediate_ts_arg,
bool  skipped_arg = false 
)

Sets the initial monitoring information.

Parameters
gtid_argThe Gtid to be stored.
original_ts_argThe original commit timestamp of the GTID.
immediate_ts_argThe immediate commit timestamp of the GTID.
skipped_argTrue if the GTID was already applied. This only make sense for applier threads. That's why it is false by default.

When a new transaction starts processing, we reset all the information from the previous processing_trx and fetch the current timestamp as the new start_time.

If the transaction is being retried, only update the skipped field because it determines if the information will be kept after it finishes executing.

◆ store_transient_error()

void Gtid_monitoring_info::store_transient_error ( uint  transient_errno_arg,
const char *  transient_err_message_arg,
ulong  trans_retries_arg 
)

Stores the information about the last transient error in the current transaction, namely: the error number, message and total number of retries.

It also sets the timestamp for this error.

Parameters
transient_errno_argThe number of the transient error in this transaction.
transient_err_message_argThe message of this transient error.
trans_retries_argThe number of times this transaction has been retried.

◆ update()

void Gtid_monitoring_info::update ( mysql::binlog::event::compression::type  t,
size_t  payload_size,
size_t  uncompressed_size 
)

Member Data Documentation

◆ atomic_locked

std::atomic<bool> Gtid_monitoring_info::atomic_locked {false}
private

The atomic locked flag.

◆ atomic_mutex

mysql_mutex_t* Gtid_monitoring_info::atomic_mutex
private

Mutex arbitrating the atomic access to the object.

Some Gtid_monitoring_info will rely on replication thread locks (i.e.: the Master_info's one rely on mi->data_lock, that is already acquired every time the Gtid_monitoring_info needs to be updated).

Other Gtid_monitoring_info will rely on an atomic lock implemented in this class to avoid overlapped reads and writes over the information. (i.e.: the Relay_log_info's one sometimes is updated without rli locks).

When atomic_mutex is NULL, the object will rely on its own atomic mechanism.

◆ is_locked

bool Gtid_monitoring_info::is_locked = false
private

Flag to assert the atomic lock behavior.

◆ last_processed_trx

Trx_monitoring_info* Gtid_monitoring_info::last_processed_trx
protected

Holds information about the last processed transaction.

◆ processing_trx

Trx_monitoring_info* Gtid_monitoring_info::processing_trx
protected

Holds information about transaction being processed.


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