Loading innobase/include/trx0roll.h +5 −4 Original line number Diff line number Diff line Loading @@ -104,11 +104,12 @@ trx_rollback( /*********************************************************************** Rollback or clean up transactions which have no user session. If the transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. */ undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread */ void trx_rollback_or_clean_all_without_sess(void); /*========================================*/ void * trx_rollback_or_clean_all_without_sess(void *); /*============================================*/ /******************************************************************** Finishes a transaction rollback. */ Loading innobase/include/trx0trx.h +39 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading Loading @@ -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 */ Loading @@ -353,6 +387,8 @@ struct trx_struct{ dulint table_id; /* table id if the preceding field is TRUE */ /*------------------------------*/ 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 Loading Loading @@ -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 */ Loading innobase/include/trx0undo.h +46 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ Created 3/26/1996 Heikki Tuuri #include "mtr0mtr.h" #include "trx0sys.h" #include "page0types.h" #include "xa.h" /*************************************************************************** Builds a roll pointer dulint. */ Loading Loading @@ -239,6 +240,18 @@ trx_undo_set_state_at_finish( trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr); /* in: mtr */ /********************************************************************** Sets the state of the undo log segment at a transaction prepare. */ page_t* trx_undo_set_state_at_prepare( /*==========================*/ /* out: undo log segment header page, x-latched */ trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr); /* in: mtr */ /************************************************************************** Adds the update undo log header as the first in the history list, and frees the memory object, or puts it to the list of cached update undo log Loading Loading @@ -294,7 +307,23 @@ trx_undo_parse_discard_latest( byte* end_ptr,/* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr); /* in: mtr or NULL */ /************************************************************************ Write X/Open XA Transaction Identification (XID) to undo log header */ void trx_undo_write_xid( /*===============*/ trx_ulogf_t* log_hdr,/* in: undo log header */ XID* xid); /* in: X/Open XA Transaction Identification */ /************************************************************************ Read X/Open XA Transaction Identification (XID) from undo log header */ void trx_undo_read_xid( /*==============*/ trx_ulogf_t* log_hdr,/* in: undo log header */ XID* xid); /* out: X/Open XA Transaction Identification */ /* Types of an undo log segment */ #define TRX_UNDO_INSERT 1 /* contains undo entries for inserts */ Loading @@ -310,6 +339,8 @@ trx_undo_parse_discard_latest( #define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be reused: it can be freed in purge when all undo data in it is removed */ #define TRX_UNDO_PREPARED 5 /* contains an undo log of an prepared transaction */ /* Transaction undo log memory object; this is protected by the undo_mutex in the corresponding transaction object */ Loading @@ -332,6 +363,8 @@ struct trx_undo_struct{ field */ dulint trx_id; /* id of the trx assigned to the undo log */ XID xid; /* X/Open XA transaction identification */ ibool dict_operation; /* TRUE if a dict operation trx */ dulint table_id; /* if a dict operation, then the table id */ Loading Loading @@ -452,7 +485,18 @@ page of an update undo log segment. */ #define TRX_UNDO_HISTORY_NODE 34 /* If the log is put to the history list, the file list node is here */ /*-------------------------------------------------------------*/ #define TRX_UNDO_LOG_HDR_SIZE (34 + FLST_NODE_SIZE) /* X/Open XA Transaction Identification (XID) */ #define TRX_UNDO_XA_FORMAT (34 + FLST_NODE_SIZE) #define TRX_UNDO_XA_TRID_LEN (TRX_UNDO_XA_FORMAT + 4) #define TRX_UNDO_XA_BQUAL_LEN (TRX_UNDO_XA_TRID_LEN + 4) #define TRX_UNDO_XA_XID (TRX_UNDO_XA_BQUAL_LEN + 4) #define TRX_UNDO_XA_LEN (TRX_UNDO_XA_XID + XIDDATASIZE) #define TRX_UNDO_XA_EXISTS 256 /*-------------------------------------------------------------*/ #define TRX_UNDO_LOG_HDR_SIZE (TRX_UNDO_XA_LEN) /*-------------------------------------------------------------*/ #ifndef UNIV_NONINL #include "trx0undo.ic" Loading innobase/include/xa.h 0 → 100644 +182 −0 Original line number Diff line number Diff line /*- * See the file LICENSE for redistribution information. * * Copyright (c) 1998-2002 * Sleepycat Software. All rights reserved. * * $Id: xa.h,v 11.5 2002/01/11 15:52:30 bostic Exp $ */ /* * Start of xa.h header * * Define a symbol to prevent multiple inclusions of this header file */ #ifndef XA_H #define XA_H /* * Transaction branch identification: XID and NULLXID: */ #ifndef XIDDATASIZE #define XIDDATASIZE 128 /* size in bytes */ #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ struct xid_t { long formatID; /* format identifier */ long gtrid_length; /* value from 1 through 64 */ long bqual_length; /* value from 1 through 64 */ char data[XIDDATASIZE]; }; typedef struct xid_t XID; #endif /* * A value of -1 in formatID means that the XID is null. */ /* * Declarations of routines by which RMs call TMs: */ extern int ax_reg __P((int, XID *, long)); extern int ax_unreg __P((int, long)); /* * XA Switch Data Structure */ #define RMNAMESZ 32 /* length of resource manager name, */ /* including the null terminator */ #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */ /* strings, including the null terminator */ struct xa_switch_t { char name[RMNAMESZ]; /* name of resource manager */ long flags; /* resource manager specific options */ long version; /* must be 0 */ int (*xa_open_entry) /* xa_open function pointer */ __P((char *, int, long)); int (*xa_close_entry) /* xa_close function pointer */ __P((char *, int, long)); int (*xa_start_entry) /* xa_start function pointer */ __P((XID *, int, long)); int (*xa_end_entry) /* xa_end function pointer */ __P((XID *, int, long)); int (*xa_rollback_entry) /* xa_rollback function pointer */ __P((XID *, int, long)); int (*xa_prepare_entry) /* xa_prepare function pointer */ __P((XID *, int, long)); int (*xa_commit_entry) /* xa_commit function pointer */ __P((XID *, int, long)); int (*xa_recover_entry) /* xa_recover function pointer */ __P((XID *, long, int, long)); int (*xa_forget_entry) /* xa_forget function pointer */ __P((XID *, int, long)); int (*xa_complete_entry) /* xa_complete function pointer */ __P((int *, int *, int, long)); }; /* * Flag definitions for the RM switch */ #define TMNOFLAGS 0x00000000L /* no resource manager features selected */ #define TMREGISTER 0x00000001L /* resource manager dynamically registers */ #define TMNOMIGRATE 0x00000002L /* resource manager does not support association migration */ #define TMUSEASYNC 0x00000004L /* resource manager supports asynchronous operations */ /* * Flag definitions for xa_ and ax_ routines */ /* use TMNOFLAGGS, defined above, when not specifying other flags */ #define TMASYNC 0x80000000L /* perform routine asynchronously */ #define TMONEPHASE 0x40000000L /* caller is using one-phase commit optimisation */ #define TMFAIL 0x20000000L /* dissociates caller and marks transaction branch rollback-only */ #define TMNOWAIT 0x10000000L /* return if blocking condition exists */ #define TMRESUME 0x08000000L /* caller is resuming association with suspended transaction branch */ #define TMSUCCESS 0x04000000L /* dissociate caller from transaction branch */ #define TMSUSPEND 0x02000000L /* caller is suspending, not ending, association */ #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ #define TMENDRSCAN 0x00800000L /* end a recovery scan */ #define TMMULTIPLE 0x00400000L /* wait for any asynchronous operation */ #define TMJOIN 0x00200000L /* caller is joining existing transaction branch */ #define TMMIGRATE 0x00100000L /* caller intends to perform migration */ /* * ax_() return codes (transaction manager reports to resource manager) */ #define TM_JOIN 2 /* caller is joining existing transaction branch */ #define TM_RESUME 1 /* caller is resuming association with suspended transaction branch */ #define TM_OK 0 /* normal execution */ #define TMER_TMERR -1 /* an error occurred in the transaction manager */ #define TMER_INVAL -2 /* invalid arguments were given */ #define TMER_PROTO -3 /* routine invoked in an improper context */ /* * xa_() return codes (resource manager reports to transaction manager) */ #define XA_RBBASE 100 /* The inclusive lower bound of the rollback codes */ #define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an unspecified reason */ #define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a communication failure */ #define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ #define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the integrity of the resources was detected */ #define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the transaction branch for a reason not on this list */ #define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the resource manager */ #define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */ #define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ #define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the rollback codes */ #define XA_NOMIGRATE 9 /* resumption must occur where suspension occurred */ #define XA_HEURHAZ 8 /* the transaction branch may have been heuristically completed */ #define XA_HEURCOM 7 /* the transaction branch has been heuristically committed */ #define XA_HEURRB 6 /* the transaction branch has been heuristically rolled back */ #define XA_HEURMIX 5 /* the transaction branch has been heuristically committed and rolled back */ #define XA_RETRY 4 /* routine returned with no effect and may be re-issued */ #define XA_RDONLY 3 /* the transaction branch was read-only and has been committed */ #define XA_OK 0 /* normal execution */ #define XAER_ASYNC -2 /* asynchronous operation already outstanding */ #define XAER_RMERR -3 /* a resource manager error occurred in the transaction branch */ #define XAER_NOTA -4 /* the XID is not valid */ #define XAER_INVAL -5 /* invalid arguments were given */ #define XAER_PROTO -6 /* routine invoked in an improper context */ #define XAER_RMFAIL -7 /* resource manager unavailable */ #define XAER_DUPID -8 /* the XID already exists */ #define XAER_OUTSIDE -9 /* resource manager doing work outside transaction */ #endif /* ifndef XA_H */ /* * End of xa.h header */ innobase/log/log0recv.c +11 −3 Original line number Diff line number Diff line Loading @@ -2851,11 +2851,13 @@ void recv_recovery_from_checkpoint_finish(void) /*======================================*/ { int i; os_thread_id_t recovery_thread_id; /* Rollback the uncommitted transactions which have no user session */ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { trx_rollback_or_clean_all_without_sess(); } fprintf(stderr, "InnoDB: Starting to apply log records to the database...\n"); /* Apply the hashed log records to the respective file pages */ Loading Loading @@ -2888,9 +2890,15 @@ recv_recovery_from_checkpoint_finish(void) /* Free the resources of the recovery system */ recv_recovery_on = FALSE; #ifndef UNIV_LOG_DEBUG recv_sys_free(); #endif if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { os_thread_create(trx_rollback_or_clean_all_without_sess, (void *)&i, &recovery_thread_id); } } /********************************************************** Loading Loading
innobase/include/trx0roll.h +5 −4 Original line number Diff line number Diff line Loading @@ -104,11 +104,12 @@ trx_rollback( /*********************************************************************** Rollback or clean up transactions which have no user session. If the transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. */ undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread */ void trx_rollback_or_clean_all_without_sess(void); /*========================================*/ void * trx_rollback_or_clean_all_without_sess(void *); /*============================================*/ /******************************************************************** Finishes a transaction rollback. */ Loading
innobase/include/trx0trx.h +39 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading Loading @@ -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 */ Loading @@ -353,6 +387,8 @@ struct trx_struct{ dulint table_id; /* table id if the preceding field is TRUE */ /*------------------------------*/ 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 Loading Loading @@ -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 */ Loading
innobase/include/trx0undo.h +46 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ Created 3/26/1996 Heikki Tuuri #include "mtr0mtr.h" #include "trx0sys.h" #include "page0types.h" #include "xa.h" /*************************************************************************** Builds a roll pointer dulint. */ Loading Loading @@ -239,6 +240,18 @@ trx_undo_set_state_at_finish( trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr); /* in: mtr */ /********************************************************************** Sets the state of the undo log segment at a transaction prepare. */ page_t* trx_undo_set_state_at_prepare( /*==========================*/ /* out: undo log segment header page, x-latched */ trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr); /* in: mtr */ /************************************************************************** Adds the update undo log header as the first in the history list, and frees the memory object, or puts it to the list of cached update undo log Loading Loading @@ -294,7 +307,23 @@ trx_undo_parse_discard_latest( byte* end_ptr,/* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr); /* in: mtr or NULL */ /************************************************************************ Write X/Open XA Transaction Identification (XID) to undo log header */ void trx_undo_write_xid( /*===============*/ trx_ulogf_t* log_hdr,/* in: undo log header */ XID* xid); /* in: X/Open XA Transaction Identification */ /************************************************************************ Read X/Open XA Transaction Identification (XID) from undo log header */ void trx_undo_read_xid( /*==============*/ trx_ulogf_t* log_hdr,/* in: undo log header */ XID* xid); /* out: X/Open XA Transaction Identification */ /* Types of an undo log segment */ #define TRX_UNDO_INSERT 1 /* contains undo entries for inserts */ Loading @@ -310,6 +339,8 @@ trx_undo_parse_discard_latest( #define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be reused: it can be freed in purge when all undo data in it is removed */ #define TRX_UNDO_PREPARED 5 /* contains an undo log of an prepared transaction */ /* Transaction undo log memory object; this is protected by the undo_mutex in the corresponding transaction object */ Loading @@ -332,6 +363,8 @@ struct trx_undo_struct{ field */ dulint trx_id; /* id of the trx assigned to the undo log */ XID xid; /* X/Open XA transaction identification */ ibool dict_operation; /* TRUE if a dict operation trx */ dulint table_id; /* if a dict operation, then the table id */ Loading Loading @@ -452,7 +485,18 @@ page of an update undo log segment. */ #define TRX_UNDO_HISTORY_NODE 34 /* If the log is put to the history list, the file list node is here */ /*-------------------------------------------------------------*/ #define TRX_UNDO_LOG_HDR_SIZE (34 + FLST_NODE_SIZE) /* X/Open XA Transaction Identification (XID) */ #define TRX_UNDO_XA_FORMAT (34 + FLST_NODE_SIZE) #define TRX_UNDO_XA_TRID_LEN (TRX_UNDO_XA_FORMAT + 4) #define TRX_UNDO_XA_BQUAL_LEN (TRX_UNDO_XA_TRID_LEN + 4) #define TRX_UNDO_XA_XID (TRX_UNDO_XA_BQUAL_LEN + 4) #define TRX_UNDO_XA_LEN (TRX_UNDO_XA_XID + XIDDATASIZE) #define TRX_UNDO_XA_EXISTS 256 /*-------------------------------------------------------------*/ #define TRX_UNDO_LOG_HDR_SIZE (TRX_UNDO_XA_LEN) /*-------------------------------------------------------------*/ #ifndef UNIV_NONINL #include "trx0undo.ic" Loading
innobase/include/xa.h 0 → 100644 +182 −0 Original line number Diff line number Diff line /*- * See the file LICENSE for redistribution information. * * Copyright (c) 1998-2002 * Sleepycat Software. All rights reserved. * * $Id: xa.h,v 11.5 2002/01/11 15:52:30 bostic Exp $ */ /* * Start of xa.h header * * Define a symbol to prevent multiple inclusions of this header file */ #ifndef XA_H #define XA_H /* * Transaction branch identification: XID and NULLXID: */ #ifndef XIDDATASIZE #define XIDDATASIZE 128 /* size in bytes */ #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ struct xid_t { long formatID; /* format identifier */ long gtrid_length; /* value from 1 through 64 */ long bqual_length; /* value from 1 through 64 */ char data[XIDDATASIZE]; }; typedef struct xid_t XID; #endif /* * A value of -1 in formatID means that the XID is null. */ /* * Declarations of routines by which RMs call TMs: */ extern int ax_reg __P((int, XID *, long)); extern int ax_unreg __P((int, long)); /* * XA Switch Data Structure */ #define RMNAMESZ 32 /* length of resource manager name, */ /* including the null terminator */ #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */ /* strings, including the null terminator */ struct xa_switch_t { char name[RMNAMESZ]; /* name of resource manager */ long flags; /* resource manager specific options */ long version; /* must be 0 */ int (*xa_open_entry) /* xa_open function pointer */ __P((char *, int, long)); int (*xa_close_entry) /* xa_close function pointer */ __P((char *, int, long)); int (*xa_start_entry) /* xa_start function pointer */ __P((XID *, int, long)); int (*xa_end_entry) /* xa_end function pointer */ __P((XID *, int, long)); int (*xa_rollback_entry) /* xa_rollback function pointer */ __P((XID *, int, long)); int (*xa_prepare_entry) /* xa_prepare function pointer */ __P((XID *, int, long)); int (*xa_commit_entry) /* xa_commit function pointer */ __P((XID *, int, long)); int (*xa_recover_entry) /* xa_recover function pointer */ __P((XID *, long, int, long)); int (*xa_forget_entry) /* xa_forget function pointer */ __P((XID *, int, long)); int (*xa_complete_entry) /* xa_complete function pointer */ __P((int *, int *, int, long)); }; /* * Flag definitions for the RM switch */ #define TMNOFLAGS 0x00000000L /* no resource manager features selected */ #define TMREGISTER 0x00000001L /* resource manager dynamically registers */ #define TMNOMIGRATE 0x00000002L /* resource manager does not support association migration */ #define TMUSEASYNC 0x00000004L /* resource manager supports asynchronous operations */ /* * Flag definitions for xa_ and ax_ routines */ /* use TMNOFLAGGS, defined above, when not specifying other flags */ #define TMASYNC 0x80000000L /* perform routine asynchronously */ #define TMONEPHASE 0x40000000L /* caller is using one-phase commit optimisation */ #define TMFAIL 0x20000000L /* dissociates caller and marks transaction branch rollback-only */ #define TMNOWAIT 0x10000000L /* return if blocking condition exists */ #define TMRESUME 0x08000000L /* caller is resuming association with suspended transaction branch */ #define TMSUCCESS 0x04000000L /* dissociate caller from transaction branch */ #define TMSUSPEND 0x02000000L /* caller is suspending, not ending, association */ #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ #define TMENDRSCAN 0x00800000L /* end a recovery scan */ #define TMMULTIPLE 0x00400000L /* wait for any asynchronous operation */ #define TMJOIN 0x00200000L /* caller is joining existing transaction branch */ #define TMMIGRATE 0x00100000L /* caller intends to perform migration */ /* * ax_() return codes (transaction manager reports to resource manager) */ #define TM_JOIN 2 /* caller is joining existing transaction branch */ #define TM_RESUME 1 /* caller is resuming association with suspended transaction branch */ #define TM_OK 0 /* normal execution */ #define TMER_TMERR -1 /* an error occurred in the transaction manager */ #define TMER_INVAL -2 /* invalid arguments were given */ #define TMER_PROTO -3 /* routine invoked in an improper context */ /* * xa_() return codes (resource manager reports to transaction manager) */ #define XA_RBBASE 100 /* The inclusive lower bound of the rollback codes */ #define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an unspecified reason */ #define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a communication failure */ #define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ #define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the integrity of the resources was detected */ #define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the transaction branch for a reason not on this list */ #define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the resource manager */ #define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */ #define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ #define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the rollback codes */ #define XA_NOMIGRATE 9 /* resumption must occur where suspension occurred */ #define XA_HEURHAZ 8 /* the transaction branch may have been heuristically completed */ #define XA_HEURCOM 7 /* the transaction branch has been heuristically committed */ #define XA_HEURRB 6 /* the transaction branch has been heuristically rolled back */ #define XA_HEURMIX 5 /* the transaction branch has been heuristically committed and rolled back */ #define XA_RETRY 4 /* routine returned with no effect and may be re-issued */ #define XA_RDONLY 3 /* the transaction branch was read-only and has been committed */ #define XA_OK 0 /* normal execution */ #define XAER_ASYNC -2 /* asynchronous operation already outstanding */ #define XAER_RMERR -3 /* a resource manager error occurred in the transaction branch */ #define XAER_NOTA -4 /* the XID is not valid */ #define XAER_INVAL -5 /* invalid arguments were given */ #define XAER_PROTO -6 /* routine invoked in an improper context */ #define XAER_RMFAIL -7 /* resource manager unavailable */ #define XAER_DUPID -8 /* the XID already exists */ #define XAER_OUTSIDE -9 /* resource manager doing work outside transaction */ #endif /* ifndef XA_H */ /* * End of xa.h header */
innobase/log/log0recv.c +11 −3 Original line number Diff line number Diff line Loading @@ -2851,11 +2851,13 @@ void recv_recovery_from_checkpoint_finish(void) /*======================================*/ { int i; os_thread_id_t recovery_thread_id; /* Rollback the uncommitted transactions which have no user session */ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { trx_rollback_or_clean_all_without_sess(); } fprintf(stderr, "InnoDB: Starting to apply log records to the database...\n"); /* Apply the hashed log records to the respective file pages */ Loading Loading @@ -2888,9 +2890,15 @@ recv_recovery_from_checkpoint_finish(void) /* Free the resources of the recovery system */ recv_recovery_on = FALSE; #ifndef UNIV_LOG_DEBUG recv_sys_free(); #endif if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { os_thread_create(trx_rollback_or_clean_all_without_sess, (void *)&i, &recovery_thread_id); } } /********************************************************** Loading