MySQL 8.0.39
Source Code Documentation
|
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 (binary_log::transaction::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 Gtid * | get_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_info * | processing_trx |
Holds information about transaction being processed. More... | |
Trx_monitoring_info * | last_processed_trx |
Holds information about the last processed transaction. More... | |
Private Attributes | |
mysql_mutex_t * | atomic_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... | |
Stores information to monitor a transaction during the different replication stages.
Gtid_monitoring_info::Gtid_monitoring_info | ( | mysql_mutex_t * | atomic_mutex_arg = nullptr | ) |
Create this GTID monitoring info object.
atomic_mutex_arg | When 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 | ( | ) |
Destroy this GTID monitoring info object.
void Gtid_monitoring_info::atomic_lock | ( | ) |
Lock this object when no thread mutex is used to arbitrate the access.
void Gtid_monitoring_info::atomic_unlock | ( | ) |
Unlock this object when no thread mutex is used to arbitrate the access.
void Gtid_monitoring_info::clear | ( | ) |
Clear all monitoring information.
void Gtid_monitoring_info::clear_last_processed_trx | ( | ) |
Clear only the last_processed_trx monitoring info.
void Gtid_monitoring_info::clear_processing_trx | ( | ) |
Clear only the processing_trx monitoring info.
void Gtid_monitoring_info::copy_info_to | ( | Gtid_monitoring_info * | dest | ) |
Copies all monitoring info to other Gtid_monitoring_info object.
[out] | dest | The destination Gtid_monitoring_info. |
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.
[out] | processing_dest | The destination of processing_trx. |
[out] | last_processed_dest | The destination of last_processed_trx. |
void Gtid_monitoring_info::finish | ( | ) |
Sets the final information, copy processing info to last_processed and clears processing info.
const Gtid * Gtid_monitoring_info::get_processing_trx_gtid | ( | ) |
Returns the GTID of the processing_trx.
bool Gtid_monitoring_info::is_processing_trx_set | ( | ) |
Returns true if the processing_trx is set, false otherwise.
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.
gtid_arg | The Gtid to be stored. |
original_ts_arg | The original commit timestamp of the GTID. |
immediate_ts_arg | The immediate commit timestamp of the GTID. |
skipped_arg | True 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.
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.
transient_errno_arg | The number of the transient error in this transaction. |
transient_err_message_arg | The message of this transient error. |
trans_retries_arg | The number of times this transaction has been retried. |
void Gtid_monitoring_info::update | ( | binary_log::transaction::compression::type | t, |
size_t | payload_size, | ||
size_t | uncompressed_size | ||
) |
|
private |
The atomic locked flag.
|
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.
|
private |
Flag to assert the atomic lock behavior.
|
protected |
Holds information about the last processed transaction.
|
protected |
Holds information about transaction being processed.