MySQL 8.4.2
Source Code Documentation
|
Typedefs | |
using | recovery_statistics = std::pair< std::tuple< size_t, size_t, size_t >, std::tuple< size_t, size_t, size_t > > |
Pair of tuples used to store the information about success and failures of committing, rolling back or preparing transactions. More... | |
Functions | |
void | recover_one_internal_trx (xarecover_st const &info, handlerton &ht, XA_recover_txn const &xa_trx, my_xid xid, ::recovery_statistics &stats) |
Processes an internally coordinated transaction against the transaction coordinator internal state. More... | |
void | recover_one_external_trx (xarecover_st const &info, handlerton &ht, XA_recover_txn const &xa_trx, ::recovery_statistics &stats) |
Processes an externally coordinated transaction against the transaction coordinator internal state. More... | |
template<size_t state, size_t counter> | |
void | add_to_stats (::recovery_statistics &stats) |
Changes the given stats object by adding 1 to the given counter counter in the tuple state . More... | |
bool | has_failures (::recovery_statistics const &stats) |
Checks if there are any non-zero failure counters in the fiven statistics object. More... | |
std::string | print_stats (::recovery_statistics const &internal_stats, ::recovery_statistics const &external_stats) |
Composes a string presenting the statistics for the given objects. More... | |
bool | print_stat (::recovery_statistics const &stats, std::string const &trx_type, std::ostringstream &oss) |
Prints to the given string stream the textual representation of the statistics stored in the given object. More... | |
template<typename ID > | |
void | report_trx_recovery_error (int error, ID const &id, handlerton const &ht, enum xa_status_code failure_code, bool is_xa=false) |
Logs a message to the error log about failure to commit, rollback or prepare a transaction. More... | |
enum xa_status_code | generate_xa_recovery_error () |
Returns an XA status code according to active debug symbols. More... | |
Variables | |
constexpr size_t | STATS_FAILURE = 0 |
constexpr size_t | STATS_SUCCESS = 1 |
constexpr size_t | STATS_COMMITTED = 0 |
constexpr size_t | STATS_ROLLEDBACK = 1 |
constexpr size_t | STATS_PREPARED = 2 |
using anonymous_namespace{recovery.cc}::recovery_statistics = typedef std::pair<std::tuple<size_t, size_t, size_t>, std::tuple<size_t, size_t, size_t> > |
Pair of tuples used to store the information about success and failures of committing, rolling back or preparing transactions.
Counters are organized as follows
{ {Failed commits, Failed rollbacks, Failed prepares}, {Successful commits, Successful rallbacks, Successful prepares} }
void anonymous_namespace{recovery.cc}::add_to_stats | ( | ::recovery_statistics & | stats | ) |
Changes the given stats object by adding 1 to the given counter counter
in the tuple state
.
stats | The statistics object to change the counter for. |
enum xa_status_code anonymous_namespace{recovery.cc}::generate_xa_recovery_error | ( | ) |
Returns an XA status code according to active debug symbols.
If none of the targeted debug symbols are active, will return XA_OK.
bool anonymous_namespace{recovery.cc}::has_failures | ( | ::recovery_statistics const & | stats | ) |
Checks if there are any non-zero failure counters in the fiven statistics object.
stats | The statistics object to check for non-zero failure counters. |
bool anonymous_namespace{recovery.cc}::print_stat | ( | ::recovery_statistics const & | stats, |
std::string const & | trx_type, | ||
std::ostringstream & | oss | ||
) |
Prints to the given string stream the textual representation of the statistics stored in the given object.
stats | The object containing the statistics. |
trx_type | A string containing the textual description of the type of transaction the statistics refer to. |
oss | The string stream to print the textual representation to. |
std::string anonymous_namespace{recovery.cc}::print_stats | ( | ::recovery_statistics const & | internal_stats, |
::recovery_statistics const & | external_stats | ||
) |
Composes a string presenting the statistics for the given objects.
internal_stats | The object containing statistics for internally coordinated transactions. |
external_stats | The object containing statistics for externally transactions. |
void anonymous_namespace{recovery.cc}::recover_one_external_trx | ( | xarecover_st const & | info, |
handlerton & | ht, | ||
XA_recover_txn const & | xa_trx, | ||
::recovery_statistics & | stats | ||
) |
Processes an externally coordinated transaction against the transaction coordinator internal state.
Searches the TC information on externally coordinated transactions, xarecover_st::xa_list
for the XID of the transaction:
COMMITTED
, the transaction is committed in the storage engine. b. If the state is ROLLEDBACK
, the transaction is rolled back in the storage engine. c. If the state is PREPARED
, the transaction is kept in prepared state, added to the list of recovered transactions, visible with XA RECOVER
and storage engines are instructed to move the transaction to the PREPARED_IN_TC
state.info | TC internal state w.r.t to transaction state |
ht | The plugin interface for the storage engine to recover the transaction for |
xa_trx | The information about the transaction to be recovered |
stats | Repository of statistical information about transaction recovery success and failures |
void anonymous_namespace{recovery.cc}::recover_one_internal_trx | ( | xarecover_st const & | info, |
handlerton & | ht, | ||
XA_recover_txn const & | xa_trx, | ||
my_xid | xid, | ||
::recovery_statistics & | stats | ||
) |
Processes an internally coordinated transaction against the transaction coordinator internal state.
Searches the TC information on committed transactions, xarecover_st::commit_list
for the XID of the transaction:
TC_HEURISTIC_RECOVER_COMMIT
, commits the transaction in the storage engine.info | TC internal state w.r.t transaction state |
ht | The plugin interface for the storage engine to recover the transaction for |
xa_trx | The information about the transaction to be recovered |
xid | The internal XID of the transaction to be recovered |
stats | Repository of statistical information about transaction recovery success and failures |
void anonymous_namespace{recovery.cc}::report_trx_recovery_error | ( | int | error, |
ID const & | id, | ||
handlerton const & | ht, | ||
enum xa_status_code | failure_code, | ||
bool | is_xa = false |
||
) |
Logs a message to the error log about failure to commit, rollback or prepare a transaction.
The severity level used is INFORMATION_LEVEL.
error | The error to be reported, one of ER_BINLOG_CRASH_RECOVERY_COMMIT_FAILED, ER_BINLOG_CRASH_RECOVERY_ROLLBACK_FAILED, ER_BINLOG_CRASH_RECOVERY_PREPARE_FAILED |
id | The identifier of the transaction. A templated type is used to allow to print either the internal ID for internally coordinated transactions or the XID for externally coordinated transactions. |
ht | The handlerton for the storage engine that failed to complete the action. |
failure_code | The xa_status_code failure code returned by the SE. If no xa_status_code is returned from SE, XA_OK should passed to avoing adding the code to the message. |
is_xa | Whether or not the id refers to an XA transaction. |
|
constexpr |
|
constexpr |
constexpr size_t anonymous_namespace{recovery.cc}::STATS_PREPARED = 2 |
constexpr size_t anonymous_namespace{recovery.cc}::STATS_ROLLEDBACK = 1 |
constexpr size_t anonymous_namespace{recovery.cc}::STATS_SUCCESS = 1 |