| 1 |
CREATE TABLE t1 ( |
| 2 |
id INT PRIMARY KEY, |
| 3 |
value INT, |
| 4 |
value2 VARCHAR(50), |
| 5 |
INDEX(value, value2) |
| 6 |
) ENGINE=NDB; |
| 7 |
INSERT INTO t1 VALUES(1, 1, "val1"); |
| 8 |
# Switch to second connection |
| 9 |
# Reset all DEBUG_SYNC points |
| 10 |
SET DEBUG_SYNC='RESET'; |
| 11 |
# Setup ALTER TABLE to wait after GSL acquired |
| 12 |
SET DEBUG_SYNC='ndb_global_schema_lock_acquired |
| 13 |
SIGNAL got_GSL WAIT_FOR alter_continue'; |
| 14 |
# Start ALTER TABLE query, should take GSL, reach the synch |
| 15 |
# point, signal and wait |
| 16 |
ALTER TABLE t1 ADD COLUMN value3 BLOB DEFAULT NULL; |
| 17 |
# Switch to default connection |
| 18 |
# Wait for the ALTER TABLE query to signal that it has acquired the GSL |
| 19 |
SET DEBUG_SYNC='now WAIT_FOR got_GSL'; |
| 20 |
# Start second ALTER TABLE query which will hang waiting on GSL |
| 21 |
ALTER TABLE t1 ADD COLUMN value4 BLOB DEFAULT NULL; |
| 22 |
# Switch to default connection |
| 23 |
# Kill the hanging ALTER |
| 24 |
KILL QUERY <CONNECTION_ID>; |
| 25 |
# Switch to third connection |
| 26 |
# Complete the killed ALTER TABLE query, it's expected to fail since |
| 27 |
# it was killed |
| 28 |
ERROR HY000: Lock acquisition refused by storage engine. |
| 29 |
SHOW WARNINGS; |
| 30 |
Level Code Message |
| 31 |
Error 3177 Lock acquisition refused by storage engine. |
| 32 |
# Tell the ALTER TABLE which holds GSL to continue processing |
| 33 |
SET DEBUG_SYNC='now SIGNAL alter_continue'; |
| 34 |
# Switch to second connection |
| 35 |
# Complete the ALTER TABLE query |
| 36 |
# Switch to default connection |
| 37 |
SET DEBUG_SYNC='RESET'; |
| 38 |
DROP TABLE t1; |