summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2008-10-21 15:45:43 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2008-10-21 15:45:43 -0200
commit9ad8d644392bc9ca23e0212e18c704f7a6520837 (patch)
tree2488934f42a24c9f4972c3400f5698b508da07be /sql/sql_class.h
parentd501f48757f891873bccedb7914d1348a981e0f6 (diff)
downloadmariadb-git-9ad8d644392bc9ca23e0212e18c704f7a6520837.tar.gz
Bug#28323: Server crashed in xid cache operations
The problem was that the server did not robustly handle a unilateral roll back issued by the Resource Manager (RM) due to a resource deadlock within the transaction branch. By not acknowledging the roll back, the server (TM) would eventually corrupt the XA transaction state and crash. The solution is to mark the transaction as rollback-only if the RM indicates that it rolled back its branch of the transaction. mysql-test/r/xa.result: Add test case result for Bug#28323 mysql-test/t/xa.test: Add test case for Bug#28323 sql/handler.cc: Reset XID only at the end of the global transaction. sql/share/errmsg.txt: Add new error codes. sql/sql_class.h: Remember the error reported by the Resource Manager. sql/sql_parse.cc: Rollback the transaction if the Resource Manager reported a error and rolled back its branch of the transaction.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9fe0a7423de..c8d42d44df7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -927,7 +927,7 @@ struct st_savepoint {
uint length, nht;
};
-enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
+enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY};
extern const char *xa_state_names[];
typedef struct st_xid_state {
@@ -935,6 +935,8 @@ typedef struct st_xid_state {
XID xid; // transaction identifier
enum xa_states xa_state; // used by external XA only
bool in_thd;
+ /* Error reported by the Resource Manager (RM) to the Transaction Manager. */
+ uint rm_error;
} XID_STATE;
extern pthread_mutex_t LOCK_xid_cache;