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

Got error 123 when using pseudo_slave_mode with XA

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      A regression in 12.1 for the error 123, however the pseudo_slave_mode/XA bug exists in all versions. We can split the bug if needed.

      SET pseudo_slave_mode=1;
      CREATE TABLE t (c1 INT,c2 INT AUTO_INCREMENT PRIMARY KEY,KEY(c1)) ENGINE=InnoDB;
      XA START 'a';
      INSERT INTO t VALUES (0,0);
      XA END 'a';
      XA PREPARE 'a';
      XA START 'b';
      SELECT * FROM t;
      INSERT INTO t SELECT * FROM t;
      

      Leads to:

      CS 12.1.0 4b79d7b8ee557d53a859aedec839b8673585b514 (Optimized) Build 06/06/2025, CLI

      12.1.0-opt>INSERT INTO t SELECT * FROM t;
      ERROR 1020 (HY000): Record has changed since last read in table 't'
      

      CS 12.1.0 4b79d7b8ee557d53a859aedec839b8673585b514 (Optimized) Build 06/06/2025, Error log

      2025-06-07 20:30:35 4 [ERROR] Got error 123 when reading table './test/t'
      

      In contrast with 12.1 (immediate error), in 10.6 we see the query remaining in Sending data state:

      CS 10.6.22 643319a7fb1e273797c2a1e46d76cfac0fa1da8f (Optimized) Build 06/06/2025

      10.6.22-opt>SHOW PROCESSLIST;
      +----+------+-----------+------+---------+------+--------------+-------------------------------+----------+
      | Id | User | Host      | db   | Command | Time | State        | Info                          | Progress |
      +----+------+-----------+------+---------+------+--------------+-------------------------------+----------+
      |  4 | root | localhost | test | Query   |   49 | Sending data | INSERT INTO t SELECT * FROM t |    0.000 |
      |  5 | root | localhost | test | Query   |    0 | starting     | SHOW PROCESSLIST              |    0.000 |
      +----+------+-----------+------+---------+------+--------------+-------------------------------+----------+
      2 rows in set (0.000 sec)
      

      Till we get a lock timeout:

      CS 10.6.22 643319a7fb1e273797c2a1e46d76cfac0fa1da8f (Optimized) Build 06/06/2025

      10.6.22-opt>INSERT INTO t SELECT * FROM t;
      ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
      

      There are many oddities besides. For example, XA START 'b'; should fail as a PREPARE is in progress. And this indeed is the case when we remove enabling pseudo slave mode (in all versions):

      CS 12.1.0 4b79d7b8ee557d53a859aedec839b8673585b514 (Optimized) Build 06/06/2025

      12.1.0-opt>XA START 'b';
      ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
      12.1.0-opt>SELECT * FROM t;
      ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
      12.1.0-opt>INSERT INTO t SELECT * FROM t;
      ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
      

      Another example is when we remove only AUTO_INCREMENT from the testcase, but leave the enabling of pseudo_slave_mode in place. In this case, all versions go into the 'Sending data' query state for the INSERT till a lock wait timeout is reached.

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              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.