# Check if a DDL operation can be interrupted. CREATE PROCEDURE insert_rows(IN BASE INT, IN SIZE INT) BEGIN DECLARE i INT DEFAULT BASE; WHILE (i <= SIZE) DO INSERT INTO t values (i); SET i = i + 1; END WHILE; END| CREATE TABLE t(c int) ENGINE=INNODB; # Insert rows CALL insert_rows(1, 1000); # con1: Start the DDL SET SESSION DEBUG='+d,ddl_merge_sort_interrupt'; SET DEBUG_SYNC='ddl_merge_sort_interrupt SIGNAL ready WAIT_FOR interrupt'; ALTER TABLE t ADD PRIMARY KEY(c);; # default: Kill the DDL SET DEBUG_SYNC='now WAIT_FOR ready'; KILL QUERY @id; SET DEBUG_SYNC='now SIGNAL interrupt'; # con1: reap ERROR 70100: Query execution was interrupted # Cleanup. Since ALTER TABLE was killed while waiting on sync point # 'interrupt' signal might have been not received and properly cleared. SET DEBUG_SYNC='RESET'; # con2: Start the DDL SET SESSION DEBUG='+d,ddl_btree_build_interrupt'; SET DEBUG_SYNC='ddl_btree_build_interrupt SIGNAL ready WAIT_FOR interrupt'; ALTER TABLE t ADD index i(c);; # default: Kill the DDL SET DEBUG_SYNC='now WAIT_FOR ready'; KILL QUERY @id; SET DEBUG_SYNC='now SIGNAL interrupt'; # con2: reap ERROR 70100: Query execution was interrupted # Cleanup SET DEBUG_SYNC="RESET"; DROP PROCEDURE insert_rows; DROP TABLE t;