diff options
author | unknown <jan@hundin.mysql.fi> | 2004-11-30 11:45:02 +0200 |
---|---|---|
committer | unknown <jan@hundin.mysql.fi> | 2004-11-30 11:45:02 +0200 |
commit | df0e057a52db9f085c42ec593f3000da4afdbbd7 (patch) | |
tree | cb2f2ad9f5ccc63eec024ffada123df6cf2e74ba /innobase/include/trx0trx.h | |
parent | f4110834a374dc647f2cba4d7bceaa88dc9d66e9 (diff) | |
download | mariadb-git-df0e057a52db9f085c42ec593f3000da4afdbbd7.tar.gz |
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.
Diffstat (limited to 'innobase/include/trx0trx.h')
-rw-r--r-- | innobase/include/trx0trx.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 602291f946a..8a16fa82057 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -16,6 +16,7 @@ Created 3/26/1996 Heikki Tuuri #include "que0types.h" #include "mem0mem.h" #include "read0types.h" +#include "xa.h" extern ulint trx_n_mysql_transactions; @@ -156,6 +157,36 @@ trx_commit_for_mysql( /*=================*/ /* out: 0 or error number */ trx_t* trx); /* in: trx handle */ + +/************************************************************************** +Does the transaction prepare for MySQL. */ + +ulint +trx_prepare_for_mysql( +/*=================*/ + /* out: 0 or error number */ + trx_t* trx); /* in: trx handle */ + +/************************************************************************** +This function is used to find number of prepared transactions and +their transaction objects for a recovery. */ + +int +trx_recover_for_mysql( +/*=================*/ + /* out: number of prepared transactions */ + XID* xid_list, /* in/out: prepared transactions */ + uint len); /* in: number of slots in xid_list */ + +/*********************************************************************** +This function is used to commit one X/Open XA distributed transaction +which is in the prepared state */ +trx_t * +trx_get_trx_by_xid( +/*===============*/ + /* out: trx or NULL */ + XID* xid); /* in: X/Open XA Transaction Idenfication */ + /************************************************************************** If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE. */ @@ -339,6 +370,9 @@ struct trx_struct{ if we can use the insert buffer for them, we set this FALSE */ dulint id; /* transaction id */ + XID xid; /* X/Open XA transaction + identification to identify a + transaction branch */ dulint no; /* transaction serialization number == max trx id when the transaction is moved to COMMITTED_IN_MEMORY state */ @@ -353,8 +387,10 @@ struct trx_struct{ dulint table_id; /* table id if the preceding field is TRUE */ /*------------------------------*/ - void* mysql_thd; /* MySQL thread handle corresponding - to this trx, or NULL */ + int active_trans; /* whether a transaction in MySQL + is active */ + void* mysql_thd; /* MySQL thread handle corresponding + to this trx, or NULL */ char** mysql_query_str;/* pointer to the field in mysqld_thd which contains the pointer to the current SQL query string */ @@ -543,6 +579,7 @@ struct trx_struct{ #define TRX_NOT_STARTED 1 #define TRX_ACTIVE 2 #define TRX_COMMITTED_IN_MEMORY 3 +#define TRX_PREPARED 4 /* Support for 2PC/XA */ /* Transaction execution states when trx state is TRX_ACTIVE */ #define TRX_QUE_RUNNING 1 /* transaction is running */ |