| 1 |
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 2 |
INSERT INTO t VALUES (3); |
| 3 |
BEGIN; |
| 4 |
UPDATE t SET a = 2; |
| 5 |
connect con1,localhost,root; |
| 6 |
SET DEBUG_SYNC="lock_wait_start SIGNAL del_locked"; |
| 7 |
DELETE FROM t; |
| 8 |
connection default; |
| 9 |
SET DEBUG_SYNC="now WAIT_FOR del_locked"; |
| 10 |
UPDATE t SET a = 1; |
| 11 |
COMMIT; |
| 12 |
connection con1; |
| 13 |
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
| 14 |
disconnect con1; |
| 15 |
connection default; |
| 16 |
# The above DELETE must delete all the rows in the table, so the |
| 17 |
# following SELECT must show 0 rows. |
| 18 |
SELECT count(*) FROM t; |
| 19 |
count(*) |
| 20 |
1 |
| 21 |
SET DEBUG_SYNC="reset"; |
| 22 |
DROP TABLE t; |