| 1 |
# Check if a DDL operation can be interrupted. |
| 2 |
CREATE PROCEDURE insert_rows(IN BASE INT, IN SIZE INT) |
| 3 |
BEGIN |
| 4 |
DECLARE i INT DEFAULT BASE; |
| 5 |
WHILE (i <= SIZE) DO |
| 6 |
INSERT INTO t values (i); |
| 7 |
SET i = i + 1; |
| 8 |
END WHILE; |
| 9 |
END| |
| 10 |
CREATE TABLE t(c int) ENGINE=INNODB; |
| 11 |
# Insert rows |
| 12 |
CALL insert_rows(1, 1000); |
| 13 |
# con1: Start the DDL |
| 14 |
SET SESSION DEBUG='+d,ddl_merge_sort_interrupt'; |
| 15 |
SET DEBUG_SYNC='ddl_merge_sort_interrupt SIGNAL ready WAIT_FOR interrupt'; |
| 16 |
ALTER TABLE t ADD PRIMARY KEY(c);; |
| 17 |
# default: Kill the DDL |
| 18 |
SET DEBUG_SYNC='now WAIT_FOR ready'; |
| 19 |
KILL QUERY @id; |
| 20 |
SET DEBUG_SYNC='now SIGNAL interrupt'; |
| 21 |
# con1: reap |
| 22 |
ERROR 70100: Query execution was interrupted |
| 23 |
# Cleanup. Since ALTER TABLE was killed while waiting on sync point |
| 24 |
# 'interrupt' signal might have been not received and properly cleared. |
| 25 |
SET DEBUG_SYNC='RESET'; |
| 26 |
# con2: Start the DDL |
| 27 |
SET SESSION DEBUG='+d,ddl_btree_build_interrupt'; |
| 28 |
SET DEBUG_SYNC='ddl_btree_build_interrupt SIGNAL ready WAIT_FOR interrupt'; |
| 29 |
ALTER TABLE t ADD index i(c);; |
| 30 |
# default: Kill the DDL |
| 31 |
SET DEBUG_SYNC='now WAIT_FOR ready'; |
| 32 |
KILL QUERY @id; |
| 33 |
SET DEBUG_SYNC='now SIGNAL interrupt'; |
| 34 |
# con2: reap |
| 35 |
ERROR 70100: Query execution was interrupted |
| 36 |
# Cleanup |
| 37 |
SET DEBUG_SYNC="RESET"; |
| 38 |
DROP PROCEDURE insert_rows; |
| 39 |
DROP TABLE t; |