Debian Codegraph @

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

raw
1 --source include/count_sessions.inc
2
3 CREATE TABLE t1 (
4 id INT PRIMARY KEY,
5 u CHAR(2) NOT NULL,
6 v CHAR(2) NOT NULL,
7 UNIQUE INDEX by_u_1 (u(1)),
8 INDEX by_v_1 (v(1))
9 );
10 INSERT INTO t1 VALUES (0,"aa","aa"),(10,"ee","ee"),(20,"oo","oo");
11
12 --connect (con1, localhost, root,,)
13 BEGIN;
14 # This query is supposed to place an S lock on (v="e",id=10) entry in secondary index
15 # without placing any lock on the (id=10) entry in the clustered index.
16 SELECT COUNT(*) FROM t1 FORCE INDEX ( by_v_1 ) WHERE v>"b" AND id<>10 FOR SHARE;
17
18 --connect (con2, localhost, root,,)
19 BEGIN;
20 # This query should try to insert a record to clustered index, then to by_u_1,
21 # notice the conflict there, and perform a partial rollback, in which it should
22 # first try to remove the record form by_u_1, realize there's nothing there to
23 # remove, then move on to removing a record from by_v_1, notice that the record
24 # for (v="e",id=10) already exists, attempt implicit to explicit lock conversion,
25 # and realize that it actually doesn't have an implicit lock on this record, as
26 # "ef" and "ee" both have the same prefix "e", so no change to by_v_1 was done.
27 --error ER_DUP_ENTRY
28 UPDATE t1 SET u="oo",v="ef" WHERE id=10;
29 ROLLBACK;
30
31 --connection default
32 --disconnect con1
33 --disconnect con2
34
35 DROP TABLE t1;
36
37 --source include/wait_until_count_sessions.inc