5.7 mtr failed with wrong errno 1399: 'XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state', instead of 1397...

Description

Happens in tests:
tokudb.bugs.xa : At line 72: query 'xa commit 'testb',0x2030405060,11'
tokudb.tokudb_support_xa : At line 116: query 'xa commit 'testb',0x2030405060,11'

Environment

None

Activity

Show:
Laurynas Biveinis
January 12, 2016, 8:38 AM

George, your findings look correct. The 5.7 TokuDB behavior seems to be inline with 5.7.7+ server changes. But please consider reporting the InnoDB scenario on bugs.mysql.com. It looks like a data loss bug to me, and quite serious one for a XA user.

George Lorch
January 12, 2016, 9:46 PM

Deeper testing on 5.6:
If we attempt the drop t1 at any point where there is an active XA transaction with a lock on t1, the drop table waits for the transaction to either commit or rollback, correct behavior IMHO. If the session that initially created and prepared the XA transaction terminates before commit/rollback, the entire transaction and all locks are discarded, thus allowing the table to be safely dropped in another session once the locks are relinquished.

Deeper testing on 5.7:
Badly broken exactly as described above with InnoDB. When the session that created and prepared the XA transaction terminates, it leaves the XA transaction behind, but releases the locks, allowing another session to drop t1 and then commit the XA transaction with no errors or warnings.

Registered PS bug https://bugs.launchpad.net/percona-server/+bug/1533364

Registered upstream https://bugs.mysql.com/bug.php?id=79940

George Lorch
January 12, 2016, 10:36 PM

For now, fixing the expected errors and adjusting the test case to expect the current behavior while awaiting an upstream fix, then will revisit the test.

George Lorch
January 14, 2016, 5:33 PM

For both 5.6 and 5.7:
Added new TOKUDB_DEBUG_XA (1<<15) debug flag for system variable tokudb_debug to debug log XA function calls only
Instrumented xa specific handlerton functions with enter/exit logging.
Converted existing TOKUDB_DEBUG_TXN logging within the XA functions to TOKUDB_DEBUG_XA.

Additionally for 5.7:

George Lorch
January 14, 2016, 5:34 PM

Assignee

George Lorch

Reporter

George Lorch

Labels

External issue ID

None

Freshdesk Tickets

None

Affects versions

Priority

Major
Configure