Debian Codegraph @

mysql-test/suite/innodb/r/hp_deadlock.result

raw
1 SET @old_innodb_lock_wait_timeout= @@GLOBAL.innodb_lock_wait_timeout;
2 SET GLOBAL innodb_lock_wait_timeout= 4;
3 # SCENARIO 1
4 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
5 INSERT INTO t1 VALUES (0);
6 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
7 INSERT INTO t2 VALUES (0);
8 include/start_transaction_high_prio.inc
9 START TRANSACTION /* HIGH PRIORITY */;
10 DELETE FROM t2;
11 include/start_transaction_high_prio.inc
12 START TRANSACTION /* HIGH PRIORITY */;
13 DELETE FROM t1;
14 SET DEBUG_SYNC='lock_wait_will_wait SIGNAL con3_will_wait';
15 DELETE FROM t2; COMMIT;
16 SET DEBUG_SYNC='now WAIT_FOR con3_will_wait';
17 include/start_transaction_high_prio.inc
18 START TRANSACTION /* HIGH PRIORITY */;
19 SET DEBUG_SYNC='lock_wait_will_wait SIGNAL con1_will_wait';
20 DELETE FROM t1; COMMIT;
21 COMMIT;
22 DROP TABLE t1;
23 DROP TABLE t2;
24 # SCENARIO 2
25 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
26 INSERT INTO t1 VALUES (0);
27 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
28 INSERT INTO t2 VALUES (0);
29 CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
30 INSERT INTO t3 VALUES (0);
31 BEGIN;
32 SELECT * FROM t3 FOR UPDATE;
33 c1
34 0
35 BEGIN;
36 DELETE FROM t2;
37 SET DEBUG_SYNC='lock_wait_has_finished_waiting WAIT_FOR con2_can_rollback';
38 SET DEBUG_SYNC='lock_wait_will_wait SIGNAL con2_will_wait';
39 SELECT * FROM t3 FOR UPDATE;
40 SET DEBUG_SYNC='now WAIT_FOR con2_will_wait';
41 include/start_transaction_high_prio.inc
42 START TRANSACTION /* HIGH PRIORITY */;
43 DELETE FROM t1;
44 SET DEBUG_SYNC='lock_wait_will_wait SIGNAL con3_will_wait';
45 DELETE FROM t2; COMMIT;
46 SET DEBUG_SYNC='now WAIT_FOR con3_will_wait';
47 include/start_transaction_high_prio.inc
48 START TRANSACTION /* HIGH PRIORITY */;
49 SET DEBUG_SYNC='lock_wait_will_wait SIGNAL con1_will_wait';
50 DELETE FROM t1; COMMIT;
51 Got one of the listed errors
52 SET DEBUG_SYNC='now SIGNAL con2_can_rollback';
53 ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
54 DROP TABLE t3;
55 DROP TABLE t1;
56 DROP TABLE t2;
57 SET GLOBAL innodb_lock_wait_timeout= @old_innodb_lock_wait_timeout;