diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2011-02-14 14:16:31 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2011-02-14 14:16:31 +0100 |
commit | 3058b8e2a6fb49715e1116cedd0394c87fc2dfee (patch) | |
tree | de154e06b3505b44f65c9b69f7672fd06c1f83d3 /sql/transaction.cc | |
parent | b8d2f80870985abe35e59f2309b564a8637684fc (diff) | |
download | mariadb-git-3058b8e2a6fb49715e1116cedd0394c87fc2dfee.tar.gz |
Bug #11766788 (former bug 59986)
Assert in Diagnostics_area::set_ok_status() for XA COMMIT
This assert was triggered if XA COMMIT was issued when an XA transaction
already had encountered an error (e.g. a deadlock) which required
the XA transaction to be rolled back.
In general, the assert is triggered if a statement tries to send OK to
the client when an error has already been reported. It was triggered
in this case because the trans_xa_commit() function first reported an
error, then rolled back the transaction and finally returned FALSE,
indicating success. Since trans_xa_commit() reported success,
mysql_execute_command() tried to report OK, triggering the assert.
This patch fixes the problem by fixing trans_xa_commit() to return TRUE
if it encounters an error that requires rollback, even if the rollback
itself is successful.
Test case added to xa.test.
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index b331fea89fe..85686810893 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008 Sun/MySQL +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -635,8 +635,9 @@ bool trans_xa_commit(THD *thd) if (xa_trans_rolled_back(&thd->transaction.xid_state)) { - if ((res= test(ha_rollback_trans(thd, TRUE)))) + if (ha_rollback_trans(thd, TRUE)) my_error(ER_XAER_RMERR, MYF(0)); + res= thd->is_error(); } else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE) { |