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

Error 1399 or Error 0 on replica upon XA PREPARE

    XMLWordPrintable

Details

    • Q3/2025 Server Development

    Description

      XA START 'a';
      CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
      SET pseudo_thread_id=5;
      CREATE TEMPORARY TABLE t (c INT) ENGINE=Aria;
      INSERT INTO t VALUES (1);
      XA END 'a';
      SET pseudo_slave_mode=1;
      XA PREPARE 'a';
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      XA START 'a';
      INSERT INTO t VALUES (1);
      XA END 'a';
      XA PREPARE 'a';
      

      Leads to this difference in execution on the master (feature vs base):

      MDEV-32830-3 CS 12.0.1 14c105a8bd6be7463cf30a2af0122fc086c72dda (Optimized) Build 17/05/2025, Master

      ...
      12.0.1-opt>XA PREPARE 'a';
      Query OK, 0 rows affected, 2 warnings (0.000 sec)
       
      12.0.1-opt>CREATE TABLE t (c INT) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.013 sec)
       
      12.0.1-opt>XA START 'a';
      Query OK, 0 rows affected (0.000 sec)
       
      12.0.1-opt>INSERT INTO t VALUES (1);
      Query OK, 1 row affected (0.000 sec)
       
      12.0.1-opt>XA END 'a';
      Query OK, 0 rows affected (0.000 sec)
       
      12.0.1-opt>XA PREPARE 'a';
      Query OK, 0 rows affected, 1 warning (0.001 sec)
      

      And on base we see instead:

      CS 12.0.1 51c0afcd248ad57095fdcf56efec2865ea49bd83 (Optimized) Build 06/05/2025, Master

      ...
      12.0.1-opt>XA PREPARE 'a';
      Query OK, 0 rows affected (0.000 sec)
       
      12.0.1-opt>CREATE TABLE t (c INT) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.007 sec)
       
      12.0.1-opt>XA START 'a';
      ERROR 1440 (XAE08): XAER_DUPID: The XID already exists
      12.0.1-opt>INSERT INTO t VALUES (1);
      Query OK, 1 row affected (0.001 sec)
       
      12.0.1-opt>XA END 'a';
      ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  NON-EXISTING state
      12.0.1-opt>XA PREPARE 'a';
      ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  NON-EXISTING state
      

      Additionally, on the feature tree we see in the replica error log:

      MDEV-32830-3 CS 12.0.1 14c105a8bd6be7463cf30a2af0122fc086c72dda (Optimized) Build 17/05/2025, replica log

      2025-05-23  0:08:10 6 [ERROR] Slave SQL: Error 'XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state' on query. Default database: 'test'. Query: 'ROLLBACK', Gtid 0-1-4, Internal MariaDB error code: 1399
      2025-05-23  0:08:10 6 [Warning] Slave: XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state Error_code: 1399
      2025-05-23  0:08:10 6 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000001' position 868; GTID position '0-1-3'
      

      No such error are present in base. Options in use:

      Master: --no-defaults --log_bin=binlog --binlog_format=STATEMENT --server_id=1
      Replica: --no-defaults --server_id=2
      

      Additionally, we can change the error to be "0" when using the same testcase with --slave_skip_errors=ALL set for the replica:

      MDEV-32830-3 CS 12.0.1 14c105a8bd6be7463cf30a2af0122fc086c72dda (Optimized) Build 17/05/2025, replica log

      2025-05-23  0:13:44 6 [Warning] Slave SQL: Rolling back unfinished transaction (no COMMIT or ROLLBACK in relay log). This indicates a corrupt binlog on the master, possibly caused by disk full or other write error. Internal MariaDB error code: 0
      

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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