# We want a page split in this test case, to make it easy, we specify the # page size as 16K only. This deadlock issue is not related to page size. --source include/have_debug_sync.inc --source include/count_sessions.inc # This test case requires the table and the DDTableBuffer in the same # tablespace. However, it could become invalid after we move DDTableBuffer # to a separate tablespace. CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b varchar(500), c varchar(500), d varchar(500), e varchar(500)) ENGINE = InnoDB TABLESPACE = innodb_system; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB; # We need so many(7) and so long rows to fill up the page quickly, # so that the next insert would trigger a page split INSERT INTO t1(b, c, d, e) VALUES(repeat('0a', 250), repeat('1a', 250), repeat('2a', 250), repeat('3a', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0b', 250), repeat('1b', 250), repeat('2b', 250), repeat('3b', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0c', 250), repeat('1c', 250), repeat('2c', 250), repeat('3c', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0d', 250), repeat('1d', 250), repeat('2d', 250), repeat('3d', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0e', 250), repeat('1e', 250), repeat('2e', 250), repeat('3e', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0f', 250), repeat('1f', 250), repeat('2f', 250), repeat('3f', 250)); INSERT INTO t1(b, c, d, e) VALUES(repeat('0g', 250), repeat('1g', 250), repeat('2g', 250), repeat('3g', 250)); INSERT INTO t2 VALUES(0), (0), (0); --echo # Invoke checkpoint to persist metadata of t2 to DDTableBuffer SET @start_global_value = @@global.innodb_log_checkpoint_now; set global innodb_log_checkpoint_now=ON; SET @@global.innodb_log_checkpoint_now = @start_global_value; connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; SET DEBUG_SYNC='delete_metadata_before SIGNAL delete WAIT_FOR insert'; --send ALTER TABLE t2 ADD COLUMN b INT, ALGORITHM=INPLACE; connection default; SET DEBUG_SYNC='now WAIT_FOR delete'; --send INSERT INTO t1(b, c, d, e) VALUES(repeat('0a', 250), repeat('1a', 250), repeat('2a', 250), repeat('3a', 250)); connection con2; # It would be better to have 2 DEBUG_SYNC in the code and the test file to # reproduce the deadlock. However, once we fix the deadlock, it would never # get the the DEBUG_SYNC in INSERT path because the mutex is now acquired # before the DEBUG_SYNC. So we sleep here and this would make sure the test # can pass with the fix. sleep 2; SET DEBUG_SYNC='now SIGNAL insert'; disconnect con2; connection con1; reap; disconnect con1; connection default; reap; SET DEBUG_SYNC='RESET'; SELECT count(*) FROM t1; SELECT count(*) FROM t2; SHOW CREATE TABLE t2; DROP TABLE t1, t2; --source include/wait_until_count_sessions.inc