[MDEV-33064] ALTER INPLACE running TOI doesn't abort a DML operation in InnoDB Created: 2023-12-19  Updated: 2023-12-27

Status: In Testing
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.6.16
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Denis Protivensky Assignee: Julius Goryavsky
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-32738 Inconsistency in Galera cluster while... In Testing
Relates
relates to MDEV-32738 Inconsistency in Galera cluster while... In Testing

 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().


Generated at Thu Feb 08 10:36:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.