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

LOAD INDEX may cause rollback of prepared XA transaction

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6
    • 10.5
    • XA

    Description

      A statement such as LOAD INDEX INTO may cause a prepared XA to rollback.
      For instance, consider the following case:

      CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=Innodb;
      SHOW CREATE TABLE t1;
      Table	Create Table
      t1	CREATE TABLE `t1` (
        `f1` int(11) NOT NULL,
        PRIMARY KEY (`f1`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      XA START 'a';
      INSERT INTO t1 VALUES (1);
      XA END 'a';
      XA PREPARE 'a';
      LOAD INDEX INTO cache t1 KEY(PRIMARY);
      Table	Op	Msg_type	Msg_text
      test.t1	preload_keys	Error	XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
      test.t1	preload_keys	error	Corrupt
      XA COMMIT 'a';
      SELECT COUNT(*) FROM t1;
      COUNT(*)
      0
      

      After XA PREPARE the user attempts to LOAD INDEX, internally, it causes a trans_rollback_implicit(), which will roll back the underlying XA transaction. After XA COMMIT the transaction left no side effects.
      I would expect LOAD INDEX to not rollback the underlying XA transaction, and fail immediately with "XAER_RMFAIL: The command cannot be executed when global transaction is in PREPARED state".

      Attachments

        Issue Links

          Activity

            No workflow transitions have been executed yet.

            People

              serg Sergei Golubchik
              sciascid Daniele Sciascia
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.