summaryrefslogtreecommitdiff
path: root/sql/handler.cc
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/handler.cc
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/handler.cc')
-rw-r--r--sql/handler.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 0de772e366b..67ec5f3e759 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -817,7 +817,12 @@ int ha_rollback_trans(THD *thd, bool all)
trans->nht=0;
trans->no_2pc=0;
if (is_real_trans)
- thd->transaction.xid_state.xid.null();
+ {
+ if (thd->transaction_rollback_request)
+ thd->transaction.xid_state.rm_error= thd->net.last_errno;
+ else
+ thd->transaction.xid_state.xid.null();
+ }
if (all)
{
thd->variables.tx_isolation=thd->session_tx_isolation;