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

Cluster is inconsistent after SAVEPOINT statement is rolled back

Details

    Description

      The following test show how to make a cluster inconsistent with a transaction that uses a savepoint with both innodb and aria storage engines involved:

      connection node_1;
      CREATE TABLE t1 (a INTEGER PRIMARY KEY) engine=innodb;
      START TRANSACTION;
      INSERT INTO t1 VALUES (1);
      SELECT count(*) a from mysql.db;
      a
      2
      SAVEPOINT s1;
      ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
      INSERT INTO t1 VALUES (2);
      COMMIT;
      connection node_1;
      SELECT * FROM t1;
      a
      1
      2
      connection node_2;
      SELECT * FROM t1;
      a
      2
      

      Aria does not support SAVEPOINT, so an error is returned and the statement is rolled back.
      This statement rollback is incorrectly causes the trx cache to be truncated back to the beginning of the transaction. Ultimately causing an inconsistency, as only the second half of the transaction is replicated to the rest of the cluster.

      Attachments

        Activity

          sciascid Daniele Sciascia created issue -
          sciascid Daniele Sciascia made changes -
          Field Original Value New Value
          sciascid Daniele Sciascia made changes -
          Summary Cluster is inconsistent if savepoint statement is rolled back Cluster is inconsistent after SAVEPOINT statement is rolled back
          sciascid Daniele Sciascia made changes -
          Description The following test show how to make a cluster inconsistent with a transaction that uses a savepoint with both innodb and aria storage engines involved:

          {code}
          --connection node_1
          CREATE TABLE t1 (a INTEGER PRIMARY KEY) engine=innodb;
          START TRANSACTION;
          INSERT INTO t1 VALUES (1);
          SELECT count(*) a from mysql.db;
          a
          2
          SAVEPOINT s1;
          ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
          INSERT INTO t1 VALUES (2);
          COMMIT;
          connection node_1;
          SELECT * FROM t1;
          a
          1
          2
          connection node_2;
          SELECT * FROM t1;
          a
          2
          {code}

          Aria does not support SAVEPOINT, so an error is returned and the statement is rolled back.
          This statement rollback is incorrectly causes the trx cache to be truncated back to the beginning of the transaction. Ultimately causing an inconsistency, as only the second half of the transaction is replicated to the rest of the cluster.
          The following test show how to make a cluster inconsistent with a transaction that uses a savepoint with both innodb and aria storage engines involved:

          {code}
          connection node_1;
          CREATE TABLE t1 (a INTEGER PRIMARY KEY) engine=innodb;
          START TRANSACTION;
          INSERT INTO t1 VALUES (1);
          SELECT count(*) a from mysql.db;
          a
          2
          SAVEPOINT s1;
          ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
          INSERT INTO t1 VALUES (2);
          COMMIT;
          connection node_1;
          SELECT * FROM t1;
          a
          1
          2
          connection node_2;
          SELECT * FROM t1;
          a
          2
          {code}

          Aria does not support SAVEPOINT, so an error is returned and the statement is rolled back.
          This statement rollback is incorrectly causes the trx cache to be truncated back to the beginning of the transaction. Ultimately causing an inconsistency, as only the second half of the transaction is replicated to the rest of the cluster.
          sciascid Daniele Sciascia made changes -
          Status Open [ 1 ] In Progress [ 3 ]

          A pull request has been submitted, and is ready for review.

          sciascid Daniele Sciascia added a comment - A pull request has been submitted, and is ready for review.
          sciascid Daniele Sciascia made changes -
          Assignee Daniele Sciascia [ sciascid ] Julius Goryavsky [ sysprg ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          sysprg Julius Goryavsky added a comment - Thanks, fix merged with head revision: https://github.com/MariaDB/server/commit/362c0950e8999a88f5866fc7361e10615364e4a3
          sysprg Julius Goryavsky made changes -
          Status In Review [ 10002 ] Stalled [ 10000 ]
          sysprg Julius Goryavsky made changes -
          Status Stalled [ 10000 ] In Progress [ 3 ]
          sysprg Julius Goryavsky added a comment - Fix merged with head revision: https://github.com/MariaDB/server/commit/362c0950e8999a88f5866fc7361e10615364e4a3
          sysprg Julius Goryavsky made changes -
          Fix Version/s 10.5.24 [ 29517 ]
          Fix Version/s 10.5 [ 23123 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          JIraAutomate JiraAutomate made changes -
          Fix Version/s 10.6.17 [ 29518 ]
          Fix Version/s 10.11.7 [ 29519 ]
          Fix Version/s 11.0.5 [ 29520 ]
          Fix Version/s 11.1.4 [ 29024 ]
          Fix Version/s 11.2.3 [ 29521 ]

          People

            sysprg Julius Goryavsky
            sciascid Daniele Sciascia
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.