Debian Codegraph @

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

raw
1 #
2 # This tests checks handling of secondary index purge when
3 # new record is inserted by modify and has externally stored
4 # columns. In that case purge may be called in state when
5 # it is not possible to build entry from row data.
6 #
7 # In the above case there was a try to access NULL entry for
8 # indexes with virtual columns and externally stored BLOBs.
9 #
10
11 --source include/have_debug_sync.inc
12 --source include/count_sessions.inc
13
14 SET DEBUG_SYNC='reset';
15
16 connect (con1,localhost,root,,);
17
18 #
19 # Try with an index without virtual columns
20 #
21
22 connection default;
23 CREATE TABLE t1 (
24 id INT UNIQUE NOT NULL,
25 a INT,
26 b BLOB,
27 ag INT GENERATED ALWAYS AS (a) VIRTUAL,
28 PRIMARY KEY(id),
29 INDEX bugidx (b(100),a)
30 ) ENGINE=InnoDB;
31
32 INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('a', 50001));
33 INSERT INTO t1 (id, a, b) VALUES (1002, 2, REPEAT('b', 50002));
34
35 SET GLOBAL innodb_purge_stop_now = ON;
36 sleep 1;
37 DELETE FROM t1 WHERE id = 1001;
38
39 connection con1;
40 SET DEBUG_SYNC='before_row_ins_upd_pessimistic SIGNAL s1 WAIT_FOR s2 TIMEOUT 10';
41 send INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('z', 60001));
42
43 connection default;
44 SET DEBUG_SYNC='now WAIT_FOR s1';
45 SET GLOBAL innodb_purge_run_now = ON;
46 sleep 5;
47 SET DEBUG_SYNC='now SIGNAL s2';
48 --source include/wait_innodb_all_purged.inc
49 SET DEBUG_SYNC='reset';
50
51 connection con1;
52 reap;
53 SET DEBUG_SYNC='reset';
54
55 connection default;
56 drop table t1;
57
58 #
59 # Try with an index with virtual columns
60 #
61
62 connection default;
63 CREATE TABLE t1 (
64 id INT UNIQUE NOT NULL,
65 a INT,
66 b BLOB,
67 ag INT GENERATED ALWAYS AS (a) VIRTUAL,
68 PRIMARY KEY(id),
69 INDEX bugidx (b(100),ag)
70 ) ENGINE=InnoDB;
71
72 INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('a', 50001));
73 INSERT INTO t1 (id, a, b) VALUES (1002, 2, REPEAT('b', 50002));
74
75 SET GLOBAL innodb_purge_stop_now = ON;
76 sleep 1;
77 DELETE FROM t1 WHERE id = 1001;
78
79 connection con1;
80 SET DEBUG_SYNC='before_row_ins_upd_pessimistic SIGNAL s1 WAIT_FOR s2 TIMEOUT 10';
81 send INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('z', 60001));
82
83 connection default;
84 SET DEBUG_SYNC='now WAIT_FOR s1';
85 SET GLOBAL innodb_purge_run_now = ON;
86 sleep 5;
87 SET DEBUG_SYNC='now SIGNAL s2';
88 --source include/wait_innodb_all_purged.inc
89 SET DEBUG_SYNC='reset';
90
91 connection con1;
92 reap;
93 SET DEBUG_SYNC='reset';
94
95 connection default;
96 drop table t1;
97
98 #
99 # Cleanup
100 #
101
102 connection con1;
103 disconnect con1;
104
105 connection default;
106 --source include/wait_until_count_sessions.inc