Commit 1a7e7a0f authored by Dmitry Shulga's avatar Dmitry Shulga

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.
parent b373f405
...@@ -174,7 +174,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB; ...@@ -174,7 +174,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB;
XA START 'a'; XA START 'a';
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SAVEPOINT savep; SAVEPOINT savep;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
XA END 'a'; XA END 'a';
SELECT * FROM t1; SELECT * FROM t1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
......
...@@ -298,7 +298,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB; ...@@ -298,7 +298,6 @@ CREATE TABLE t1 (a INT) engine=InnoDB;
XA START 'a'; XA START 'a';
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--error ER_XAER_RMFAIL
SAVEPOINT savep; SAVEPOINT savep;
XA END 'a'; XA END 'a';
......
...@@ -390,7 +390,7 @@ bool trans_savepoint(THD *thd, LEX_STRING name) ...@@ -390,7 +390,7 @@ bool trans_savepoint(THD *thd, LEX_STRING name)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
enum xa_states xa_state= thd->transaction.xid_state.xa_state; 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]); my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment