3136 Jon Olav Hauglid 2010-09-13
Bug #56448 Assertion failed: ! is_set() with second xa end
The problem was that issuing XA END when the XA transaction was
already ended, caused an assertion. This assertion tests that
the server does not try to send OK to the client if there has
already been an error reported. The bug was only noticeable on
debug versions of the server.
The reason for the problem was that the trans_xa_end() function
reported success if the transaction was at XA_IDLE state at the
end regardless of any errors occured during processing of
trans_xa_end(). So if the transaction state was XA_IDLE already,
reported errors would be ignored.
This patch fixes the problem by having trans_xa_end() take into
consideration any reported errors. The patch also fixes a similar
bug with XA PREPARE.
Test case added to xa.test.
modified:
mysql-test/r/xa.result
mysql-test/t/xa.test
sql/transaction.cc
3135 Jon Olav Hauglid 2010-09-10 [merge]
Merge from mysql-5.5-bugfixing to mysql-5.5-runtime.
modified:
client/mysqltest.cc
cmake/dtrace.cmake
libmysqld/lib_sql.cc
mysql-test/include/default_mysqld.cnf
mysql-test/r/func_time.result
mysql-test/r/parser.result
mysql-test/r/select.result
mysql-test/r/strict.result
mysql-test/r/type_datetime.result
mysql-test/suite/perfschema/r/start_server_no_cond_class.result
mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
mysql-test/suite/perfschema/r/start_server_no_file_class.result
mysql-test/suite/perfschema/r/start_server_no_file_inst.result
mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
mysql-test/suite/perfschema/r/start_server_no_thread_class.result
mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
mysql-test/suite/perfschema/r/start_server_off.result
mysql-test/suite/perfschema/r/start_server_on.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/t/disabled.def
mysql-test/t/strict.test
mysql-test/t/type_datetime.test
mysys/my_gethwaddr.c
mysys/my_sync.c
sql/derror.cc
sql/item_timefunc.cc
sql/item_timefunc.h
sql/mysqld.cc
sql/set_var.cc
sql/set_var.h
sql/sys_vars.h
=== modified file 'mysql-test/r/xa.result'
--- a/mysql-test/r/xa.result 2010-03-10 15:31:22 +0000
+++ b/mysql-test/r/xa.result 2010-09-13 11:31:22 +0000
@@ -131,3 +131,14 @@ XA START 'xid1';
XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1;
+#
+# Bug#56448 Assertion failed: ! is_set() with second xa end
+#
+XA START 'x';
+XA END 'x';
+XA END 'x';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+XA PREPARE 'x';
+XA PREPARE 'x';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+XA ROLLBACK 'x';
=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test 2010-03-24 15:03:44 +0000
+++ b/mysql-test/t/xa.test 2010-09-13 11:31:22 +0000
@@ -228,6 +228,23 @@ XA ROLLBACK 'xid1';
disconnect con1;
DROP TABLE t1;
+
+--echo #
+--echo # Bug#56448 Assertion failed: ! is_set() with second xa end
+--echo #
+
+XA START 'x';
+XA END 'x';
+# Second XA END caused an assertion.
+--error ER_XAER_RMFAIL
+XA END 'x';
+XA PREPARE 'x';
+# Second XA PREPARE also caused an assertion.
+--error ER_XAER_RMFAIL
+XA PREPARE 'x';
+XA ROLLBACK 'x';
+
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2010-07-27 10:25:53 +0000
+++ b/sql/transaction.cc 2010-09-13 11:31:22 +0000
@@ -565,7 +565,8 @@ bool trans_xa_end(THD *thd)
else if (!xa_trans_rolled_back(&thd->transaction.xid_state))
thd->transaction.xid_state.xa_state= XA_IDLE;
- DBUG_RETURN(thd->transaction.xid_state.xa_state != XA_IDLE);
+ DBUG_RETURN(thd->is_error() ||
+ thd->transaction.xid_state.xa_state != XA_IDLE);
}
@@ -596,7 +597,8 @@ bool trans_xa_prepare(THD *thd)
else
thd->transaction.xid_state.xa_state= XA_PREPARED;
- DBUG_RETURN(thd->transaction.xid_state.xa_state != XA_PREPARED);
+ DBUG_RETURN(thd->is_error() ||
+ thd->transaction.xid_state.xa_state != XA_PREPARED);
}
Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20100913113122-tqzk3rf4bys0f6s8.bundle
| Thread |
|---|
| • bzr push into mysql-5.5-runtime branch (jon.hauglid:3135 to 3136) Bug#56448 | Jon Olav Hauglid | 15 Sep |