File: virtual_debug_purge.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (273 lines) | stat: -rw-r--r-- 8,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
CREATE TABLE `t` (
`a` BLOB,
`b` BLOB,
`c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
`h` VARCHAR(10) DEFAULT NULL,
`i` int
) ENGINE=InnoDB;
INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
SET global debug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
select sleep(3);
sleep(3)
0
SET global debug="-d,ib_purge_virtual_index_callback";
DROP TABLE t;
CREATE TABLE t (
a TINYBLOB,
b TINYBLOB,
c TINYBLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
h VARCHAR(10) DEFAULT NULL,
i INT
) ROW_FORMAT=COMPACT ENGINE=InnoDB;
INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
SET global debug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
select sleep(3);
sleep(3)
0
SET global debug="-d,ib_purge_virtual_index_callback";
DROP TABLE t;
CREATE TABLE t1 (
id INT NOT NULL,
store_id INT NOT NULL,
x INT GENERATED ALWAYS AS (id + store_id)
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN (21)
);
insert into t1 values(1, 2, default);
insert into t1 values(3, 4, default);
insert into t1 values(3, 12, default);
insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x);
SET global debug="+d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1;
select sleep(3);
sleep(3)
0
SET global debug="-d,ib_purge_virtual_index_callback";
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3);
# disable purge
CREATE TABLE t0 (a INT) ENGINE=InnoDB;
BEGIN;
SELECT * FROM t0;
a
DELETE FROM t1 WHERE a = 1;
UPDATE t1 SET a = 4, b = 4 WHERE a = 3;
INSERT INTO t1(a, b) VALUES (5, 5);
SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged';
ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: ADD COLUMN col...VIRTUAL, ADD INDEX(col). Try LOCK=SHARED.
ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED;
SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
# enable purge
COMMIT;
# wait for purge to process the deleted records.
set global innodb_purge_run_now=ON;
select sleep(1);
sleep(1)
0
SET DEBUG_SYNC= 'now SIGNAL purged';
/* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int DEFAULT NULL,
  `b` int DEFAULT NULL,
  `c` int GENERATED ALWAYS AS ((`a` + `b`)) VIRTUAL,
  KEY `idx` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT * FROM t1;
a	b	c
2	2	4
4	4	8
5	5	10
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b));
INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4);
# disable purge
BEGIN;
SELECT * FROM t0;
a
DELETE FROM t1 WHERE a = 1;
UPDATE t1 SET a = 2, b = 2 WHERE a = 5;
INSERT INTO t1(a, b) VALUES (6, 6);
SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged';
ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
DELETE FROM t1 WHERE a = 3;
UPDATE t1 SET a = 7, b = 7 WHERE a = 4;
INSERT INTO t1(a, b) VALUES (8, 8);
# enable purge
COMMIT;
# wait for purge to process the deleted/updated records.
set global innodb_purge_run_now=ON;
select sleep(1);
sleep(1)
0
SET DEBUG_SYNC= 'now SIGNAL purged';
/* connection default */ ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int DEFAULT NULL,
  `b` int DEFAULT NULL,
  `c` int GENERATED ALWAYS AS ((`a` + `b`)) VIRTUAL,
  KEY `idx` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT * FROM t1;
a	b	c
2	2	4
7	7	14
6	6	12
8	8	16
DROP TABLE t0, t1;
#
# Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION
# ON INDEXED VIRTUAL COLUMNS
#
CREATE TABLE t1 (a INT, b INT,
a1 INT GENERATED ALWAYS AS (a) VIRTUAL, INDEX(a1)
) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES(1,1);
CREATE TABLE t0 (a INT) ENGINE=InnoDB;
BEGIN;
SELECT * FROM t0;
a
UPDATE t1 SET a=0;
ALTER TABLE t1 DROP COLUMN a1, ALGORITHM=INPLACE;
ALTER TABLE t1 ADD COLUMN b1 INT GENERATED ALWAYS AS (b) VIRTUAL, ADD
INDEX(b1),
ALGORITHM=INPLACE;
COMMIT;
UPDATE t1 SET a=1;
set global innodb_purge_run_now=ON;
select sleep(1);
sleep(1)
0
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
SELECT b1 FROM t1;
b1
1
ALTER TABLE t1
ADD COLUMN a1 INT GENERATED ALWAYS AS (a) VIRTUAL,
ADD COLUMN a2 INT GENERATED ALWAYS AS (a + b) VIRTUAL,
ADD COLUMN a3 INT GENERATED ALWAYS AS (a - b) VIRTUAL,
ADD COLUMN a4 INT GENERATED ALWAYS AS (a - b) VIRTUAL,
ADD INDEX(a1), ADD INDEX(a2), ADD INDEX(a3), ALGORITHM=INPLACE;
CREATE TABLE t2 (
a BLOB,
b BLOB,
c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
h VARCHAR(10) DEFAULT NULL
) ENGINE=InnoDB;
INSERT INTO t2 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, 'kk');
INSERT INTO t2 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
CREATE INDEX idx ON t2(c(100));
INSERT INTO t1 (a, b) VALUES(1,1);
BEGIN;
SELECT * FROM t0;
a
UPDATE t1 SET a=0;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
UPDATE t1 SET b=0;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t1 DROP COLUMN a3, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET a=2;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t1 DROP COLUMN a2, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET b=3;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t1 ADD COLUMN b2 INT GENERATED ALWAYS AS (b) VIRTUAL,
ADD INDEX(b2), ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET b=9;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t1 ADD COLUMN b3 INT GENERATED ALWAYS AS (a) VIRTUAL,
ADD INDEX(b3), ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET b=10;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t2 DROP COLUMN c;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t2 SET a = REPEAT('s', 6000) WHERE a like 'aaa%';
affected rows: 1
info: Rows matched: 1  Changed: 1  Warnings: 0
ALTER TABLE t2 ADD COLUMN x1 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
ADD COLUMN x2 BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
ADD INDEX(x1(100), x2(120)), ADD INDEX (x1(20));
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET a=5;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
UPDATE t2 SET a = REPEAT('m', 16000) WHERE a like 'sss%';
affected rows: 1
info: Rows matched: 1  Changed: 1  Warnings: 0
ALTER TABLE t1 DROP COLUMN b2, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET a=6;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
ALTER TABLE t2 DROP COLUMN x1, DROP COLUMN x2, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t2 SET a = REPEAT('x', 1000) WHERE a like 'mmm%';
affected rows: 1
info: Rows matched: 1  Changed: 1  Warnings: 0
ALTER TABLE t1 DROP INDEX b3;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
UPDATE t1 SET a=100;
affected rows: 2
info: Rows matched: 2  Changed: 2  Warnings: 0
COMMIT;
set global innodb_purge_run_now=ON;
select sleep(1);
sleep(1)
0
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
SELECT b1 FROM t1;
b1
10
10
SELECT * FROM t1;
a	b	b1	a1	a4	b3
100	10	10	100	90	100
100	10	10	100	90	100
CHECK TABLE t2;
Table	Op	Msg_type	Msg_text
test.t2	check	status	OK
DROP TABLE t2, t1, t0;
CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL);
CREATE INDEX idx ON t1(a2(10), b, a2(20));
ERROR 42S21: Duplicate column name 'a2'
DROP TABLE t1;