Debian Codegraph @

mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result

raw
1 set default_storage_engine=innodb;
2 set @old_dbug=@@global.debug_dbug;
3 SET @saved_stats_persistent = @@GLOBAL.innodb_stats_persistent;
4 SET GLOBAL innodb_stats_persistent = OFF;
5 CREATE TABLE `t` (
6 `a` BLOB,
7 `b` BLOB,
8 `c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
9 `h` VARCHAR(10) DEFAULT NULL,
10 `i` int
11 ) ENGINE=InnoDB;
12 INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1);
13 INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
14 CREATE INDEX idx ON t(c(100));
15 SET global debug_dbug="d,ib_purge_virtual_index_callback";
16 UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
17 InnoDB 0 transactions not purged
18 SET global debug_dbug=@old_dbug;
19 DROP TABLE t;
20 CREATE TABLE t (
21 a TINYBLOB,
22 b TINYBLOB,
23 c TINYBLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
24 h VARCHAR(10) DEFAULT NULL,
25 i INT
26 ) ROW_FORMAT=COMPACT ENGINE=InnoDB;
27 INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1);
28 INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
29 CREATE INDEX idx ON t(c(100));
30 SET global debug_dbug="d,ib_purge_virtual_index_callback";
31 UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
32 InnoDB 0 transactions not purged
33 SET global debug_dbug=@old_dbug;
34 DROP TABLE t;
35 CREATE TABLE t1 (
36 id INT NOT NULL,
37 store_id INT NOT NULL,
38 x INT GENERATED ALWAYS AS (id + store_id)
39 )
40 PARTITION BY RANGE (store_id) (
41 PARTITION p0 VALUES LESS THAN (6),
42 PARTITION p1 VALUES LESS THAN (11),
43 PARTITION p2 VALUES LESS THAN (16),
44 PARTITION p3 VALUES LESS THAN (21)
45 );
46 insert into t1 values(1, 2, default);
47 insert into t1 values(3, 4, default);
48 insert into t1 values(3, 12, default);
49 insert into t1 values(4, 18, default);
50 CREATE INDEX idx ON t1(x);
51 SET global debug_dbug="d,ib_purge_virtual_index_callback";
52 UPDATE t1 SET id = 10 WHERE id = 1;
53 InnoDB 0 transactions not purged
54 SET global debug_dbug=@old_dbug;
55 DROP TABLE t1;
56 connect con1,localhost,root,,;
57 connection default;
58 CREATE TABLE t1 (a INT, b INT);
59 INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3);
60 connection con1;
61 # disable purge
62 CREATE TABLE t0 (a INT) ENGINE=InnoDB;
63 BEGIN;
64 SELECT * FROM t0;
65 a
66 connection default;
67 DELETE FROM t1 WHERE a = 1;
68 UPDATE t1 SET a = 4, b = 4 WHERE a = 3;
69 INSERT INTO t1(a, b) VALUES (5, 5);
70 SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged';
71 ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
72 ERROR 0A000: LOCK=NONE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try LOCK=SHARED
73 ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED;
74 connection con1;
75 SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
76 # enable purge
77 COMMIT;
78 # wait for purge to process the deleted records.
79 InnoDB 1 transactions not purged
80 SET DEBUG_SYNC= 'now SIGNAL purged';
81 connection default;
82 /* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED;
83 SHOW CREATE TABLE t1;
84 Table Create Table
85 t1 CREATE TABLE `t1` (
86 `a` int(11) DEFAULT NULL,
87 `b` int(11) DEFAULT NULL,
88 `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL,
89 KEY `idx` (`c`)
90 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
91 SELECT * FROM t1;
92 a b c
93 2 2 4
94 4 4 8
95 5 5 10
96 DROP TABLE t1;
97 CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b));
98 INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4);
99 connect stop_purge,localhost,root,,;
100 START TRANSACTION WITH CONSISTENT SNAPSHOT;
101 connection default;
102 DELETE FROM t1 WHERE a = 1;
103 UPDATE t1 SET a = 2, b = 2 WHERE a = 5;
104 INSERT INTO t1(a, b) VALUES (6, 6);
105 SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged';
106 ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
107 connection con1;
108 SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
109 BEGIN;
110 DELETE FROM t1 WHERE a = 3;
111 UPDATE t1 SET a = 7, b = 7 WHERE a = 4;
112 INSERT INTO t1(a, b) VALUES (8, 8);
113 disconnect stop_purge;
114 COMMIT;
115 # wait for purge to process the deleted/updated records.
116 InnoDB 2 transactions not purged
117 SET DEBUG_SYNC= 'now SIGNAL purged';
118 disconnect con1;
119 connection default;
120 /* connection default */ ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
121 SHOW CREATE TABLE t1;
122 Table Create Table
123 t1 CREATE TABLE `t1` (
124 `a` int(11) DEFAULT NULL,
125 `b` int(11) DEFAULT NULL,
126 `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL,
127 KEY `idx` (`c`)
128 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
129 SELECT * FROM t1;
130 a b c
131 2 2 4
132 7 7 14
133 6 6 12
134 8 8 16
135 DROP TABLE t0, t1;
136 create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
137 insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
138 insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
139 set global debug_dbug="d,ib_purge_virtual_index_callback";
140 connect prevent_purge, localhost, root;
141 start transaction with consistent snapshot;
142 connection default;
143 update t set a = repeat('m', 16000) where a like "aaa%";
144 connect lock_table, localhost, root;
145 lock table t write;
146 connection prevent_purge;
147 commit;
148 connection default;
149 disconnect lock_table;
150 InnoDB 0 transactions not purged
151 set global debug_dbug=@old_dbug;
152 drop table t;
153 #
154 # MDEV-15165 InnoDB purge for index on virtual column
155 # is trying to access an incomplete record
156 #
157 CREATE TABLE t1(
158 u INT PRIMARY KEY, b BLOB, ug INT GENERATED ALWAYS AS (u) VIRTUAL,
159 INDEX bug(b(100),ug)
160 ) ENGINE=InnoDB;
161 INSERT INTO t1 (u,b) VALUES(1,REPEAT('a',16384));
162 connection prevent_purge;
163 start transaction with consistent snapshot;
164 connection default;
165 DELETE FROM t1;
166 SET DEBUG_SYNC='blob_write_middle SIGNAL halfway WAIT_FOR purged';
167 INSERT INTO t1 (u,b) VALUES(1,REPEAT('a',16384));
168 connection prevent_purge;
169 SET DEBUG_SYNC='now WAIT_FOR halfway';
170 COMMIT;
171 InnoDB 0 transactions not purged
172 SET DEBUG_SYNC='now SIGNAL purged';
173 connection default;
174 DROP TABLE t1;
175 CREATE TABLE t1 (y YEAR, vy YEAR AS (y) VIRTUAL UNIQUE, pk INT PRIMARY KEY)
176 ENGINE=InnoDB;
177 INSERT INTO t1 (pk,y) VALUES (1,2022);
178 CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
179 SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback';
180 BEGIN;
181 INSERT INTO t2(f1) VALUES(1);
182 connection prevent_purge;
183 SET DEBUG_SYNC=RESET;
184 start transaction with consistent snapshot;
185 connection default;
186 COMMIT;
187 connect truncate,localhost,root,,;
188 REPLACE INTO t1(pk, y) SELECT pk,y FROM t1;
189 TRUNCATE TABLE t1;
190 connection prevent_purge;
191 COMMIT;
192 SET DEBUG_SYNC='now SIGNAL purge_start';
193 disconnect prevent_purge;
194 connection default;
195 SET DEBUG_SYNC='now WAIT_FOR purge_start';
196 InnoDB 0 transactions not purged
197 SET GLOBAL debug_dbug=@old_dbug;
198 connection truncate;
199 disconnect truncate;
200 connection default;
201 DROP TABLE t1, t2;
202 set debug_sync=reset;
203 SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;