Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --source include/count_sessions.inc
3 --source include/have_debug.inc
4 --source include/have_debug_sync.inc
5
6 CREATE TABLE t (pk int PRIMARY KEY, c varchar(10))
7 STATS_PERSISTENT=0 ENGINE=InnoDB;
8 INSERT INTO t VALUES (10, "0123456789");
9
10 --connection default
11 BEGIN;
12 SELECT * FROM t WHERE c = 10 FOR UPDATE;
13
14 --connect(trx2, localhost,root,,)
15 BEGIN;
16 SET DEBUG_SYNC="lock_wait_start SIGNAL trx2_start_waiting";
17 SET DEBUG_SYNC="lock_wait_end SIGNAL trx2_wait_end WAIT_FOR trx2_cont_upd";
18 SET DEBUG_SYNC="lock_rec_store_on_page_infimum_end SIGNAL trx2_moved_locks WAIT_FOR trx2_cont";
19 #################
20 # We need to update clustered record without changing ordering fields and
21 # changing the size of non-ordering fields to cause locks moving from deleted
22 # record to infimum.
23 ###
24 --send UPDATE t SET c = NULL WHERE pk = 10
25
26
27 --connect(trx3, localhost,root,,)
28 SET DEBUG_SYNC="now WAIT_FOR trx2_start_waiting";
29 #################
30 # The condition wariable waiting in lock_wait() must be finished by timeout
31 ###
32 SET innodb_lock_wait_timeout=1;
33 BEGIN;
34 SET DEBUG_SYNC="lock_wait_start SIGNAL trx3_start_waiting WAIT_FOR trx3_cont_waiting";
35 SET DEBUG_SYNC="lock_sys_t_cancel_enter SIGNAL trx3_cancel_enter WAIT_FOR trx3_cont_cancel_waiting";
36 --send UPDATE t SET c = "abcdefghij" WHERE pk = 10
37
38 --connection default
39 SET DEBUG_SYNC="now WAIT_FOR trx3_start_waiting";
40 COMMIT;
41 SET DEBUG_SYNC="now WAIT_FOR trx2_wait_end";
42 SET DEBUG_SYNC="now SIGNAL trx3_cont_waiting";
43 SET DEBUG_SYNC="now WAIT_FOR trx3_cancel_enter";
44 SET DEBUG_SYNC="now SIGNAL trx2_cont_upd";
45 SET DEBUG_SYNC="now WAIT_FOR trx2_moved_locks";
46 #################
47 # If the bug is not fixed, there will be assertion failure here, because trx2
48 # moved trx3 lock from deleted record to infimum when trx3 tried to cancel the
49 # lock.
50 ###
51 SET DEBUG_SYNC="now SIGNAL trx3_cont_cancel_waiting";
52 SET DEBUG_SYNC="now SIGNAL trx2_cont";
53
54 --disconnect trx2
55 --disconnect trx3
56 --connection default
57 SET DEBUG_SYNC="RESET";
58 DROP TABLE t;
59 --source include/wait_until_count_sessions.inc