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)