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

ALTER INPLACE running TOI doesn't abort a DML operation in InnoDB

    XMLWordPrintable

Details

    Description

      The test ported from MDEV-32738 hangs as ALTER INPLACE is unable to abort a DML INSERT operation:

      --connect con1_1,127.0.0.1,root,,test,$NODE_MYPORT_1
      --connect con1_2,127.0.0.1,root,,test,$NODE_MYPORT_1
       
      CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB;
      CREATE TABLE t1_fk(c1 INT PRIMARY KEY, c2 INT, INDEX (c2), FOREIGN KEY (c2) REFERENCES t1(c1)) ENGINE=InnoDB;
       
      INSERT INTO t1 VALUES (1);
       
      --connection con1_1
      SET DEBUG_SYNC = 'ib_after_row_insert WAIT_FOR bf_abort';
      # INSERT also grabs FK-referenced table lock.
      --send
        INSERT INTO t1_fk VALUES (1, 1);
       
      --connection con1_2
      SET DEBUG_SYNC = 'ha_write_row_start SIGNAL may_alter WAIT_FOR may_insert';
      # Stop before doing anything, but pass wsrep_sync_wait().
      # This should be done before ALTER enters TOI.
      --send
        INSERT INTO t1_fk VALUES (2, 2);
       
      --connection node_1
      SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
      SET DEBUG_SYNC = 'lock_wait_before_suspend SIGNAL may_insert WAIT_FOR alter_continue';
      # ALTER BF-aborts the first INSERT and lets the second INSERT continue.
      --send
        ALTER TABLE t1 ADD COLUMN c2 INT;
       
      --connection con1_1
      # First INSERT gets BF-aborted.
      --error ER_LOCK_DEADLOCK
      --reap
       
      --connection con1_2
      # Second INSERT rolls back as ALTER is waiting on the lock.
      --error ER_LOCK_DEADLOCK
      --reap
      SET DEBUG_SYNC = 'now SIGNAL alter_continue';
       
      --connection node_1
      # ALTER succeeds.
      --reap
      

      The reason is that ALTER's InnoDB trx has is_wsrep() == false. That might be because trx initialization has been moved to the ctor of ha_innobase_inplace_ctx() which is now done earlier in prepare_inplace_alter_table().

      Attachments

        Issue Links

          Activity

            People

              sysprg Julius Goryavsky
              denis.protivensky Denis Protivensky
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.