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

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

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

            denis.protivensky Denis Protivensky created issue -
            denis.protivensky Denis Protivensky made changes -
            Field Original Value New Value
            denis.protivensky Denis Protivensky made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            sysprg Julius Goryavsky made changes -
            denis.protivensky Denis Protivensky made changes -
            Assignee Denis Protivensky [ JIRAUSER52676 ] Julius Goryavsky [ sysprg ]
            denis.protivensky Denis Protivensky made changes -
            Status In Progress [ 3 ] In Testing [ 10301 ]
            denis.protivensky Denis Protivensky made changes -
            Assignee Julius Goryavsky [ sysprg ] Denis Protivensky [ JIRAUSER52676 ]
            denis.protivensky Denis Protivensky made changes -
            Assignee Denis Protivensky [ JIRAUSER52676 ] Julius Goryavsky [ sysprg ]
            sysprg Julius Goryavsky made changes -
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            sysprg Julius Goryavsky made changes -
            Fix Version/s 10.6.19 [ 29833 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.11.9 [ 29834 ]
            Fix Version/s 11.1.6 [ 29835 ]
            Fix Version/s 11.2.5 [ 29836 ]
            Fix Version/s 11.4.3 [ 29837 ]
            sysprg Julius Goryavsky made changes -
            Fix Version/s 10.5.28 [ 29952 ]

            People

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