Bug #89783 binlog.binlog_xa_commit_failure:query 'XA COMMIT 'xid1'' failed with wrong errno
Submitted: 23 Feb 2018 6:55 Modified: 5 Oct 2018 12:31
Reporter: Erlend Dahl Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S3 (Non-critical)
Version:8.0.4 OS:Any
Assigned to: CPU Architecture:Any

[23 Feb 2018 6:55] Erlend Dahl
Description:
binlog.binlog_xa_commit_failure          w5 [ fail ]
        Test ended at 2018-02-23 03:56:17

CURRENT_TEST: binlog.binlog_xa_commit_failure
mysqltest: At line 42: query 'XA COMMIT 'xid1'' failed with wrong errno 1397: 'XAER_NOTA: Unknown XID', instead of 3100...

The result from queries just before the failure was:
< snip >

############################################################
# 2. Execute a XA PREPARE with id '1'.
XA START 'xid1';
INSERT INTO t1 VALUES (1);
XA END 'xid1';
XA PREPARE 'xid1';

############################################################
# 3. Force a local failure in before_commit listener on the
#    XA COMMIT.
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,simulate_failure_in_before_commit_hook';
safe_process[9470]: Child process: 9477, exit: 1

How to repeat:
Find a multi-core beast and run:

./mtr --mem --parallel=40 --repeat=20 binlog.binlog_xa_commit_failure{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,} --mysqld=--binlog-format=row --no-check-testcase

It will fail after a while.
[23 Feb 2018 9:35] Sven Sandberg
Posted by developer:
 
Maybe a race in the test. The disconnect is asynchronous. So at the time the test issues XA COMMIT, maybe the server did not make the transaction ready for other transactions to commit? Maybe we can just add a source include/wait_condition.inc before XA COMMIT, perhaps waiting for XA RECOVER to return at least one row, or check the transaction status in p_s.events_transactions_current or something.
[23 Feb 2018 9:47] Ståle Deraas
Posted by developer:
 
Dmitry, seems you introduced this test. So please make it work or remove the test.
[5 Oct 2018 12:31] Margaret Fisher
Posted by developer:
 
Test case, closed with no changelog entry.