Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25616

Binlog event for XA COMMIT is generated without matching XA START, replication aborts

    XMLWordPrintable

Details

    Description

      --source include/master-slave.inc
       
      CREATE TABLE t1 (a INT PRIMARY KEY);
       
      XA BEGIN 'x';
      --error ER_DUP_ENTRY
      INSERT INTO t1 VALUES (1),(1);
      XA END 'x';
      XA PREPARE 'x';
      XA COMMIT 'x';
       
      --sync_slave_with_master
       
      # Cleanup
      --connection master
      DROP TABLE t1;
      --source include/rpl_end.inc
      

      Binlog contains this:

      10.5 d44a10f4

      master-bin.000001	285	Binlog_checkpoint	1	329	master-bin.000001
      master-bin.000001	329	Gtid	1	371	GTID 0-1-1
      master-bin.000001	371	Query	1	473	use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
      master-bin.000001	473	Gtid	1	515	BEGIN GTID 0-1-2
      master-bin.000001	515	Query	1	611	use `test`; INSERT INTO t1 VALUES (1),(1)
      master-bin.000001	611	Query	1	684	COMMIT
      master-bin.000001	684	Gtid	1	727	GTID 0-1-3
      master-bin.000001	727	Query	1	815	XA COMMIT X'78',X'',1
      

      So, slave SQL thread aborts with

      Last_SQL_Errno	1397
      Last_SQL_Error	Error 'XAER_NOTA: Unknown XID' on query. Default database: 'test'. Query: 'XA COMMIT X'78',X'',1'
      

      Reproducible on 10.5-10.6, with any binlog format and both transactional and non-transactional engines.
      Naturally, with row format the INSERT part is different, and with InnoDB it is not written at all, but the orphan XA COMMIT is still added to the binary log and causes the replication failure.
      Not reproducible on 10.4, no generated XA COMMIT there.

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.