Debian Codegraph @

mysql-test/suite/innodb/t/lock_s_to_implicit_x_escalation.test

raw
1 --source include/count_sessions.inc
2 --source include/have_debug_sync.inc
3
4 CREATE TABLE t1 (id INT PRIMARY KEY);
5 INSERT INTO t1 VALUES (1);
6
7 --connect (con1, localhost, root,,)
8 --connect (con2, localhost, root,,)
9 --connect (con3, localhost, root,,)
10
11 --connection con3
12 # create a read view which will prevent purging the id=1
13 BEGIN;
14 SELECT * FROM t1;
15
16 --connection con1
17 # delete-mark the id=1
18 DELETE FROM t1 WHERE id=1;
19 # place LOCK_S
20 BEGIN;
21 SELECT * FROM t1 FOR SHARE;
22
23 --connection con2
24 # place a WAITING LOCK_X
25 BEGIN;
26 SET DEBUG_SYNC = "lock_wait_will_wait SIGNAL con2_will_wait";
27 --send SELECT * FROM t1 FOR UPDATE
28
29 --connection con1
30 SET DEBUG_SYNC = "now WAIT_FOR con2_will_wait";
31 # attempt S to X escalation, bypassing con2, and using implicit lock
32 INSERT INTO t1 VALUES (1);
33
34 --connection con3
35 # insert a record just before id=1, just to trigger validation for this record
36 SET DEBUG_SYNC = "lock_wait_will_wait SIGNAL con3_will_wait";
37 --send INSERT INTO t1 VALUES (0)
38
39 --connection con1
40 SET DEBUG_SYNC = "now WAIT_FOR con3_will_wait";
41
42 --connection default
43 --disconnect con1
44 --disconnect con2
45 --disconnect con3
46 DROP TABLE t1;
47
48 --source include/wait_until_count_sessions.inc