MySQL 8.4.2
Source Code Documentation
TC_LOG Class Referenceabstract

Transaction Coordinator Log. More...

#include <tc_log.h>

Inheritance diagram for TC_LOG:
[legend]

Public Types

enum  enum_result { RESULT_SUCCESS , RESULT_ABORTED , RESULT_INCONSISTENT }
 

Public Member Functions

bool using_heuristic_recover ()
 Perform heuristic recovery, if –tc-heuristic-recover was used. More...
 
 TC_LOG ()=default
 
virtual ~TC_LOG ()=default
 
virtual int open (const char *opt_name)=0
 Initialize and open the coordinator log. More...
 
virtual void close ()=0
 Close the transaction coordinator log and free any resources. More...
 
virtual enum_result commit (THD *thd, bool all)=0
 Log a commit record of the transaction to the transaction coordinator log. More...
 
virtual int rollback (THD *thd, bool all)=0
 Log a rollback record of the transaction to the transaction coordinator log. More...
 
virtual int prepare (THD *thd, bool all)=0
 Log a prepare record of the transaction to the storage engines. More...
 

Detailed Description

Transaction Coordinator Log.

A base abstract class for three different implementations of the transaction coordinator.

The server uses the transaction coordinator to order transactions correctly and there are three different implementations: one using an in-memory structure, one dummy that does not do anything, and one using the binary log for transaction coordination.

Member Enumeration Documentation

◆ enum_result

Enumerator
RESULT_SUCCESS 
RESULT_ABORTED 
RESULT_INCONSISTENT 

Constructor & Destructor Documentation

◆ TC_LOG()

TC_LOG::TC_LOG ( )
default

◆ ~TC_LOG()

virtual TC_LOG::~TC_LOG ( )
virtualdefault

Member Function Documentation

◆ close()

virtual void TC_LOG::close ( )
pure virtual

Close the transaction coordinator log and free any resources.

Called during server shutdown.

Implemented in MYSQL_BIN_LOG, TC_LOG_DUMMY, and TC_LOG_MMAP.

◆ commit()

virtual enum_result TC_LOG::commit ( THD thd,
bool  all 
)
pure virtual

Log a commit record of the transaction to the transaction coordinator log.

When the function returns, the transaction commit is properly logged to the transaction coordinator log and can be committed in the storage engines.

Parameters
thdSession to log transaction for.
allTrue if this is a "real" commit, false if it is a "statement" commit.
Returns
Error code on failure, zero on success.

Implemented in MYSQL_BIN_LOG, TC_LOG_DUMMY, and TC_LOG_MMAP.

◆ open()

virtual int TC_LOG::open ( const char *  opt_name)
pure virtual

Initialize and open the coordinator log.

Do recovery if necessary. Called during server startup.

Parameters
opt_nameName of logfile.
Return values
0success
1failed

Implemented in TC_LOG_DUMMY, MYSQL_BIN_LOG, and TC_LOG_MMAP.

◆ prepare()

virtual int TC_LOG::prepare ( THD thd,
bool  all 
)
pure virtual

Log a prepare record of the transaction to the storage engines.

Parameters
thdSession to log transaction record for.
alltrue if an explicit commit or an implicit commit for a statement, false if an internal commit of the statement.
Returns
Error code on failure, zero on success.

Implemented in MYSQL_BIN_LOG, TC_LOG_DUMMY, and TC_LOG_MMAP.

◆ rollback()

virtual int TC_LOG::rollback ( THD thd,
bool  all 
)
pure virtual

Log a rollback record of the transaction to the transaction coordinator log.

When the function returns, the transaction have been aborted in the transaction coordinator log.

Parameters
thdSession to log transaction record for.
alltrue if an explicit commit or an implicit commit for a statement, false if an internal commit of the statement.
Returns
Error code on failure, zero on success.

Implemented in MYSQL_BIN_LOG, TC_LOG_DUMMY, and TC_LOG_MMAP.

◆ using_heuristic_recover()

bool TC_LOG::using_heuristic_recover ( )

Perform heuristic recovery, if –tc-heuristic-recover was used.

Note
no matter whether heuristic recovery was successful or not mysqld must exit. So, return value is the same in both cases.
Return values
falseno heuristic recovery was requested
trueheuristic recovery was performed

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