MySQL 9.0.0
Source Code Documentation
trx_coordinator Namespace Reference

Functions

bool commit_detached_by_xid (THD *thd, bool run_after_commit=true)
 Commits detached XA transaction by XID in all storage engines. More...
 
bool rollback_detached_by_xid (THD *thd)
 Rolls back detached XA transaction by XID in all storage engines. More...
 
bool commit_in_engines (THD *thd, bool all=false, bool run_after_commit=true)
 Commits the underlying transaction in storage engines. More...
 
bool rollback_in_engines (THD *thd, bool all=false)
 Rolls back the underlying transaction in storage engines. More...
 
int set_prepared_in_tc_in_engines (THD *thd, bool all=false)
 Marks the underlying transaction as PREPARED_IN_TC in storage engines. More...
 
bool should_statement_set_prepared_in_tc (THD *thd)
 Checks whether or not the underlying statement should trigger setting the transaction to PREPARED_IN_TC state. More...
 

Function Documentation

◆ commit_detached_by_xid()

bool trx_coordinator::commit_detached_by_xid ( THD thd,
bool  run_after_commit = true 
)

Commits detached XA transaction by XID in all storage engines.

Precondition
thd->transaction.flags.commit_low == true
Postcondition
thd->transaction.flags.commit_low == false
Parameters
thdThe THD session object holding the detached XA/XID.
run_after_commitTrue by default, otherwise, does not execute the after_commit hook in the function.
Returns
false if execution succeeded, true otherwise.

◆ commit_in_engines()

bool trx_coordinator::commit_in_engines ( THD thd,
bool  all = false,
bool  run_after_commit = true 
)

Commits the underlying transaction in storage engines.

Determines if the transaction to commit is attached to the thd parameter or, instead, the thd parameter holds the XID for a detached transaction to be committed.

Parameters
thdTHD session object.
allIs set in case of explicit commit (COMMIT statement), or implicit commit issued by DDL. Is not set when called at the end of statement, even if autocommit=1.
run_after_commitTrue by default, otherwise, does not execute the after_commit hook in the function.
Returns
false if the transaction was committed, true if an error occurred.

◆ rollback_detached_by_xid()

bool trx_coordinator::rollback_detached_by_xid ( THD thd)

Rolls back detached XA transaction by XID in all storage engines.

Parameters
thdThe THD session object holding the detached XA/XID.
Returns
false if execution succeeded, true otherwise.

◆ rollback_in_engines()

bool trx_coordinator::rollback_in_engines ( THD thd,
bool  all = false 
)

Rolls back the underlying transaction in storage engines.

Determines if the transaction to rollback is attached to the thd parameter or, instead, the thd parameter holds the XID for a detached transaction to be rolled back.

Parameters
thdTHD session object.
allIs set in case of explicit commit (COMMIT statement), or implicit commit issued by DDL. Is not set when called at the end of statement, even if autocommit=1.
Returns
false if the transaction was rolled back, true if an error occurred.

◆ set_prepared_in_tc_in_engines()

int trx_coordinator::set_prepared_in_tc_in_engines ( THD thd,
bool  all = false 
)

Marks the underlying transaction as PREPARED_IN_TC in storage engines.

The underlying executing statement is tested in order to understand if the transaction should be marked. The accepted statements are:

  • XA PREPARE [xid]
Parameters
thdTHD session object.
allIs set in case of explicit commit (COMMIT statement), or implicit commit issued by DDL. Is not set when called at the end of statement, even if autocommit=1.
Returns
0 id the transaction was marked as PREPARED_IN_TC in storage engines, error code otherwise.

◆ should_statement_set_prepared_in_tc()

bool trx_coordinator::should_statement_set_prepared_in_tc ( THD thd)

Checks whether or not the underlying statement should trigger setting the transaction to PREPARED_IN_TC state.

The accepted statemets are:

  • XA PREPARE [xid]
Parameters
thdTHD session object.
Returns
true if the underlying statement should trigger setting the transaction as PREPARED_IN_TC, false if not