Bug #12935 Local and XA transactions not mutually exclusive
Submitted: 1 Sep 2005 19:06 Modified: 5 Oct 2005 23:45
Reporter: Paul Dubois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.13 OS:
Assigned to: Sergei Golubchik CPU Architecture:Any

[1 Sep 2005 19:06] Paul Dubois
Description:
Local (non-XA) and XA transactions are supposed to be
mutually exclusive within a given client connection. But
this prohibition is not always enforced.

How to repeat:
MySQL does enforce "no XA transaction within a local
transaction":

mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)

mysql> xa start 'a';
ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction
mysql> rollback;
Query OK, 0 rows affected (0.02 sec)

But MySQL does not enforce "no local transaction within
an XA transaction":

mysql> xa start 'a';
Query OK, 0 rows affected (0.00 sec)

mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)

-- start transaction should be illegal here

mysql> xa end 'a';
Query OK, 0 rows affected (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

-- this commit does strange things to the XA transaction,
-- as follows:

mysql> xa prepare 'a';
ERROR 1397 (XAE04): XAER_NOTA: Unknown XID

-- the commit appears to have caused the XA XID to be
-- forgotten...

mysql> xa start 'a';
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed in the IDLE state

-- ... but apparently not completely forgotten!
[5 Oct 2005 18:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30725
[5 Oct 2005 18:12] Sergei Golubchik
fixed in 5.0.15
[5 Oct 2005 23:41] Paul Dubois
Noted in 5.0.15 changelog.