summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-10-28 19:39:08 +0400
committerSergey Vojtovich <svoj@sun.com>2009-10-28 19:39:08 +0400
commitd6f27e58b7a0e768082f41646e75f86cbd408e0d (patch)
treee463afef840ef0b005614eae4b2fd868d2e051ff /sql/sql_parse.cc
parent9db41de0428c529582b281c75415b6f0feb8d8a4 (diff)
downloadmariadb-git-d6f27e58b7a0e768082f41646e75f86cbd408e0d.tar.gz
BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
XA START may cause assertion failure/server crash when it is called after unilateral roll back issued by the Resource Manager (both in regular transaction and after XA transaction). The problem was that rm_error variable wasn't set/reset properly.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2e150ca1542..7f19421beaf 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -122,6 +122,14 @@ static bool xa_trans_rolled_back(XID_STATE *xid_state)
*/
static bool xa_trans_rollback(THD *thd)
{
+ /*
+ Resource Manager error is meaningless at this point, as we perform
+ explicit rollback request by user. We must reset rm_error before
+ calling ha_rollback(), so thd->transaction.xid structure gets reset
+ by ha_rollback()/THD::transaction::cleanup().
+ */
+ thd->transaction.xid_state.rm_error= 0;
+
bool status= test(ha_rollback(thd));
thd->options&= ~(ulong) OPTION_BEGIN;
@@ -129,7 +137,6 @@ static bool xa_trans_rollback(THD *thd)
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state= XA_NOTR;
- thd->transaction.xid_state.rm_error= 0;
return status;
}