| 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 one of columns |
| 4 |
# In our case v1 does not depend on c2, and we will use this to |
| 5 |
# expose a bug in handling secondary indexes on virtual columns, |
| 6 |
# by UPDATEing c2, and causing the algorithm to believe it caused |
| 7 |
# change to v1, 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 |
v1 INT AS (c1) VIRTUAL, |
| 14 |
PRIMARY KEY (id DESC), |
| 15 |
UNIQUE KEY(v1) |
| 16 |
) Engine=InnoDB; |
| 17 |
|
| 18 |
INSERT INTO t1 (id,c1,c2) VALUES (0,0,0),(1,1,1),(3,3,3); |
| 19 |
|
| 20 |
# lock_sec_rec_some_has_impl has some heuristics which try to avoid |
| 21 |
# invoking costly algorithm, by performing some easy checks first, |
| 22 |
# one of which is to compare page_get_max_trx_id(page) with |
| 23 |
# trx_rw_min_trx_id(). To help us pass through this check, we keep |
| 24 |
# create a rw-transaction from `view_keeper` and keep it open, and then we |
| 25 |
# also modify the secondary index page from `default`. |
| 26 |
# Keep trx_rw_min_trx_id() low: |
| 27 |
--connect (view_keeper, localhost, root,,) |
| 28 |
BEGIN; |
| 29 |
UPDATE t1 SET c2=13 WHERE id = 3; |
| 30 |
# Make page_get_max_trx_id(block->frame) updated: |
| 31 |
--connection default |
| 32 |
INSERT INTO t1 (id,c1,c2) VALUES (4,4,4); |