From 2b68b4bc1b7a450fcdd07412a3b05a91ecbfce8d Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Thu, 15 Mar 2012 15:10:57 +0600 Subject: This patch fixes the bug#13737343 (formerly known as 64374): XA TRANSACTIONS AND SAVEPOINT. The bug was introduced by the patch for bug#11766752. This patch sets too strong condition on XA state for SAVEPOINT statement that disallows its execution during XA transaction. But since the statement SAVEPOINT doesn't imply implicit commit we can allow its handling during XA transaction. The patch explicitly check for transaction state against states XA_NOTR and XA_ACTIVE for which the handling of statement SAVEPOINT for XA transaction is allowed. mysql-test/t/xa.test: Testcase was adjusted for bug#13737343. Now SAVEPOINT is allowed for XA transactions in ACTIVE state. --- mysql-test/r/xa.result | 1 - mysql-test/t/xa.test | 1 - sql/transaction.cc | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result index 6db257eafd5..e7a62dbd3bc 100644 --- a/mysql-test/r/xa.result +++ b/mysql-test/r/xa.result @@ -174,7 +174,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB; XA START 'a'; INSERT INTO t1 VALUES (1); SAVEPOINT savep; -ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state XA END 'a'; SELECT * FROM t1; ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index cb4345e9479..fe49d2d5e31 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -298,7 +298,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB; XA START 'a'; INSERT INTO t1 VALUES (1); ---error ER_XAER_RMFAIL SAVEPOINT savep; XA END 'a'; diff --git a/sql/transaction.cc b/sql/transaction.cc index 94a32200274..3359decbcd5 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -390,7 +390,7 @@ bool trans_savepoint(THD *thd, LEX_STRING name) DBUG_RETURN(FALSE); enum xa_states xa_state= thd->transaction.xid_state.xa_state; - if (xa_state != XA_NOTR) + if (xa_state != XA_NOTR && xa_state != XA_ACTIVE) { my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); DBUG_RETURN(TRUE); -- cgit v1.2.1