Debian Codegraph @

mysql-test/suite/innodb/include/prepare_secondary_index.inc

raw
1 # This table scheme is intended to have these properties:
2 # 1. it has a secondary index on one column
3 # 2. the secondary index does not depend on one of columns
4 # In our case unique key on c1 does not depend on c2, and we will use this to
5 # check for bugs in handling implicit locks on secondary indexes,
6 # by UPDATEing c2, and checking if the algorithm believes it caused
7 # change to c1, while it obviously didn't.
8
9 CREATE TABLE t1(
10 id INT NOT NULL,
11 c1 INT NOT NULL,
12 c2 INT NOT NULL,
13 PRIMARY KEY (id DESC),
14 UNIQUE KEY(c1)
15 ) Engine=InnoDB;
16
17 INSERT INTO t1 (id,c1,c2) VALUES (0,0,0),(1,1,1),(3,3,3);
18
19 # lock_sec_rec_some_has_impl has some heuristics which try to avoid
20 # invoking costly algorithm, by performing some easy checks first,
21 # one of which is to compare page_get_max_trx_id(page) with
22 # trx_rw_min_trx_id(). To help us pass through this check, we keep
23 # create a rw-transaction from `view_keeper` and keep it open, and then we
24 # also modify the secondary index page from `default`.
25 # Keep trx_rw_min_trx_id() low:
26 --connect (view_keeper, localhost, root,,)
27 BEGIN;
28 UPDATE t1 SET c2=13 WHERE id = 3;
29 # Make page_get_max_trx_id(block->frame) updated:
30 --connection default
31 INSERT INTO t1 (id,c1,c2) VALUES (4,4,4);