Bug #90659 implicit commit and unlocking with xa start
Submitted: 27 Apr 7:26
Reporter: Wei Zhao (OCA) Email Updates:
Status: Open 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 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>