Debian Codegraph @

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

raw
1 --source include/have_debug_sync.inc
2
3 # Save the original settings, to be restored at the end of test
4 SET @innodb_lock_wait_timeout_saved = @@global.innodb_lock_wait_timeout;
5
6 # Make sure that transactions will not finish prematurely
7 SET @@global.innodb_lock_wait_timeout = 100000;
8
9 # Perepare a table with case-insensitive secondary index
10 CREATE TABLE t1 (
11 id INT PRIMARY KEY,
12 val VARCHAR(50) NOT NULL COLLATE utf8mb4_0900_ai_ci,
13 KEY(val)
14 );
15 # and two rows, which are initially lower-case
16 INSERT INTO t1 (id,val) VALUES (1,"a"), (2,"a");
17
18 --connect (con1, localhost, root,,)
19 BEGIN;
20 # Change the case only
21 UPDATE t1 SET val="A" WHERE id=2;
22
23 SELECT index_name, lock_type, lock_mode, lock_status, lock_data
24 FROM performance_schema.data_locks
25 WHERE object_schema="test" AND object_name="t1"
26 ORDER BY 1, 2, 3, 4, 5;
27
28 --connect (con2, localhost, root,,)
29 BEGIN;
30 # This query can be answered entirely by just looking into `val` secondary index
31 # yet it depends on the actual bytes (and thus is case-sensitive).
32 # The result set, thus depends on con1's transaction, and thus con2 should wait
33 SET DEBUG_SYNC = 'lock_wait_will_wait SIGNAL con2_will_wait';
34 --send SELECT COUNT(1) FROM t1 WHERE val="a" AND CONVERT(val,binary)="A" FOR SHARE
35
36 --connection con1
37 SET DEBUG_SYNC = 'now WAIT_FOR con2_will_wait';
38 COMMIT;
39
40 --connection con2
41 # We expect only one row, the one with id=2 to be returned
42 --reap
43 COMMIT;
44
45 # Clean up
46 --connection default
47
48 --disconnect con1
49 --disconnect con2
50
51 DROP TABLE t1;
52 SET @@global.innodb_lock_wait_timeout = @innodb_lock_wait_timeout_saved;