Bug #64374 XA transactions and SAVEPOINT
Submitted: 18 Feb 2012 21:52 Modified: 3 Apr 2012 17:49
Reporter: Mina R Waheeb Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S1 (Critical)
Version:5.5.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression, XA Savepoint
Triage: Needs Triage: D1 (Critical)

[18 Feb 2012 21:52] Mina R Waheeb
Description:
MySQL > 5.5.15 treats SAVEPOINT as statement that cause an implicit commit and gives error "ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state" 

the docs says "Note that if an XA transaction is in the ACTIVE state, you cannot issue any statements that cause an implicit commit. That would violate the XA contract because you could not roll back the XA transaction."

The SAVEPOINT statement doesn't cause implicit commit. We implement nested transactions using SAVEPOINT statements and there is a lot of nested transaction implementation using the same API.

If this is the expected behavior from now and on so it should be highlighted in the changelog and the documentation.

How to repeat:
mysql> XA START 'xatest';
Query OK, 0 rows affected (0.03 sec)

mysql> SAVEPOINT `p111`;
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.20    |
+-----------+
1 row in set (0.00 sec)

---------------------------------

While in MySQL version 5.5.12

mysql> XA START 'xatest';
Query OK, 0 rows affected (0.00 sec)

mysql> SAVEPOINT `p111`;
Query OK, 0 rows affected (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.12    |
+-----------+
1 row in set (0.00 sec)
[19 Feb 2012 9:13] Valeriy Kravchuk
Thank you for the problem report.
[3 Apr 2012 17:49] Paul Dubois
Noted in 5.5.23, 5.6.6 changelog.

SAVEPOINT statements were incorrectly disallowed within XA
transactions.