diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-06-05 19:16:54 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-06-05 19:16:54 -0300 |
commit | 12f91b1d8c45bb84ee5bc7ee4b0b455fbb0e2a90 (patch) | |
tree | a296754126b086c60a003f8b88c4800d1e9fcf07 /mysql-test/t/xa.test | |
parent | 46a4685cdb29ea885ddbec6d500b6c64180706e9 (diff) | |
download | mariadb-git-12f91b1d8c45bb84ee5bc7ee4b0b455fbb0e2a90.tar.gz |
Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null()
The problem is that when a optimization of read-only transactions
(bypass 2-phase commit) was implemented, it removed the code that
reseted the XID once a transaction wasn't active anymore:
sql/sql_parse.cc:
- bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
- if (!thd->active_transaction())
- thd->transaction.xid_state.xid.null();
+ thd->transaction.stmt.reset();
This mostly worked fine as the transaction commit and rollback
functions (in handler.cc) reset the XID once the transaction is
ended. But those functions wouldn't reset the XID in case of
a empty transaction, leading to a assertion when a new starting
a new XA transaction.
The solution is to ensure that the XID state is reset when empty
transactions are ended (by either commit or rollback). This is
achieved by reorganizing the code so that the transaction cleanup
routine is invoked whenever a transaction is ended.
mysql-test/r/xa.result:
Add test case result for Bug#44672
mysql-test/t/xa.test:
Add test case for Bug#44672
sql/handler.cc:
Invoke transaction cleanup function whenever a transaction is
ended. Move XID state reset logic to the transaction cleanup
function.
sql/sql_class.h:
Add XID state reset logic.
Diffstat (limited to 'mysql-test/t/xa.test')
-rw-r--r-- | mysql-test/t/xa.test | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 04ecf518577..a0d5aa60641 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -124,6 +124,17 @@ drop table t1; --echo End of 5.0 tests +# +# Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null() +# + +xa start 'a'; +xa end 'a'; +xa rollback 'a'; +xa start 'a'; +xa end 'a'; +xa rollback 'a'; + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc |