MySQL 8.0.40
Source Code Documentation
Recovered_xa_transactions Class Reference

This class servers as a registry for prepared XA transactions existed before server was shutdown and being resurrected during the server restart. More...

#include <xa.h>

Public Member Functions

bool add_prepared_xa_transaction (XA_recover_txn const *prepared_xa_trn)
 Add information about prepared XA transaction into a list of XA transactions to resurrect. More...
 
bool recover_prepared_xa_transactions ()
 Iterate along a list of prepared XA transactions, register every XA transaction in a cache and acquire MDL locks for every table taking part in XA transaction being resurrected. More...
 
MEM_ROOTget_allocated_memroot ()
 Get initialized MEM_ROOT. More...
 

Static Public Member Functions

static bool init ()
 Initialize singleton. More...
 
static void destroy ()
 Cleanup and delete singleton object. More...
 
static Recovered_xa_transactionsinstance ()
 Get instance of the class Recovered_xa_transactions. More...
 

Private Member Functions

 Recovered_xa_transactions ()
 

Private Attributes

std::list< XA_recover_txn *, Malloc_allocator< XA_recover_txn * > > m_prepared_xa_trans
 
bool m_mem_root_inited
 
MEM_ROOT m_mem_root
 

Static Private Attributes

static Recovered_xa_transactionsm_instance = nullptr
 

Detailed Description

This class servers as a registry for prepared XA transactions existed before server was shutdown and being resurrected during the server restart.

The class is singleton. To collect a list of XA transaction identifiers and a list of tables for that MDL locks have be acquired the method add_prepared_xa_transaction() must be called. This method is invoked by the function trx_recover_for_mysql() called by innobase_xa_recover during running of X/Open XA distributed transaction recovery procedure. After a list of XA transaction identifiers and a list of table names to be locked in MDL have been collected and the function ha_recover() has returned control flow the method recover_prepared_xa_transactions() must be called to resurrect prepared XA transactions. Separation of collecting information about prepared XA transactions from restoring XA transactions is done in order to exclude possible suspending on MDL locks inside the function dd::reset_tables_and_tablespaces() that is called right after the function ha_recover() returns control flow.

Constructor & Destructor Documentation

◆ Recovered_xa_transactions()

Recovered_xa_transactions::Recovered_xa_transactions ( )
private

Member Function Documentation

◆ add_prepared_xa_transaction()

bool Recovered_xa_transactions::add_prepared_xa_transaction ( XA_recover_txn const *  prepared_xa_trn)

Add information about prepared XA transaction into a list of XA transactions to resurrect.

Parameters
prepared_xa_trninformation about prepared XA transaction
Returns
false on success, else true

◆ destroy()

void Recovered_xa_transactions::destroy ( )
static

Cleanup and delete singleton object.

◆ get_allocated_memroot()

MEM_ROOT * Recovered_xa_transactions::get_allocated_memroot ( )

Get initialized MEM_ROOT.

Returns
Pointer to a initialized MEM_ROOT.

◆ init()

bool Recovered_xa_transactions::init ( void  )
static

Initialize singleton.

◆ instance()

Recovered_xa_transactions & Recovered_xa_transactions::instance ( )
static

Get instance of the class Recovered_xa_transactions.

◆ recover_prepared_xa_transactions()

bool Recovered_xa_transactions::recover_prepared_xa_transactions ( )

Iterate along a list of prepared XA transactions, register every XA transaction in a cache and acquire MDL locks for every table taking part in XA transaction being resurrected.

Returns
false on success, else true

Member Data Documentation

◆ m_instance

Recovered_xa_transactions * Recovered_xa_transactions::m_instance = nullptr
staticprivate

◆ m_mem_root

MEM_ROOT Recovered_xa_transactions::m_mem_root
private

◆ m_mem_root_inited

bool Recovered_xa_transactions::m_mem_root_inited
private

◆ m_prepared_xa_trans

std::list<XA_recover_txn *, Malloc_allocator<XA_recover_txn *> > Recovered_xa_transactions::m_prepared_xa_trans
private

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