Debian Codegraph @

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

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