Bug #90659 implicit commit and unlocking with xa start
Submitted: 27 Apr 2018 7:26 Modified: 5 Oct 2020 12:43
Reporter: Wei Zhao (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S4 (Feature request)
Version:5.7.17 OS:Any
Assigned to: CPU Architecture:Any

[27 Apr 2018 7:26] Wei Zhao
Description:
The 'start transaction' statement can implicitly commit previous non-XA active transaction, and unlock tables, but 'xa start' doesn't do so ,rather it reports an error when executed in an active transaction or after a 'lock tables' stmt: 

ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction

This causes some issues in our use case, so could you do the same for XA START please? That is, if 'XA START' is executed and there is an active non-XA transaction in the same session, implicitly commit it first, if some tables are locked by 'lock tables', implicitly do 'unlock tables' first. 

AFAIK, there is no issue that can be caused by doing so. If otherwise, could you point out please?

How to repeat:
daviezhao(赵伟) 4-27 15:25
mysql> lock tables t1 read;
Query OK, 0 rows affected (0.00 sec)

mysql> xa start 'xyz';
ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction

daviezhao(赵伟) 4-27 15:25
mysql> begin;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values(1,2,3);
Query OK, 1 row affected (0.00 sec)

mysql> xa start 'xyz';
ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction
mysql>
[2 Oct 2020 15:25] Mark Matthews
This behavior would be non-compliant with the XA specification. Notice that other resources have the exact same behavior:

https://www.ibm.com/support/pages/addressing-jdbc-reason-code-xaeroutside-dsra0320e-and-j2...
[5 Oct 2020 12:43] MySQL Verification Team
Hi Mr. Zhao,

We have checked thoroughly XA standard and your request is not compliant.

Not a bug !!!!!!