1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
--source include/have_debug.inc
--source include/big_test.inc
--echo # Check if a DDL operation can be interrupted.
DELIMITER |;
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|
DELIMITER ;|
CREATE TABLE t(c int) ENGINE=INNODB;
--echo # Insert rows
CALL insert_rows(1, 1000);
connect (con1,localhost,root,,);
connection con1;
--echo # con1: Start the DDL
let $ID= `SELECT @id := CONNECTION_ID()`;
SET SESSION DEBUG='+d,ddl_merge_sort_interrupt';
SET DEBUG_SYNC='ddl_merge_sort_interrupt SIGNAL ready WAIT_FOR interrupt';
--send ALTER TABLE t ADD PRIMARY KEY(c);
connection default;
--echo # default: Kill the DDL
let $ignore= `SELECT @id := $ID`;
SET DEBUG_SYNC='now WAIT_FOR ready';
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL interrupt';
connection con1;
--echo # con1: reap
--error ER_QUERY_INTERRUPTED
--reap
--echo # Cleanup. Since ALTER TABLE was killed while waiting on sync point
--echo # 'interrupt' signal might have been not received and properly cleared.
SET DEBUG_SYNC='RESET';
connect (con2,localhost,root,,);
connection con2;
--echo # con2: Start the DDL
let $ID= `SELECT @id := CONNECTION_ID()`;
SET SESSION DEBUG='+d,ddl_btree_build_interrupt';
SET DEBUG_SYNC='ddl_btree_build_interrupt SIGNAL ready WAIT_FOR interrupt';
--send ALTER TABLE t ADD index i(c);
connection default;
--echo # default: Kill the DDL
let $ignore= `SELECT @id := $ID`;
SET DEBUG_SYNC='now WAIT_FOR ready';
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL interrupt';
connection con2;
--echo # con2: reap
--error ER_QUERY_INTERRUPTED
--reap
connection default;
--echo # Cleanup
SET DEBUG_SYNC="RESET";
DROP PROCEDURE insert_rows;
DROP TABLE t;
disconnect con1;
|