mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added support for X/Open XA prepare, recover, commit and rollback.
innobase/include/trx0roll.h: Changed prototype of the function trx_rollback_or_clean_all_without_sess because this function is executed in a background thread. innobase/include/trx0trx.h: Added support for X/Open XA prepare, recover and search by X/Open XA XID. innobase/include/trx0undo.h: Added support for X/Open XA prepare and recover. We need to store X/Open XA XID to the undo log header for recovery. innobase/log/log0recv.c: Create a thread to run trx_rollback_or_clean_all_without_sess function to rollback the uncommitted transactions which have no user session. innobase/row/row0ins.c: Remove unnecessary variables. innobase/trx/trx0roll.c: Changed so that trx_rollback_or_clean_all_without_sess is executed in a background thread. We should also leave all prepared transactions active to wait for commit or abort from MySQL. innobase/trx/trx0sys.c: Only those rows which belong to the active transaction in crash recovery are undone. innobase/trx/trx0trx.c: Added support for X/Open XA prepare and recover. We need to store X/Open XA XID to trx structure and left prepared transactions to wait for a commit or abort from MySQL. This requires also that we add TRX_PREPARED state to the transaction and TRX_UNDO_PREPARED state for undo logs. innobase/trx/trx0undo.c: Added support for X/Open XA prepare and recover. We need to store X/Open XA XID to undo log header for recovery of distributed transactions. sql/ha_innodb.h: Added prototypes for X/Open XA prepare, recover, commit and rollback. sql/handler.h: Added definition for X/Open XA XID structure.
This commit is contained in:
@ -193,6 +193,41 @@ typedef struct st_thd_trans {
|
||||
void *ndb_tid;
|
||||
} THD_TRANS;
|
||||
|
||||
#ifndef XIDDATASIZE /* no xa.h included */
|
||||
|
||||
/* XXX - may be we should disable xa completely in this case ? */
|
||||
#define XIDDATASIZE 128
|
||||
#define MAXGTRIDSIZE 64
|
||||
#define MAXBQUALSIZE 64
|
||||
|
||||
struct xid_t {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
long bqual_length;
|
||||
char data[XIDDATASIZE];
|
||||
};
|
||||
|
||||
typedef struct xid_t XID;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte slot;
|
||||
uint savepoint_offset;
|
||||
int (*close_connection)(THD *thd);
|
||||
int (*savepoint_set)(THD *thd, void *sv);
|
||||
int (*savepoint_rollback)(THD *thd, void *sv);
|
||||
int (*savepoint_release)(THD *thd, void *sv);
|
||||
int (*commit)(THD *thd, bool all);
|
||||
int (*rollback)(THD *thd, bool all);
|
||||
int (*prepare)(THD *thd, bool all);
|
||||
int (*recover)(XID *xid_list, uint len);
|
||||
int (*commit_by_xid)(XID *xid);
|
||||
int (*rollback_by_xid)(XID *xid);
|
||||
} handlerton;
|
||||
|
||||
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
|
||||
ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
|
||||
|
||||
|
Reference in New Issue
Block a user