MySQL 9.1.0
Source Code Documentation
|
#include <string.h>
#include <sys/types.h>
#include <list>
#include <mutex>
#include "lex_string.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sqlcommand.h"
#include "mysql/binlog/event/control_events.h"
#include "sql/malloc_allocator.h"
#include "sql/psi_memory_key.h"
#include "sql/sql_cmd.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "sql/xa_aux.h"
Go to the source code of this file.
Classes | |
struct | xid_t |
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991. More... | |
struct | st_xarecover_txn |
Plain structure to store information about XA transaction id and a list of table names involved into XA transaction with specified id. More... | |
class | XID_STATE |
class | Recovered_xa_transactions |
This class servers as a registry for prepared XA transactions existed before server was shutdown and being resurrected during the server restart. More... | |
Macros | |
#define | MYSQL_XID_PREFIX "MySQLXid" |
#define | XIDDATASIZE 128 |
Typedefs | |
typedef int64 | query_id_t |
typedef ulonglong | my_xid |
typedef struct xid_t | XID |
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991. More... | |
typedef struct st_xarecover_txn | XA_recover_txn |
Plain structure to store information about XA transaction id and a list of table names involved into XA transaction with specified id. More... | |
Enumerations | |
enum | xa_option_words { XA_NONE , XA_JOIN , XA_RESUME , XA_ONE_PHASE , XA_SUSPEND , XA_FOR_MIGRATE } |
Functions | |
bool | applier_reset_xa_trans (THD *thd) |
This is a specific to "slave" applier collection of standard cleanup actions to reset XA transaction state at the end of XA prepare rather than to do it at the transaction commit, see ha_commit_one_phase . More... | |
struct st_plugin_int * | plugin_find_by_type (const LEX_CSTRING &plugin, int type) |
Searches for a correctly loaded plugin of a particular type by name. More... | |
bool | detach_native_trx (THD *thd, plugin_ref plugin, void *) |
The function detaches existing storage engines transaction context from thd. More... | |
bool | reattach_native_trx (THD *thd, plugin_ref plugin, void *) |
The function reattaches existing storage engines transaction context to thd. More... | |
void | cleanup_trans_state (THD *thd) |
Reset some transaction state information and delete corresponding Transaction_ctx object from cache. More... | |
std::shared_ptr< Transaction_ctx > | find_trn_for_recover_and_check_its_state (THD *thd, xid_t *xid_for_trn_in_recover, XID_STATE *xid_state) |
Find XA transaction in cache by its xid value. More... | |
bool | acquire_mandatory_metadata_locks (THD *thd, xid_t *detached_xid) |
Acquire Commit metadata lock and all locks acquired by a prepared XA transaction before server was shutdown or terminated. More... | |
bool | xa_trans_force_rollback (THD *thd) |
Rollback the active XA transaction. More... | |
bool | disconnect_native_trx (THD *, plugin_ref, void *) |
Disconnect transaction in SE. More... | |
bool | thd_holds_xa_transaction (THD *thd) |
Test if the THD session underlying transaction is an externally coordinated (XA) transaction. More... | |
bool | is_xa_prepare (THD *thd) |
Checks whether or not the underlying statement is an XA PREPARE . More... | |
bool | is_xa_rollback (THD *thd) |
Checks whether or not the underlying statement is an XA ROLLBACK . More... | |
Variables | |
static const int | TC_HEURISTIC_NOT_USED = 0 |
static const int | TC_HEURISTIC_RECOVER_COMMIT = 1 |
static const int | TC_HEURISTIC_RECOVER_ROLLBACK = 2 |
#define MYSQL_XID_PREFIX "MySQLXid" |
#define XIDDATASIZE 128 |
typedef int64 query_id_t |
typedef struct st_xarecover_txn XA_recover_txn |
Plain structure to store information about XA transaction id and a list of table names involved into XA transaction with specified id.
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991.
http://www.opengroup.org/bookstore/catalog/c193.htm
enum xa_option_words |
Acquire Commit metadata lock and all locks acquired by a prepared XA transaction before server was shutdown or terminated.
thd | Thread context |
detached_xid | XID value specified by XA COMMIT or XA ROLLBACK that corresponds to a XA transaction generated outside current session context. |
false | Success |
true | Failure |
bool applier_reset_xa_trans | ( | THD * | thd | ) |
This is a specific to "slave" applier collection of standard cleanup actions to reset XA transaction state at the end of XA prepare rather than to do it at the transaction commit, see ha_commit_one_phase
.
THD of the slave applier is dissociated from a transaction object in engine that continues to exist there.
thd | current thread |
void cleanup_trans_state | ( | THD * | thd | ) |
Reset some transaction state information and delete corresponding Transaction_ctx object from cache.
thd | Current thread |
bool detach_native_trx | ( | THD * | thd, |
plugin_ref | plugin, | ||
void * | |||
) |
The function detaches existing storage engines transaction context from thd.
Backup area to save it is provided to low level storage engine function.
is invoked by plugin_foreach() after trans_xa_start() for each storage engine.
[in,out] | thd | Thread context |
plugin | Reference to handlerton |
bool disconnect_native_trx | ( | THD * | thd, |
plugin_ref | plugin, | ||
void * | |||
) |
Disconnect transaction in SE.
This the same action which is performed by SE when disconnecting a connection which has a prepared XA transaction, when xa_detach_on_prepare is OFF. Signature matches that required by plugin_foreach.
std::shared_ptr< Transaction_ctx > find_trn_for_recover_and_check_its_state | ( | THD * | thd, |
xid_t * | xid_for_trn_in_recover, | ||
XID_STATE * | xid_state | ||
) |
Find XA transaction in cache by its xid value.
thd | Thread context |
xid_for_trn_in_recover | xid value to look for in transaction cache |
xid_state | State of XA transaction in current session |
bool is_xa_prepare | ( | THD * | thd | ) |
Checks whether or not the underlying statement is an XA PREPARE
.
thd | THD session object. |
XA PREPARE
, false if not bool is_xa_rollback | ( | THD * | thd | ) |
Checks whether or not the underlying statement is an XA ROLLBACK
.
thd | THD session object. |
XA ROLLBACK
, false if not struct st_plugin_int * plugin_find_by_type | ( | const LEX_CSTRING & | plugin, |
int | type | ||
) |
Searches for a correctly loaded plugin of a particular type by name.
plugin | the name of the plugin we're looking for |
type | type of the plugin (0-MYSQL_MAX_PLUGIN_TYPE_NUM) |
bool reattach_native_trx | ( | THD * | thd, |
plugin_ref | plugin, | ||
void * | |||
) |
The function reattaches existing storage engines transaction context to thd.
Backup area to save it is provided to low level storage engine function.
is invoked by plugin_foreach() after trans_xa_prepare() for each storage engine.
[in,out] | thd | Thread context |
plugin | Reference to handlerton |
bool thd_holds_xa_transaction | ( | THD * | thd | ) |
Test if the THD session underlying transaction is an externally coordinated (XA) transaction.
thd | The session THD object holding the transaction to be tested. |
bool xa_trans_force_rollback | ( | THD * | thd | ) |
Rollback the active XA transaction.
|
static |
|
static |
|
static |