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

Shutdown unexpectedly executes XA ROLLBACK

    XMLWordPrintable

Details

    Description

      When an user prepared XA does not update data it expectedly does not survive
      the server restart.
      However in case of crash it gets recovered. Here is a test:

      --source include/have_binlog_format_mixed.inc
      --source include/have_innodb.inc
       
      # MDEV-TODO unneccessary recover of read-only transaction
      CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1);
       
      call mtr.add_suppression("Found 1 prepared XA transactions");
       
      XA START '1';
        --error ER_DUP_ENTRY
        INSERT INTO t1 VALUES (2),(1);
        --echo Despite '1' has done no work ...
        SELECT * FROM t1 WHERE a = 2;
      XA END '1';
      XA PREPARE '1';
      XA RECOVER;
       
      --echo server crash
      --let $shutdown_timeout=0
      --source include/restart_mysqld.inc
       
      --connection default
      --enable_reconnect
      --echo ... it is recovered:
      XA RECOVER;
       
      # Cleanup
      XA ROLLBACK '1';
      DROP TABLE t1;
      

      The recoverable behavior is more than unnecessary as it's harmful for replication because of
      inconsistent prepared status. There are reasons to claim that the "read-only" prepared user XA should not be recovered.

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Elkin Andrei Elkin
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.