Debian Codegraph @

mysql-test/suite/innodb/r/instant_ddl_misc.result

raw
1 ##############################################
2 # Test instant ADD/DROP COLUMN for REDUNDANT format
3 ##############################################
4 SET SESSION debug= '+d,show_dropped_column';
5 # Scenario 1
6 create table t1 (c1 char(10), c2 char(10));
7 # Metadata from INFORMATION_SCHEMA.TABLES
8 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
9 test/t1 5 0 0 2 2 2
10 # Metadata from INFORMATION_SCHEMA.COLUMNS
11 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
12 c1 0 13 16711934 0 0 0
13 c2 1 13 16711934 0 0 0
14 # DD Metadata of table
15 NAME SE_PRIVATE_DATA
16 t1 NULL
17 # DD Metadata of columns in table
18 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
19 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
20 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
21 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
22 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
23 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
24 insert into t1 values ("r1c1", "r1c2");
25 select * from t1;
26 c1 c2
27 r1c1 r1c2
28 alter table t1 add column c3 char(10) default "def_c3" after c1;
29 # Metadata from INFORMATION_SCHEMA.TABLES
30 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
31 test/t1 6 0 1 2 3 3
32 # Metadata from INFORMATION_SCHEMA.COLUMNS
33 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
34 c1 0 13 16711934 0 0 0
35 c3 1 13 16711934 1 1 0
36 c2 2 13 16711934 0 0 0
37 # DD Metadata of table
38 NAME SE_PRIVATE_DATA
39 t1 NULL
40 # DD Metadata of columns in table
41 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
42 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
43 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
44 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
45 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
46 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
47 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
48 insert into t1 values ("r2c1", "r2c3", "r2c2");
49 select * from t1;
50 c1 c3 c2
51 r1c1 def_c3 r1c2
52 r2c1 r2c3 r2c2
53 drop table t1;
54 # Scenario 2
55 create table t1 (c1 char(10), c2 char(10), c3 char(10));
56 insert into t1 values ("r1c1", "r1c2", "r1c3");
57 alter table t1 drop column c2;
58 # Metadata from INFORMATION_SCHEMA.TABLES
59 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
60 test/t1 5 0 1 3 2 3
61 # Metadata from INFORMATION_SCHEMA.COLUMNS
62 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
63 c1 0 13 16711934 0 0 0
64 c3 1 13 16711934 0 0 0
65 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
66 # DD Metadata of table
67 NAME SE_PRIVATE_DATA
68 t1 NULL
69 # DD Metadata of columns in table
70 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
71 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
72 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
73 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
74 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
75 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
76 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
77 select * from t1;
78 c1 c3
79 r1c1 r1c3
80 drop table t1;
81 # Scenario 3
82 create table t1 (c1 char(10), c2 char(10));
83 insert into t1 values ("r1c1", "r1c2");
84 select * from t1;
85 c1 c2
86 r1c1 r1c2
87 alter table t1 add column c3 char(10) default "def_c3" after c1, algorithm=INSTANT;
88 insert into t1 values ("r2c1", "r2c3", "r2c2");
89 select * from t1;
90 c1 c3 c2
91 r1c1 def_c3 r1c2
92 r2c1 r2c3 r2c2
93 alter table t1 drop column c2, algorithm=INSTANT;
94 select * from t1;
95 c1 c3
96 r1c1 def_c3
97 r2c1 r2c3
98 drop table t1;
99 # Scenario 4
100 create table t1 (c1 char(10), c2 char(10), c3 char(10));
101 insert into t1 values ("r1c1", "r1c2", "r1c3");
102 select * from t1;
103 c1 c2 c3
104 r1c1 r1c2 r1c3
105 alter table t1 drop column c2;
106 select * from t1;
107 c1 c3
108 r1c1 r1c3
109 drop table t1;
110 # Scenario 5
111 create table t1 (c1 char(10), c2 char(10));
112 insert into t1 values ("r1c1", "r1c2");
113 alter table t1 add column c3 char(10) default "def_c3" after c1;
114 select * from t1;
115 c1 c3 c2
116 r1c1 def_c3 r1c2
117 insert into t1 value ("r2c1", "r2c3", "r2c2");
118 alter table t1 drop column c2;
119 select * from t1;
120 c1 c3
121 r1c1 def_c3
122 r2c1 r2c3
123 drop table t1;
124 # Scenario 6
125 create table t1 (c1 char(10), c2 char(10));
126 insert into t1 values ("r1c1", "r1c2");
127 alter table t1 add column c2 char(10) default "def_c3", drop column c2;
128 select * from t1;
129 c1 c2
130 r1c1 def_c3
131 insert into t1 value ("r2c1", "r2c2");
132 select * from t1;
133 c1 c2
134 r1c1 def_c3
135 r2c1 r2c2
136 drop table t1;
137 # Scenario 7
138 create table t1 (c1 char(10), c2 char(10));
139 insert into t1 values ("r1c1", "r1c2");
140 alter table t1 add column c3 int after c1;
141 select * from t1;
142 c1 c3 c2
143 r1c1 NULL r1c2
144 insert into t1 value ("r2c1", 3, "r2c2");
145 select * from t1;
146 c1 c3 c2
147 r1c1 NULL r1c2
148 r2c1 3 r2c2
149 alter table t1 drop column c2;
150 select * from t1;
151 c1 c3
152 r1c1 NULL
153 r2c1 3
154 drop table t1;
155 # Scenario 8
156 create table t1 (c1 char(10), c2 char(10), c3 char(10));
157 insert into t1 values ("r1c1", NULL, "r1c3");
158 select * from t1;
159 c1 c2 c3
160 r1c1 NULL r1c3
161 alter table t1 drop column c2;
162 # Metadata from INFORMATION_SCHEMA.TABLES
163 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
164 test/t1 5 0 1 3 2 3
165 # Metadata from INFORMATION_SCHEMA.COLUMNS
166 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
167 c1 0 13 16711934 0 0 0
168 c3 1 13 16711934 0 0 0
169 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
170 # DD Metadata of table
171 NAME SE_PRIVATE_DATA
172 t1 NULL
173 # DD Metadata of columns in table
174 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
175 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
176 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
177 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
178 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
179 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
180 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
181 select * from t1;
182 c1 c3
183 r1c1 r1c3
184 drop table t1;
185 # Scenario 9
186 CREATE TABLE t1 (C1 char(10), C2 char(10), C3 char(10)) ROW_FORMAT=REDUNDANT;
187 INSERT INTO t1 values ("r1c1", "r1c2", "r1c3");
188 alter table t1 drop column c1;
189 select * from t1;
190 C2 C3
191 r1c2 r1c3
192 alter table t1 drop column c3;
193 select * from t1;
194 C2
195 r1c2
196 drop table t1;
197 # Scenario 10
198 create table t1 (c1 char(10) KEY, c2 char(10), key sec_idx(c2));
199 insert into t1 values ("r1c1", "r1c2");
200 select * from t1;
201 c1 c2
202 r1c1 r1c2
203 alter table t1 add column c3 char(10) default "def_c3";
204 select * from t1;
205 c1 c2 c3
206 r1c1 r1c2 def_c3
207 insert into t1 values ("r2c1", "r2c2", "r3c3");
208 drop table t1;
209 # Scenario 11
210 CREATE TABLE t1(c2 char(100) , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
211 ALTER TABLE t1 DROP INDEX idx1;
212 DROP TABLE t1;
213 # Scenario 12
214 CREATE TABLE t1(c2 char(100)) ROW_FORMAT=REDUNDANT;
215 ALTER TABLE t1 ADD FULLTEXT INDEX `ft_idx` (c2);
216 Warnings:
217 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
218 DROP TABLE t1;
219 # Scenario 13
220 CREATE TABLE t1(a INT) ROW_FORMAT=REDUNDANT;
221 INSERT INTO t1 VALUES(1);
222 ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT );
223 ALTER TABLE t1 add COLUMN (h INT generated always as (a+1) virtual), add INDEX idx (h), algorithm=inplace;
224 DROP TABLE t1;
225 # Scenario 14
226 CREATE TABLE t1 (col1 int(11) DEFAULT NULL, col2 int(11) DEFAULT NULL, col3 int(11) DEFAULT NULL, col4 int(11) DEFAULT NULL, col5 int(11) GENERATED ALWAYS AS (col4 * col2) VIRTUAL, col6 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, col7 int(11) GENERATED ALWAYS AS (col5 / col6) VIRTUAL, col8 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, col9 text, extra int(11) DEFAULT NULL) ROW_FORMAT=REDUNDANT;
227 Warnings:
228 Warning 1681 Integer display width is deprecated and will be removed in a future release.
229 Warning 1681 Integer display width is deprecated and will be removed in a future release.
230 Warning 1681 Integer display width is deprecated and will be removed in a future release.
231 Warning 1681 Integer display width is deprecated and will be removed in a future release.
232 Warning 1681 Integer display width is deprecated and will be removed in a future release.
233 Warning 1681 Integer display width is deprecated and will be removed in a future release.
234 Warning 1681 Integer display width is deprecated and will be removed in a future release.
235 Warning 1681 Integer display width is deprecated and will be removed in a future release.
236 Warning 1681 Integer display width is deprecated and will be removed in a future release.
237 ALTER TABLE t1 DROP COLUMN col7;
238 ALTER TABLE t1 DROP COLUMN col6, DROP COLUMN col9;
239 DROP TABLE t1;
240 # Scenario 15
241 create table t1(a text, b text, fulltext(a,b));
242 insert into t1 values('text1', 'text2');
243 insert into t1 values('test1', 'test2');
244 alter table t1 add fulltext(b);
245 drop table t1;
246 # Scenario 16
247 CREATE TABLE t1 (a serial key, b text) ROW_FORMAT=REDUNDANT;
248 INSERT INTO t1(b) VALUES(repeat("a short string - ",5));
249 INSERT INTO t1(b) VALUES(repeat("a long string - ",50));
250 INSERT INTO t1(b) SELECT b FROM t1;
251 ALTER TABLE t1 ADD COLUMN (c int), algorithm=INSTANT;
252 ALTER TABLE t1 ADD INDEX c (c), algorithm=INSTANT;
253 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
254 ALTER TABLE t1 ADD INDEX c (c), algorithm=INPLACE;
255 DROP TABLE t1;
256 # Scenario 17
257 CREATE TABLE t1 (c1 char(20), c2 char(20), c3 char(20), c4 char(20)) ROW_FORMAT=REDUNDANT;
258 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
259 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
260 ALTER TABLE test.t1 ADD c6 char(20), DROP COLUMN c3;
261 DROP TABLE t1;
262 # Scenario 18
263 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) ROW_FORMAT=REDUNDANT;
264 ALTER TABLE t1 DISCARD TABLESPACE;
265 ALTER TABLE t1 ADD FULLTEXT INDEX (ct), ALGORITHM=INPLACE;
266 Warnings:
267 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
268 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
269 ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1, ALGORITHM=INPLACE;
270 Warnings:
271 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
272 DROP TABLE t1;
273 # Scenario 19
274 CREATE TABLE t1 (a INT, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
275 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 FIRST;
276 ALTER TABLE t1 CHANGE aa e INT;
277 INSERT INTO t1 VALUES (1,1,1,1,1);
278 ALTER TABLE t1 ADD COLUMN a INT DEFAULT 1 FIRST, DROP COLUMN a, CHANGE b b INT;
279 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 AFTER a, DROP COLUMN b, CHANGE c c INT;
280 ALTER TABLE t1 CHANGE aa b INT;
281 DROP TABLE t1;
282 # Scenario 20
283 CREATE TABLE t1 (a varchar(512) NOT NULL, b varchar(512) NOT NULL, FULLTEXT KEY fts_idx (a)) ROW_FORMAT=REDUNDANT;
284 ALTER TABLE t1 DROP KEY fts_idx;
285 ALTER TABLE t1 ADD COLUMN b_hash char(64) AS(b) VIRTUAL NOT NULL;
286 DROP TABLE t1;
287 # Scenario 21
288 CREATE PROCEDURE test.fill_table (IN start INT) BEGIN SET @idx =start; WHILE (@idx > 0) DO INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa"); SET @idx = @idx - 1; END WHILE; END|
289 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=REDUNDANT;
290 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
291 call fill_table(400);
292 DROP PROCEDURE test.fill_table;
293 DROP TABLE t1;
294 # Scenario 22
295 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=REDUNDANT;
296 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
297 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
298 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
299 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
300 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
301 SELECT * FROM t1;
302 id v
303 1 aaaaaaaaaaaaa
304 2 aaaaaaaaaaaaa
305 3 aaaaaaaaaaaaa
306 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
307 DROP TABLE t1;
308 # Scenario 23
309 create table t1 (c1 char(10), c2 char(10));
310 # Metadata from INFORMATION_SCHEMA.TABLES
311 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
312 test/t1 5 0 0 2 2 2
313 # Metadata from INFORMATION_SCHEMA.COLUMNS
314 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
315 c1 0 13 16711934 0 0 0
316 c2 1 13 16711934 0 0 0
317 # DD Metadata of table
318 NAME SE_PRIVATE_DATA
319 t1 NULL
320 # DD Metadata of columns in table
321 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
322 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
323 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
324 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
325 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
326 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
327 insert into t1 values ("r1c1", "r1c2");
328 select * from t1;
329 c1 c2
330 r1c1 r1c2
331 alter table t1 add column c3 char(10) default "def_c3" after c1;
332 # Metadata from INFORMATION_SCHEMA.TABLES
333 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
334 test/t1 6 0 1 2 3 3
335 # Metadata from INFORMATION_SCHEMA.COLUMNS
336 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
337 c1 0 13 16711934 0 0 0
338 c3 1 13 16711934 1 1 0
339 c2 2 13 16711934 0 0 0
340 # DD Metadata of table
341 NAME SE_PRIVATE_DATA
342 t1 NULL
343 # DD Metadata of columns in table
344 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
345 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
346 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
347 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
348 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
349 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
350 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
351 insert into t1 values ("r2c1", "r2c3", "r2c2");
352 select * from t1;
353 c1 c3 c2
354 r1c1 def_c3 r1c2
355 r2c1 r2c3 r2c2
356 alter table t1 add column c3 char(10) default "newnewnew", drop column c3;
357 select * from t1;
358 c1 c2 c3
359 r1c1 r1c2 newnewnew
360 r2c1 r2c2 newnewnew
361 DROP TABLE t1;
362 # Scenario 24
363 CREATE TABLE t1 (c1 char(10)) ROW_FORMAT=REDUNDANT;
364 ALTER TABLE t1 ADD COLUMN c2 INT;
365 ALTER TABLE t1 DROP COLUMN c2;
366 INSERT INTO t1 (c1) VALUES("aaaa");
367 select * from t1;
368 c1
369 aaaa
370 check table t1;
371 Table Op Msg_type Msg_text
372 test.t1 check status OK
373 DROP TABLE t1;
374 # Scenario 25
375 CREATE TABLE t1 (c1 int, c2 char(10)) ROW_FORMAT=REDUNDANT PARTITION BY HASH (c1) PARTITIONS 2;
376 alter table t1 drop column c2;
377 DROP TABLE t1;
378 # Scenario 26
379 CREATE TABLE t1 (c1 char(10) KEY, c2 char(10)) ROW_FORMAT=REDUNDANT;
380 INSERT INTO t1 values ("row1_c1", "row1_c2");
381 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "default_c3", ALGORITHM=INSTANT;
382 INSERT INTO t1 values ("row2_c1", "row2_c2", "row2_c3");
383 ALTER TABLE t1 ADD COLUMN c4 char(20) DEFAULT NULL AFTER c1, ALGORITHM=INSTANT;
384 INSERT INTO t1 values ("row3_c1", "row3_c4", "row3_c2", "row3_c3");
385 ALTER TABLE t1 force;
386 SELECT * FROM t1;
387 c1 c4 c2 c3
388 row1_c1 NULL row1_c2 default_c3
389 row2_c1 NULL row2_c2 row2_c3
390 row3_c1 row3_c4 row3_c2 row3_c3
391 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
392 ALTER TABLE t1 ADD COLUMN c5 INT after c2, ALGORITHM=INSTANT;
393 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
394 DROP TABLE t1;
395 # Scenario 27
396 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT;
397 ALTER TABLE t1 ADD COLUMN c INT NOT NULL;
398 ALTER TABLE t1 ADD COLUMN d VARCHAR(100);
399 INSERT INTO t1 VALUES(0, 5, 20, 'Hello world');
400 DROP TABLE t1;
401 # Scenario 28
402 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT;
403 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
404 SELECT * from t1;
405 a b
406 1 1
407 2 2
408 3 3
409 4 4
410 5 5
411 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 100, ADD COLUMN d INT GENERATED ALWAYS AS ((c * 2 + b)) VIRTUAL, ADD COLUMN e VARCHAR(100) DEFAULT 'Hello world';
412 SELECT * from t1;
413 a b c d e
414 1 1 100 201 Hello world
415 2 2 100 202 Hello world
416 3 3 100 203 Hello world
417 4 4 100 204 Hello world
418 5 5 100 205 Hello world
419 UPDATE t1 SET c = 200 WHERE a > 3;
420 SELECT * from t1;
421 a b c d e
422 1 1 100 201 Hello world
423 2 2 100 202 Hello world
424 3 3 100 203 Hello world
425 4 4 200 404 Hello world
426 5 5 200 405 Hello world
427 DROP TABLE t1;
428 # Scenario 29
429 CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ROW_FORMAT=REDUNDANT;;
430 INSERT INTO t1 VALUES(0, 1);
431 SELECT * from t1;
432 c1 c2
433 1 1
434 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
435 SELECT * from t1;
436 c1 c2 c3
437 1 1 NULL
438 ALTER TABLE t1 ADD COLUMN c4 CHAR(100), ALGORITHM=INSTANT;
439 SELECT * from t1;
440 c1 c2 c3 c4
441 1 1 NULL NULL
442 UPDATE t1 SET c3 = 2;
443 SELECT * from t1;
444 c1 c2 c3 c4
445 1 1 2 NULL
446 DROP TABLE t1;
447 # Scenario 30
448 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;;
449 INSERT INTO t1 VALUES("r1c1", "r1c2");
450 SELECT * from t1;
451 c1 c2
452 r1c1 r1c2
453 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
454 SELECT * from t1;
455 c1 c2 c3
456 r1c1 r1c2 NULL
457 ALTER TABLE t1 ADD COLUMN c4 char(100), ALGORITHM=INSTANT;
458 SELECT * from t1;
459 c1 c2 c3 c4
460 r1c1 r1c2 NULL NULL
461 UPDATE t1 SET c3 = 2;
462 SELECT * from t1;
463 c1 c2 c3 c4
464 r1c1 r1c2 2 NULL
465 DROP TABLE t1;
466 # Scenario 31
467 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;
468 INSERT INTO t1 VALUES("r1c1", "r1c2");
469 ALTER TABLE t1 ADD COLUMN c3 char(10) default "def_c3";
470 SELECT * from t1;
471 c1 c2 c3
472 r1c1 r1c2 def_c3
473 UPDATE t1 SET c3 = "new_c3";
474 SELECT * from t1;
475 c1 c2 c3
476 r1c1 r1c2 new_c3
477 UPDATE t1 SET c3 = "new2_c3";
478 SELECT * from t1;
479 c1 c2 c3
480 r1c1 r1c2 new2_c3
481 DROP TABLE t1;
482 # Scenario 32
483 CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a, b)) ROW_FORMAT=REDUNDANT;
484 INSERT INTO t1 VALUES(0, 1), (1, 2), (2, 3), (3, 4);
485 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
486 CHECK TABLE t1;
487 Table Op Msg_type Msg_text
488 test.t1 check status OK
489 SELECT * FROM t1;
490 a b c
491 0 1 5
492 1 2 5
493 2 3 5
494 3 4 5
495 UPDATE t1 SET c = b WHERE b <= 2;
496 CHECK TABLE t1;
497 Table Op Msg_type Msg_text
498 test.t1 check status OK
499 SELECT * FROM t1;
500 a b c
501 0 1 1
502 1 2 2
503 2 3 5
504 3 4 5
505 DROP TABLE t1;
506 # Scenario 33
507 CREATE TABLE t1(c1 longtext) ROW_FORMAT=REDUNDANT;
508 INSERT INTO t1 VALUES (repeat('x', 8098));
509 SELECT SUBSTRING(c1, 1000, 32) FROM t1;
510 SUBSTRING(c1, 1000, 32)
511 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
512 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
513 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
514 SUBSTRING(c1, 1000, 32) c2
515 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
516 BEGIN;
517 UPDATE t1 SET c2 = 0;
518 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
519 SUBSTRING(c1, 1000, 32) c2
520 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0
521 ROLLBACK;
522 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
523 SUBSTRING(c1, 1000, 32) c2
524 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
525 DROP TABLE t1;
526 # Scenario 34
527 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;
528 INSERT INTO t1 VALUES("r1c1", "r1c2");
529 SELECT * FROM t1;
530 c1 c2
531 r1c1 r1c2
532 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
533 SELECT * FROM t1;
534 c1 c2 c3
535 r1c1 r1c2 c3_def
536 SET GLOBAL innodb_log_checkpoint_now = ON;
537 START TRANSACTION;
538 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
539 SELECT * FROM t1;
540 c1 c2 c3
541 r1c1 r1c2 c3_def
542 r2c1 r2c2 r2c3
543 SET SESSION DEBUG="+d,crash_commit_after";
544 COMMIT;
545 ERROR HY000: Lost connection to MySQL server during query
546 # restart
547 CHECK TABLE t1;
548 Table Op Msg_type Msg_text
549 test.t1 check status OK
550 SELECT * FROM t1;
551 c1 c2 c3
552 r1c1 r1c2 c3_def
553 r2c1 r2c2 r2c3
554 INSERT INTO t1 VALUES("r3c1", "r3c2", "r3c3");
555 START TRANSACTION;
556 UPDATE t1 SET c2 = "temp";
557 SELECT * FROM t1;
558 c1 c2 c3
559 r1c1 temp c3_def
560 r2c1 temp r2c3
561 r3c1 temp r3c3
562 SET SESSION DEBUG="+d,crash_commit_after";
563 COMMIT;
564 ERROR HY000: Lost connection to MySQL server during query
565 # restart
566 CHECK TABLE t1;
567 Table Op Msg_type Msg_text
568 test.t1 check status OK
569 SELECT * FROM t1;
570 c1 c2 c3
571 r1c1 temp c3_def
572 r2c1 temp r2c3
573 r3c1 temp r3c3
574 DROP TABLE t1;
575 # Scenario 35
576 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT;
577 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
578 ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10, algorithm=INSTANT;
579 CHECK TABLE t1;
580 Table Op Msg_type Msg_text
581 test.t1 check status OK
582 START TRANSACTION;
583 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
584 SELECT * FROM t1;
585 a b c1
586 1 1 10
587 2 2 10
588 3 3 10
589 4 4 10
590 5 5 10
591 6 6 20
592 7 7 20
593 SET SESSION DEBUG="+d,crash_commit_after";
594 COMMIT;
595 ERROR HY000: Lost connection to MySQL server during query
596 # restart
597 CHECK TABLE t1;
598 Table Op Msg_type Msg_text
599 test.t1 check status OK
600 SELECT * FROM t1;
601 a b c1
602 1 1 10
603 2 2 10
604 3 3 10
605 4 4 10
606 5 5 10
607 6 6 20
608 7 7 20
609 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
610 START TRANSACTION;
611 UPDATE t1 SET b = 10;
612 SELECT * FROM t1;
613 a b c1
614 1 10 10
615 2 10 10
616 3 10 10
617 4 10 10
618 5 10 10
619 6 10 20
620 7 10 20
621 8 10 20
622 9 10 20
623 SET SESSION DEBUG="+d,crash_commit_after";
624 COMMIT;
625 ERROR HY000: Lost connection to MySQL server during query
626 # restart
627 CHECK TABLE t1;
628 Table Op Msg_type Msg_text
629 test.t1 check status OK
630 SELECT * FROM t1;
631 a b c1
632 1 10 10
633 2 10 10
634 3 10 10
635 4 10 10
636 5 10 10
637 6 10 20
638 7 10 20
639 8 10 20
640 9 10 20
641 DROP TABLE t1;
642 # Scenario 36
643 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;
644 INSERT INTO t1 VALUES("r1c1", "r1c2");
645 SELECT * FROM t1;
646 c1 c2
647 r1c1 r1c2
648 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
649 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
650 SELECT * FROM t1;
651 c1 c2 c3
652 r1c1 r1c2 c3_def
653 r2c1 r2c2 r2c3
654 START TRANSACTION;
655 UPDATE t1 SET c2 = "temp";
656 SELECT * FROM t1;
657 c1 c2 c3
658 r1c1 temp c3_def
659 r2c1 temp r2c3
660 SET SESSION DEBUG="+d,crash_commit_after";
661 COMMIT;
662 ERROR HY000: Lost connection to MySQL server during query
663 # restart
664 CHECK TABLE t1;
665 Table Op Msg_type Msg_text
666 test.t1 check status OK
667 SELECT * FROM t1;
668 c1 c2 c3
669 r1c1 temp c3_def
670 r2c1 temp r2c3
671 DROP TABLE t1;
672 # Scenario 37
673 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;
674 INSERT INTO t1 VALUES("r1c1", "r1c2");
675 SELECT * FROM t1;
676 c1 c2
677 r1c1 r1c2
678 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
679 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
680 SELECT * FROM t1;
681 c1 c2 c3
682 r1c1 r1c2 c3_def
683 r2c1 r2c2 r2c3
684 SET GLOBAL innodb_log_checkpoint_now = ON;
685 START TRANSACTION;
686 UPDATE t1 SET c3 = "temp";
687 SELECT * FROM t1;
688 c1 c2 c3
689 r1c1 r1c2 temp
690 r2c1 r2c2 temp
691 SET SESSION DEBUG="+d,crash_commit_after";
692 COMMIT;
693 ERROR HY000: Lost connection to MySQL server during query
694 # restart
695 CHECK TABLE t1;
696 Table Op Msg_type Msg_text
697 test.t1 check status OK
698 SELECT * FROM t1;
699 c1 c2 c3
700 r1c1 r1c2 temp
701 r2c1 r2c2 temp
702 DROP TABLE t1;
703 # Scenario 38
704 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(col1 * 2) ( PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256) , PARTITION p2 VALUES LESS THAN (384) , PARTITION p3 VALUES LESS THAN MAXVALUE);;
705 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
706 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
707 CHECK TABLE t1;
708 Table Op Msg_type Msg_text
709 test.t1 check status OK
710 SELECT count(*) AS `Expect 4` FROM information_schema.innodb_tables WHERE instant_cols != 0;
711 Expect 4
712 0
713 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
714 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
715 Expect 3
716 0
717 CHECK TABLE t1;
718 Table Op Msg_type Msg_text
719 test.t1 check status OK
720 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
721 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
722 Expect 3
723 0
724 CHECK TABLE t1;
725 Table Op Msg_type Msg_text
726 test.t1 check status OK
727 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
728 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
729 Expect 3
730 0
731 CHECK TABLE t1;
732 Table Op Msg_type Msg_text
733 test.t1 check status OK
734 ALTER TABLE t1 ADD KEY idx3(col3);
735 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
736 Expect 3
737 0
738 CHECK TABLE t1;
739 Table Op Msg_type Msg_text
740 test.t1 check status OK
741 SELECT * FROM t1;
742 col1 col2 col3 col4 col5 col6
743 1 2 3 abcdefg def NULL
744 100 200 300 qwerty def NULL
745 200 300 400 asdfg def NULL
746 DROP TABLE t1;
747 # Scenario 39
748 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
749 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
750 SELECT * FROM t1;
751 c1 c2 c3
752 1 r1c2 r1c3
753 100 r2c2 r2c3
754 200 r3c2 r3c3
755 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
756 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
757 test/t1#p#p0 6 0 3 3 3
758 test/t1#p#p1 6 0 3 3 3
759 test/t1#p#p2 6 0 3 3 3
760 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
761 SELECT * FROM t1;
762 c1 c2 c3 col4
763 1 r1c2 r1c3 def_4
764 100 r2c2 r2c3 def_4
765 200 r3c2 r3c3 def_4
766 CHECK TABLE t1;
767 Table Op Msg_type Msg_text
768 test.t1 check status OK
769 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
770 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
771 test/t1#p#p0 7 1 3 4 4
772 test/t1#p#p1 7 1 3 4 4
773 test/t1#p#p2 7 1 3 4 4
774 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
775 SELECT * FROM t1;
776 c1 c2 c3 col4
777 1 r1c2 r1c3 def_4
778 100 r2c2 r2c3 def_4
779 200 r3c2 r3c3 def_4
780 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
781 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
782 test/t1#p#p0_a 7 1 3 4 4
783 test/t1#p#p0_b 7 1 3 4 4
784 test/t1#p#p1 7 1 3 4 4
785 test/t1#p#p2 7 1 3 4 4
786 CHECK TABLE t1;
787 Table Op Msg_type Msg_text
788 test.t1 check status OK
789 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
790 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
791 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
792 test/t1#p#p0_a 7 1 3 4 4
793 test/t1#p#p0_b 7 1 3 4 4
794 test/t1#p#p1 7 1 3 4 4
795 test/t1#p#p2 7 1 3 4 4
796 CHECK TABLE t1;
797 Table Op Msg_type Msg_text
798 test.t1 check status OK
799 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
800 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
801 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
802 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
803 test/t1#p#p0_a 7 1 3 4 4
804 test/t1#p#p0_b 7 1 3 4 4
805 test/t1#p#p1 7 1 3 4 4
806 test/t1#p#p2 7 1 3 4 4
807 CHECK TABLE t1;
808 Table Op Msg_type Msg_text
809 test.t1 check status OK
810 ALTER TABLE t1 ADD KEY idx3(c3);
811 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
812 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
813 test/t1#p#p0_a 7 1 3 4 4
814 test/t1#p#p0_b 7 1 3 4 4
815 test/t1#p#p1 7 1 3 4 4
816 test/t1#p#p2 7 1 3 4 4
817 CHECK TABLE t1;
818 Table Op Msg_type Msg_text
819 test.t1 check status OK
820 SELECT * FROM t1;
821 c1 c2 c3 col4
822 1 r1c2 r1c3 def_4
823 100 r2c2 r2c3 def_4
824 200 r3c2 r3c3 def_4
825 DROP TABLE t1;
826 # Scenario 40
827 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
828 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
829 SELECT * FROM t1;
830 c1 c2 c3
831 1 r1c2 r1c3
832 100 r2c2 r2c3
833 200 r3c2 r3c3
834 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
835 CHECK TABLE t1;
836 Table Op Msg_type Msg_text
837 test.t1 check status OK
838 SELECT * FROM t1;
839 c1 c2 c3 col4
840 1 r1c2 r1c3 def_4
841 100 r2c2 r2c3 def_4
842 200 r3c2 r3c3 def_4
843 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
844 CHECK TABLE t1;
845 Table Op Msg_type Msg_text
846 test.t1 check status OK
847 SELECT * FROM t1;
848 c1 c2 c3 col4
849 1 r1c2 r1c3 def_4
850 100 r2c2 r2c3 def_4
851 200 r3c2 r3c3 def_4
852 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
853 CHECK TABLE t1;
854 Table Op Msg_type Msg_text
855 test.t1 check status OK
856 SELECT * FROM t1;
857 c1 c2 c3 col4
858 1 r1c2 r1c3 def_4
859 100 r2c2 r2c3 def_4
860 200 r3c2 r3c3 def_4
861 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
862 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
863 CHECK TABLE t1;
864 Table Op Msg_type Msg_text
865 test.t1 check status OK
866 SELECT * FROM t1;
867 c1 c2 c3 col4
868 1 r1c2 r1c3 def_4
869 100 r2c2 r2c3 def_4
870 200 r3c2 r3c3 def_4
871 ALTER TABLE t1 ADD KEY idx3(c3);
872 CHECK TABLE t1;
873 Table Op Msg_type Msg_text
874 test.t1 check status OK
875 SELECT * FROM t1;
876 c1 c2 c3 col4
877 1 r1c2 r1c3 def_4
878 100 r2c2 r2c3 def_4
879 200 r3c2 r3c3 def_4
880 DROP TABLE t1;
881 # Scenario 41
882 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256), PARTITION p2 VALUES LESS THAN (384), PARTITION p3 VALUES LESS THAN MAXVALUE);;
883 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
884 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
885 CHECK TABLE t1;
886 Table Op Msg_type Msg_text
887 test.t1 check status OK
888 SELECT * FROM t1;
889 col1 col2 col3 col4 col5 col6
890 1 2 3 abcdefg def NULL
891 100 200 300 qwerty def NULL
892 200 300 400 asdfg def NULL
893 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
894 CHECK TABLE t1;
895 Table Op Msg_type Msg_text
896 test.t1 check status OK
897 SELECT * FROM t1;
898 col1 col2 col3 col4 col5 col6
899 1 2 3 abcdefg def NULL
900 100 200 300 qwerty def NULL
901 200 300 400 asdfg def NULL
902 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
903 CHECK TABLE t1;
904 Table Op Msg_type Msg_text
905 test.t1 check status OK
906 SELECT * FROM t1;
907 col1 col2 col3 col4 col5 col6
908 1 2 3 abcdefg def NULL
909 100 200 300 qwerty def NULL
910 200 300 400 asdfg def NULL
911 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
912 CHECK TABLE t1;
913 Table Op Msg_type Msg_text
914 test.t1 check status OK
915 SELECT * FROM t1;
916 col1 col2 col3 col4 col5 col6
917 1 2 3 abcdefg def NULL
918 100 200 300 qwerty def NULL
919 200 300 400 asdfg def NULL
920 ALTER TABLE t1 ADD KEY idx3(col3);
921 CHECK TABLE t1;
922 Table Op Msg_type Msg_text
923 test.t1 check status OK
924 SELECT * FROM t1;
925 col1 col2 col3 col4 col5 col6
926 1 2 3 abcdefg def NULL
927 100 200 300 qwerty def NULL
928 200 300 400 asdfg def NULL
929 DROP TABLE t1;
930 # Scenario 42
931 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
932 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
933 SELECT * FROM t1;
934 c1 c2 c3
935 1 r1c2 r1c3
936 100 r2c2 r2c3
937 200 r3c2 r3c3
938 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
939 CHECK TABLE t1;
940 Table Op Msg_type Msg_text
941 test.t1 check status OK
942 SELECT * FROM t1;
943 c1 c2 c3 col4
944 1 r1c2 r1c3 def_4
945 100 r2c2 r2c3 def_4
946 200 r3c2 r3c3 def_4
947 ALTER TABLE t1 ALGORITHM INSTANT, DROP COLUMN c2;
948 CHECK TABLE t1;
949 Table Op Msg_type Msg_text
950 test.t1 check status OK
951 SELECT * FROM t1;
952 c1 c3 col4
953 1 r1c3 def_4
954 100 r2c3 def_4
955 200 r3c3 def_4
956 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
957 CHECK TABLE t1;
958 Table Op Msg_type Msg_text
959 test.t1 check status OK
960 SELECT * FROM t1;
961 c1 c3 col4
962 1 r1c3 def_4
963 100 r2c3 def_4
964 200 r3c3 def_4
965 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
966 CHECK TABLE t1;
967 Table Op Msg_type Msg_text
968 test.t1 check status OK
969 SELECT * FROM t1;
970 c1 c3 col4
971 1 r1c3 def_4
972 100 r2c3 def_4
973 200 r3c3 def_4
974 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
975 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
976 CHECK TABLE t1;
977 Table Op Msg_type Msg_text
978 test.t1 check status OK
979 SELECT * FROM t1;
980 c1 c3 col4
981 1 r1c3 def_4
982 100 r2c3 def_4
983 200 r3c3 def_4
984 ALTER TABLE t1 ADD KEY idx3(c3);
985 CHECK TABLE t1;
986 Table Op Msg_type Msg_text
987 test.t1 check status OK
988 SELECT * FROM t1;
989 c1 c3 col4
990 1 r1c3 def_4
991 100 r2c3 def_4
992 200 r3c3 def_4
993 DROP TABLE t1;
994 # Scenario 43
995 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT PARTITION BY HASH(a) PARTITIONS 3;;
996 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8);
997 SELECT * FROM t1;
998 a b
999 3 3
1000 6 6
1001 1 1
1002 4 4
1003 7 7
1004 2 2
1005 5 5
1006 8 8
1007 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
1008 CHECK TABLE t1;
1009 Table Op Msg_type Msg_text
1010 test.t1 check status OK
1011 SELECT * FROM t1;
1012 a b c
1013 3 3 5
1014 6 6 5
1015 1 1 5
1016 4 4 5
1017 7 7 5
1018 2 2 5
1019 5 5 5
1020 8 8 5
1021 ALTER TABLE t1 ADD PARTITION PARTITIONS 10;
1022 CHECK TABLE t1;
1023 Table Op Msg_type Msg_text
1024 test.t1 check status OK
1025 SELECT * FROM t1;
1026 a b c
1027 1 1 5
1028 2 2 5
1029 3 3 5
1030 4 4 5
1031 5 5 5
1032 6 6 5
1033 7 7 5
1034 8 8 5
1035 ALTER TABLE t1 ADD KEY(b);
1036 CHECK TABLE t1;
1037 Table Op Msg_type Msg_text
1038 test.t1 check status OK
1039 SELECT * FROM t1;
1040 a b c
1041 1 1 5
1042 2 2 5
1043 3 3 5
1044 4 4 5
1045 5 5 5
1046 6 6 5
1047 7 7 5
1048 8 8 5
1049 DROP TABLE t1;
1050 # Scenario 44
1051 CREATE TABLE t1 (a BLOB, b BLOB, c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, h VARCHAR(10) DEFAULT NULL) ROW_FORMAT=REDUNDANT;
1052 INSERT INTO t1 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk");
1053 CREATE INDEX idx ON t1(c(100));
1054 SELECT length(c) FROM t1;
1055 length(c)
1056 32000
1057 START TRANSACTION;
1058 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
1059 ROLLBACK;
1060 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
1061 START TRANSACTION;
1062 UPDATE t1 SET a = REPEAT('m', 16000) WHERE a like "aaa%";
1063 ROLLBACK;
1064 DROP TABLE t1;
1065 # Scenario 45
1066 CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)) ROW_FORMAT=REDUNDANT;
1067 INSERT INTO t1 VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT);
1068 INSERT INTO t1 VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT);
1069 INSERT INTO t1 VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT);
1070 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;
1071 ALTER TABLE t1 DROP COLUMN p, ADD COLUMN s VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), algorithm=inplace;
1072 DROP TABLE t1;
1073 # Scenario 46
1074 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c INT) ROW_FORMAT=REDUNDANT;
1075 INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2), (3, 3, 3), (6, 6, 6);
1076 ALTER TABLE t1 ADD COLUMN d INT DEFAULT 10;
1077 SELECT * FROM t1;
1078 a b c d
1079 1 1 1 10
1080 2 2 2 10
1081 3 3 3 10
1082 6 6 6 10
1083 SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL altered WAIT_FOR dmls_done';
1084 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;;
1085 SET DEBUG_SYNC = 'now WAIT_FOR altered';
1086 INSERT INTO t1(a, b, c) VALUES(7, 7, 7);
1087 UPDATE t1 SET a = 10 WHERE a = 1;
1088 DELETE FROM t1 WHERE a = 2;
1089 UPDATE t1 SET c = 10 WHERE a = 3;
1090 UPDATE t1 SET d = 20 WHERE a = 5;
1091 UPDATE t1 SET a = 8, d = 20 WHERE a = 6;
1092 SET DEBUG_SYNC = 'now SIGNAL dmls_done';
1093 SELECT * FROM t1;
1094 a b d
1095 3 3 10
1096 7 7 10
1097 8 6 20
1098 10 1 10
1099 DROP TABLE t1;
1100 # Scenario 47
1101 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (20));
1102 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
1103 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
1104 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
1105 c 2 6 1027 4 1 80000064 1 0 4
1106 c 2 6 1027 4 1 80000064 1 0 4
1107 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p21 VALUES LESS THAN(15), PARTITION p22 VALUES LESS THAN(20));
1108 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
1109 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
1110 c 2 6 1027 4 1 80000064 1 0 4
1111 c 2 6 1027 4 1 80000064 1 0 4
1112 c 2 6 1027 4 1 80000064 1 0 4
1113 DROP TABLE t1;
1114 # Scenario 48
1115 CREATE TABLE t1 (c1 integer PRIMARY KEY AUTO_INCREMENT, c2 integer NULL UNIQUE) ROW_FORMAT=REDUNDANT;
1116 ALTER TABLE t1 ADD COLUMN c3 int;
1117 ALTER TABLE t1 DROP COLUMN c3;
1118 ALTER TABLE t1 ADD COLUMN c4 int DEFAULT 1;
1119 ALTER TABLE t1 CHANGE COLUMN c4 c4_new int NULL DEFAULT 1;
1120 ALTER TABLE t1 CHANGE COLUMN c4_new c4_new int NULL DEFAULT 1;
1121 DROP TABLE t1;
1122 # Scenario 49
1123 CREATE TABLE t1 (c1 char(20) KEY, c2 enum('a', 'b', 'c')) ROW_FORMAT=REDUNDANT;
1124 INSERT INTO t1 values ("row1_c1", "a");
1125 SELECT * from t1;
1126 c1 c2
1127 row1_c1 a
1128 ALTER TABLE t1 ADD COLUMN c3 enum('x', 'y', 'z'), ALGORITHM=INSTANT;
1129 SELECT * from t1;
1130 c1 c2 c3
1131 row1_c1 a NULL
1132 INSERT INTO t1 values ("row2_c2", "b", "y");
1133 SELECT * from t1;
1134 c1 c2 c3
1135 row1_c1 a NULL
1136 row2_c2 b y
1137 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1138 SELECT * from t1;
1139 c1 c3
1140 row1_c1 NULL
1141 row2_c2 y
1142 DROP TABLE t1;
1143 # Scenario 50
1144 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=REDUNDANT;
1145 ALTER TABLE t1 DROP COLUMN c2;
1146 truncate table t1;
1147 truncate table t1;
1148 truncate table t1;
1149 DROP TABLE t1;
1150 # Scenario 51
1151 CREATE TABLE t1 (c1 int KEY, c2 int) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20), PARTITION p2 VALUES LESS THAN (30));
1152 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1153 ALTER TABLE t1 DROP PARTITION p1;
1154 DROP TABLE t1;
1155 # Scenario 52
1156 CREATE TABLE t1(c1 int, c2 int, c3 int, c4 DOUBLE GENERATED ALWAYS AS (c1+c2) STORED, c5 DOUBLE GENERATED ALWAYS AS (c1-c2) VIRTUAL) ROW_FORMAT=REDUNDANT;;
1157 INSERT INTO t1(c1,c2,c3) VALUES (1,1,1);
1158 SELECT * FROM t1;
1159 c1 c2 c3 c4 c5
1160 1 1 1 2 0
1161 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1162 ERROR HY000: Column 'c2' has a generated column dependency.
1163 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
1164 SELECT * FROM t1;
1165 c1 c2 c4 c5
1166 1 1 2 0
1167 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
1168 SELECT * FROM t1;
1169 c1 c2 c5
1170 1 1 0
1171 ALTER TABLE t1 ADD COLUMN c6 DOUBLE GENERATED ALWAYS AS (2*c1+c2) VIRTUAL, ALGORITHM=INSTANT;
1172 SELECT * FROM t1;
1173 c1 c2 c5 c6
1174 1 1 0 3
1175 ALTER TABLE t1 ADD COLUMN c7 DOUBLE GENERATED ALWAYS AS (c1+2*c2) STORED, ALGORITHM=INSTANT;
1176 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
1177 SELECT * FROM t1;
1178 c1 c2 c5 c6
1179 1 1 0 3
1180 ALTER TABLE t1 ADD COLUMN c8 DOUBLE GENERATED ALWAYS AS (c1+2*c2) VIRTUAL FIRST, ALGORITHM=INSTANT;
1181 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
1182 SELECT * FROM t1;
1183 c1 c2 c5 c6
1184 1 1 0 3
1185 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
1186 SELECT * FROM t1;
1187 c1 c2 c3 c5 c6
1188 1 1 NULL 0 3
1189 ALTER TABLE t1 DROP column c3, add column c10 int as (c1+c2) virtual, ALGORITHM=INSTANT;
1190 SELECT * FROM t1;
1191 c1 c2 c5 c6 c10
1192 1 1 0 3 2
1193 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
1194 SELECT * FROM t1;
1195 c1 c2 c3 c5 c6 c10
1196 1 1 NULL 0 3 2
1197 ALTER TABLE t1 DROP column c3, drop column c6, ALGORITHM=INSTANT;
1198 SELECT * FROM t1;
1199 c1 c2 c5 c10
1200 1 1 0 2
1201 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
1202 SELECT * FROM t1;
1203 c1 c2 c3 c5 c10
1204 1 1 NULL 0 2
1205 ALTER TABLE t1 DROP column c3, add column c11 int as (c1+c2) virtual first, ALGORITHM=INSTANT;
1206 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
1207 SELECT * FROM t1;
1208 c1 c2 c3 c5 c10
1209 1 1 NULL 0 2
1210 DROP TABLE t1;
1211 # Scenario 53
1212 # Table with functional index.
1213 CREATE TABLE t1 (id int NOT NULL AUTO_INCREMENT KEY, c1 varchar(10) DEFAULT NULL, c2 varchar(10) DEFAULT NULL, INDEX idx((concat(c1, "c1")))) ROW_FORMAT=REDUNDANT;;
1214 INSERT INTO t1(c1, c2) values("abc", "def");
1215 SELECT * FROM t1;
1216 id c1 c2
1217 1 abc def
1218 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual after id, ALGORITHM=INSTANT;
1219 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
1220 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual, ALGORITHM=INSTANT;
1221 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
1222 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1223 SELECT * FROM t1;
1224 id c1
1225 1 abc
1226 DROP TABLE t1;
1227 # Scenarion 54
1228 CREATE TABLE t1 (c1 TEXT, c2 INT, PRIMARY KEY (c1(1))) ROW_FORMAT=REDUNDANT;;
1229 SELECT * FROM t1;
1230 c1 c2
1231 REPLACE INTO t1(c1) VALUES ('');
1232 REPLACE INTO t1(c1) VALUES ('');
1233 SELECT * From t1;
1234 c1 c2
1235 NULL
1236 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1237 REPLACE INTO t1(c1) VALUES ('');
1238 DROP TABLE t1;
1239 # Scenario 55
1240 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20));
1241 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
1242 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1243 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
1244 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
1245 ALTER TABLE t1 ADD PARTITION (PARTITION p5 VALUES LESS THAN (60));
1246 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
1247 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1248 ALTER TABLE t1 REORGANIZE PARTITION p5 INTO
1249 (
1250 PARTITION p51 VALUES LESS THAN (50),
1251 PARTITION p52 VALUES LESS THAN (60)
1252 );
1253 DROP TABLE t1;
1254 # Scenario 56
1255 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT, PRIMARY KEY(c1, c4(10))) ROW_FORMAT=REDUNDANT;;
1256 INSERT INTO t1 VALUES (1, 2, 3, "abcdefghijklmnop");
1257 SELECT * FROM t1;
1258 c1 c2 c3 c4
1259 1 2 3 abcdefghijklmnop
1260 ALTER TABLE t1 ADD COLUMN c5 INT, ALGORITHM=INSTANT;
1261 SELECT * FROM t1;
1262 c1 c2 c3 c4 c5
1263 1 2 3 abcdefghijklmnop NULL
1264 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1265 SELECT * FROM t1;
1266 c1 c3 c4 c5
1267 1 3 abcdefghijklmnop NULL
1268 DROP TABLE t1;
1269 # Scenario 57
1270 CREATE TABLE t1 (c1 CHAR(20), c2 CHAR(20), PRIMARY KEY PK(c1(4))) ROW_FORMAT=REDUNDANT;;
1271 INSERT INTO t1 VALUES ("r1c1", "r1c2");
1272 SELECT * FROM t1;
1273 c1 c2
1274 r1c1 r1c2
1275 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "c3_def", ALGORITHM=INSTANT;
1276 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
1277 SELECT * FROM t1;
1278 c1 c2 c3
1279 r1c1 r1c2 c3_def
1280 r2c1 r2c2 r2c3
1281 DROP TABLE t1;
1282 # Scenario 58
1283 # Validating record in table with INSTANT ADD/DROP columns
1284 CREATE TABLE t1 (c1 CHAR(10), c2 CHAR(10)) ROW_FORMAT=REDUNDANT;
1285 INSERT INTO t1 VALUES ("r1c1", "r1c2");
1286 ALTER TABLE t1 ADD COLUMN c3 CHAR(10), ALGORITHM=INSTANT;
1287 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
1288 ALTER TABLE t1 DROP COLUMN c1, ALGORITHM=INSTANT;
1289 INSERT INTO t1 (c2) VALUES ("r3c2");
1290 ALTER TABLE t1 ADD COLUMN c4 CHAR(10), ALGORITHM=INSTANT;
1291 INSERT INTO t1 (c2) VALUES ("r4c2");
1292 SELECT * From t1;
1293 c2 c3 c4
1294 r1c2 NULL NULL
1295 r2c2 r2c3 NULL
1296 r3c2 NULL NULL
1297 r4c2 NULL NULL
1298 DROP TABLE t1;
1299 CREATE TABLE t1 (id INT KEY, c2 CHAR(10)) ROW_FORMAT=REDUNDANT PARTITION BY RANGE( id ) (PARTITION P0 VALUES LESS THAN (40), PARTITION P1 VALUES LESS THAN (50));
1300 INSERT INTO t1 VALUES(1,"r1c2");
1301 INSERT INTO t1 VALUES(2,"r2c2");
1302 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1303 ALTER TABLE t1 ADD COLUMN c2 CHAR(10), ALGORITHM=INSTANT;
1304 ALTER TABLE t1 REORGANIZE PARTITION P0, P1 INTO (PARTITION P1 VALUES LESS THAN (50));
1305 SELECT * FROM t1;
1306 id c2
1307 1 NULL
1308 2 NULL
1309 DROP TABLE t1;
1310 # Scenario 59
1311 # A scenario when #fields were not updated correctly in REDUNDANT record for not-inplace update.
1312 CREATE TABLE t1 (c1 VARCHAR(20), c2 CHAR(20)) ROW_FORMAT=REDUNDANT;
1313 INSERT INTO t1 VALUES ("r1c1", "r1c2");
1314 SELECT * FROM t1;
1315 c1 c2
1316 r1c1 r1c2
1317 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
1318 UPDATE t1 SET c1="r1c11111111111";
1319 SELECT * FROM t1;
1320 c1
1321 r1c11111111111
1322 DROP TABLE t1;
1323 # Scenario 60
1324 # When a new partition is added in a table with instant columns and virtual column,
1325 # during inheriting INSTANT metadat for new partitions, virtual columns were not skipped.
1326 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300));
1327 ALTER TABLE t1 ADD COLUMN col5 INT, ADD COLUMN col6 INT GENERATED ALWAYS AS (col5 + 1) VIRTUAL, ALGORITHM=INSTANT;
1328 ALTER TABLE t1 DROP COLUMN col2, algorithm=INSTANT;
1329 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO(PARTITION p21 VALUES LESS THAN (250), PARTITION p22 VALUES LESS THAN (300));
1330 DROP TABLE t1;
1331 # Scenario 61
1332 # When a table is truncated, it's instant metadata is reset. It shall
1333 # also reset instant metadata of columns.
1334 CREATE TABLE t1 (c1 VARCHAR(1008)) ROW_FORMAT=REDUNDANT;
1335 ALTER TABLE t1 ADD COLUMN c2 INT;
1336 TRUNCATE TABLE t1;
1337 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),1);
1338 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),2);
1339 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),3);
1340 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),4);
1341 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),5);
1342 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),6);
1343 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),7);
1344 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),8);
1345 ALTER TABLE t1 ADD COLUMN c3 VARCHAR(500);
1346 UPDATE t1 SET c3 = CONCAT(REPEAT('c', 500));
1347 DROP TABLE t1;
1348 # Scenario 62
1349 # While updating lob columns on a rebuilt table which had INSTANT cols
1350 CREATE TABLE t1 (c1 CHAR(10)) ROW_FORMAT=REDUNDANT;
1351 INSERT INTO t1 VALUES ("r1c1");
1352 SELECT * FROM t1;
1353 c1
1354 r1c1
1355 ALTER TABLE t1 ADD COLUMN c2 INT;
1356 ALTER TABLE t1 DROP COLUMN c2;
1357 ALTER TABLE t1 ADD COLUMN c3 TEXT;
1358 UPDATE t1 SET c3 = CONCAT(REPEAT('z', 8204));
1359 ALTER TABLE t1 ADD PRIMARY KEY (c3(10)), ADD FULLTEXT KEY idx (c3);
1360 Warnings:
1361 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
1362 SELECT * FROM t1;
1363 c1 c3
1364 r1c1 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz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zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
1365 DROP TABLE t1;
1366 # Scenario 63
1367 # Truncate of a partition/partition table
1368 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (20));
1369 # DD Metadata of columns in table
1370 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1371 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
1372 b 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1373 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1374 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
1375 # DD Metadata of partitions in table
1376 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1377 p1 10 NULL
1378 p2 20 NULL
1379 # Metadata from INFORMATION_SCHEMA.TABLES
1380 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1381 test/t1#p#p1 5 0 0 2 2 2
1382 # Metadata from INFORMATION_SCHEMA.COLUMNS
1383 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1384 a 0 6 1283 0 0 0
1385 b 1 6 1027 0 0 0
1386 # Metadata from INFORMATION_SCHEMA.TABLES
1387 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1388 test/t1#p#p2 5 0 0 2 2 2
1389 # Metadata from INFORMATION_SCHEMA.COLUMNS
1390 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1391 a 0 6 1283 0 0 0
1392 b 1 6 1027 0 0 0
1393 INSERT INTO t1 values (5, 50), (15, 150);
1394 SELECT * FROM t1 PARTITION (p1);
1395 a b
1396 5 50
1397 SELECT * FROM t1 PARTITION (p2);
1398 a b
1399 15 150
1400 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
1401 # DD Metadata of columns in table
1402 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1403 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
1404 b 2 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
1405 c 3 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
1406 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1407 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1408 # DD Metadata of partitions in table
1409 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1410 p1 10 NULL
1411 p2 20 NULL
1412 # Metadata from INFORMATION_SCHEMA.TABLES
1413 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1414 test/t1#p#p1 6 0 1 2 3 3
1415 # Metadata from INFORMATION_SCHEMA.COLUMNS
1416 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1417 a 0 6 1283 0 0 0
1418 b 1 6 1027 0 0 0
1419 c 2 6 1027 1 1 0
1420 # Metadata from INFORMATION_SCHEMA.TABLES
1421 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1422 test/t1#p#p2 6 0 1 2 3 3
1423 # Metadata from INFORMATION_SCHEMA.COLUMNS
1424 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1425 a 0 6 1283 0 0 0
1426 b 1 6 1027 0 0 0
1427 c 2 6 1027 1 1 0
1428 ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN(30));
1429 INSERT INTO t1 (a, b) values (25, 250);
1430 SELECT * FROM t1 PARTITION (p1);
1431 a b c
1432 5 50 100
1433 SELECT * FROM t1 PARTITION (p2);
1434 a b c
1435 15 150 100
1436 SELECT * FROM t1 PARTITION (p3);
1437 a b c
1438 25 250 100
1439 alter table t1 drop column b, algorithm=instant;
1440 # DD Metadata of columns in table
1441 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1442 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
1443 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
1444 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1445 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1446 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;version_dropped=2;
1447 # DD Metadata of partitions in table
1448 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1449 p1 10 NULL
1450 p2 20 NULL
1451 p3 30 NULL
1452 # Metadata from INFORMATION_SCHEMA.TABLES
1453 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1454 test/t1#p#p1 5 0 2 2 2 3
1455 # Metadata from INFORMATION_SCHEMA.COLUMNS
1456 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1457 a 0 6 1283 0 0 0
1458 c 1 6 1027 1 1 0
1459 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1460 # Metadata from INFORMATION_SCHEMA.TABLES
1461 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1462 test/t1#p#p2 5 0 2 2 2 3
1463 # Metadata from INFORMATION_SCHEMA.COLUMNS
1464 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1465 a 0 6 1283 0 0 0
1466 c 1 6 1027 1 1 0
1467 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1468 # Metadata from INFORMATION_SCHEMA.TABLES
1469 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1470 test/t1#p#p3 5 0 2 2 2 3
1471 # Metadata from INFORMATION_SCHEMA.COLUMNS
1472 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1473 a 0 6 1283 0 0 0
1474 c 1 6 1027 1 1 0
1475 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1476 SELECT * FROM t1;
1477 a c
1478 5 100
1479 15 100
1480 25 100
1481 ALTER TABLE t1 TRUNCATE PARTITION p1;
1482 # DD Metadata of columns in table
1483 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1484 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
1485 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
1486 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1487 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1488 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
1489 # DD Metadata of partitions in table
1490 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1491 p1 10 NULL
1492 p2 20 NULL
1493 p3 30 NULL
1494 # Metadata from INFORMATION_SCHEMA.TABLES
1495 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1496 test/t1#p#p1 5 0 2 2 2 3
1497 # Metadata from INFORMATION_SCHEMA.COLUMNS
1498 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1499 a 0 6 1283 0 0 0
1500 c 1 6 1027 1 1 0
1501 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1502 # Metadata from INFORMATION_SCHEMA.TABLES
1503 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1504 test/t1#p#p2 5 0 2 2 2 3
1505 # Metadata from INFORMATION_SCHEMA.COLUMNS
1506 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1507 a 0 6 1283 0 0 0
1508 c 1 6 1027 1 1 0
1509 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1510 # Metadata from INFORMATION_SCHEMA.TABLES
1511 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1512 test/t1#p#p3 5 0 2 2 2 3
1513 # Metadata from INFORMATION_SCHEMA.COLUMNS
1514 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1515 a 0 6 1283 0 0 0
1516 c 1 6 1027 1 1 0
1517 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1518 SELECT * FROM t1;
1519 a c
1520 15 100
1521 25 100
1522 ALTER TABLE t1 TRUNCATE PARTITION p3;
1523 # DD Metadata of columns in table
1524 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1525 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
1526 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
1527 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1528 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1529 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
1530 # DD Metadata of partitions in table
1531 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1532 p1 10 NULL
1533 p2 20 NULL
1534 p3 30 NULL
1535 # Metadata from INFORMATION_SCHEMA.TABLES
1536 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1537 test/t1#p#p1 5 0 2 2 2 3
1538 # Metadata from INFORMATION_SCHEMA.COLUMNS
1539 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1540 a 0 6 1283 0 0 0
1541 c 1 6 1027 1 1 0
1542 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1543 # Metadata from INFORMATION_SCHEMA.TABLES
1544 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1545 test/t1#p#p2 5 0 2 2 2 3
1546 # Metadata from INFORMATION_SCHEMA.COLUMNS
1547 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1548 a 0 6 1283 0 0 0
1549 c 1 6 1027 1 1 0
1550 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1551 # Metadata from INFORMATION_SCHEMA.TABLES
1552 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1553 test/t1#p#p3 5 0 2 2 2 3
1554 # Metadata from INFORMATION_SCHEMA.COLUMNS
1555 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1556 a 0 6 1283 0 0 0
1557 c 1 6 1027 1 1 0
1558 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
1559 SELECT * FROM t1;
1560 a c
1561 15 100
1562 TRUNCATE TABLE t1;
1563 # DD Metadata of columns in table
1564 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1565 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
1566 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1567 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1568 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
1569 # DD Metadata of partitions in table
1570 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1571 p1 10 NULL
1572 p2 20 NULL
1573 p3 30 NULL
1574 # Metadata from INFORMATION_SCHEMA.TABLES
1575 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1576 test/t1#p#p1 5 0 0 2 2 2
1577 # Metadata from INFORMATION_SCHEMA.COLUMNS
1578 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1579 a 0 6 1283 0 0 0
1580 c 1 6 1027 0 0 0
1581 # Metadata from INFORMATION_SCHEMA.TABLES
1582 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1583 test/t1#p#p2 5 0 0 2 2 2
1584 # Metadata from INFORMATION_SCHEMA.COLUMNS
1585 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1586 a 0 6 1283 0 0 0
1587 c 1 6 1027 0 0 0
1588 # Metadata from INFORMATION_SCHEMA.TABLES
1589 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1590 test/t1#p#p3 5 0 0 2 2 2
1591 # Metadata from INFORMATION_SCHEMA.COLUMNS
1592 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1593 a 0 6 1283 0 0 0
1594 c 1 6 1027 0 0 0
1595 SELECT * FROM t1;
1596 a c
1597 TRUNCATE TABLE t1;
1598 ALTER TABLE t1 TRUNCATE PARTITION p1;
1599 ALTER TABLE t1 TRUNCATE PARTITION p3;
1600 # DD Metadata of columns in table
1601 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1602 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
1603 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1604 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1605 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
1606 # DD Metadata of partitions in table
1607 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1608 p1 10 NULL
1609 p2 20 NULL
1610 p3 30 NULL
1611 # Metadata from INFORMATION_SCHEMA.TABLES
1612 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1613 test/t1#p#p1 5 0 0 2 2 2
1614 # Metadata from INFORMATION_SCHEMA.COLUMNS
1615 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1616 a 0 6 1283 0 0 0
1617 c 1 6 1027 0 0 0
1618 # Metadata from INFORMATION_SCHEMA.TABLES
1619 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1620 test/t1#p#p2 5 0 0 2 2 2
1621 # Metadata from INFORMATION_SCHEMA.COLUMNS
1622 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1623 a 0 6 1283 0 0 0
1624 c 1 6 1027 0 0 0
1625 # Metadata from INFORMATION_SCHEMA.TABLES
1626 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1627 test/t1#p#p3 5 0 0 2 2 2
1628 # Metadata from INFORMATION_SCHEMA.COLUMNS
1629 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1630 a 0 6 1283 0 0 0
1631 c 1 6 1027 0 0 0
1632 SELECT * FROM t1;
1633 a c
1634 DROP TABLE t1;
1635 # Scenario 64
1636 # When nullbitmap size on physical record changes after INSTANT ADD columns.
1637 CREATE TABLE t1 (c0 char(9) KEY, c1 char (10), c2 char(20), c3 char(30), c4 char(40), c5 char(50), c6 char(60), c7 char(70), c8 char(80)) ROW_FORMAT=REDUNDANT;
1638 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
1639 Insert into t1 values(
1640 REPEAT("a", 8),
1641 REPEAT("1", 9),
1642 REPEAT("2", 19),
1643 REPEAT("3", 29),
1644 REPEAT("4", 39),
1645 REPEAT("5", 49),
1646 REPEAT("6", 59),
1647 REPEAT("7", 69),
1648 REPEAT("8", 79));
1649 Insert into t1 values(
1650 REPEAT("b", 8),
1651 REPEAT("1", 9),
1652 REPEAT("2", 19),
1653 REPEAT("3", 29),
1654 REPEAT("4", 39),
1655 REPEAT("5", 49),
1656 REPEAT("6", 59),
1657 REPEAT("7", 69),
1658 REPEAT("8", 79));
1659 Alter table t1 add column c9 char(90);
1660 Insert into t1 values(
1661 REPEAT("c", 8),
1662 REPEAT("1", 9),
1663 REPEAT("2", 19),
1664 REPEAT("3", 29),
1665 REPEAT("4", 39),
1666 REPEAT("5", 49),
1667 REPEAT("6", 59),
1668 REPEAT("7", 69),
1669 REPEAT("8", 79),
1670 REPEAT("9", 89));
1671 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
1672 DROP table t1;
1673 # Scenario 65
1674 # Truncate all partition shall reset INSTANT Metadata
1675 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT) ROW_FORMAT=REDUNDANT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300), PARTITION p3 VALUES LESS THAN MAXVALUE);
1676 INSERT INTO t1 VALUES (90, 1, 1, "1"), (190, 1, 1, "2"), (290, 1, 1, "3"), (390, 1, 1, "3");
1677 Alter table t1 add column c5 int, algorithm=INSTANT;
1678 Alter table t1 drop column c3, algorithm=INSTANT;
1679 # DD Metadata of columns in table
1680 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1681 c1 1 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
1682 c2 2 MYSQL_TYPE_LONG 0 Visible physical_pos=4;table_id=TABLE_ID;
1683 c4 3 MYSQL_TYPE_BLOB 0 Visible physical_pos=6;table_id=TABLE_ID;
1684 c5 4 MYSQL_TYPE_LONG 0 Visible default_null=1;physical_pos=7;table_id=TABLE_ID;version_added=1;
1685 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
1686 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1687 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1688 !hidden!_dropped_v2_p5_c3 8 MYSQL_TYPE_LONG 0 SE physical_pos=5;version_dropped=2;
1689 # DD Metadata of partitions in table
1690 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1691 p0 100 NULL
1692 p1 200 NULL
1693 p2 300 NULL
1694 p3 MAXVALUE NULL
1695 # Metadata from INFORMATION_SCHEMA.TABLES
1696 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1697 test/t1#p#p0 7 0 2 4 4 5
1698 # Metadata from INFORMATION_SCHEMA.COLUMNS
1699 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1700 c1 0 6 1027 0 0 0
1701 c2 1 6 1027 0 0 0
1702 c4 2 5 16711932 0 0 0
1703 c5 3 6 1027 1 1 0
1704 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
1705 # Metadata from INFORMATION_SCHEMA.TABLES
1706 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1707 test/t1#p#p1 7 0 2 4 4 5
1708 # Metadata from INFORMATION_SCHEMA.COLUMNS
1709 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1710 c1 0 6 1027 0 0 0
1711 c2 1 6 1027 0 0 0
1712 c4 2 5 16711932 0 0 0
1713 c5 3 6 1027 1 1 0
1714 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
1715 # Metadata from INFORMATION_SCHEMA.TABLES
1716 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1717 test/t1#p#p2 7 0 2 4 4 5
1718 # Metadata from INFORMATION_SCHEMA.COLUMNS
1719 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1720 c1 0 6 1027 0 0 0
1721 c2 1 6 1027 0 0 0
1722 c4 2 5 16711932 0 0 0
1723 c5 3 6 1027 1 1 0
1724 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
1725 # Metadata from INFORMATION_SCHEMA.TABLES
1726 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1727 test/t1#p#p3 7 0 2 4 4 5
1728 # Metadata from INFORMATION_SCHEMA.COLUMNS
1729 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1730 c1 0 6 1027 0 0 0
1731 c2 1 6 1027 0 0 0
1732 c4 2 5 16711932 0 0 0
1733 c5 3 6 1027 1 1 0
1734 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
1735 ALTER TABLE t1 TRUNCATE partition p0, p1, p2, p3;
1736 # DD Metadata of columns in table
1737 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1738 c1 1 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1739 c2 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1740 c4 3 MYSQL_TYPE_BLOB 0 Visible table_id=TABLE_ID;
1741 c5 4 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
1742 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1743 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1744 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
1745 # DD Metadata of partitions in table
1746 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
1747 p0 100 NULL
1748 p1 200 NULL
1749 p2 300 NULL
1750 p3 MAXVALUE NULL
1751 # Metadata from INFORMATION_SCHEMA.TABLES
1752 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1753 test/t1#p#p0 7 0 0 4 4 4
1754 # Metadata from INFORMATION_SCHEMA.COLUMNS
1755 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1756 c1 0 6 1027 0 0 0
1757 c2 1 6 1027 0 0 0
1758 c4 2 5 16711932 0 0 0
1759 c5 3 6 1027 0 0 0
1760 # Metadata from INFORMATION_SCHEMA.TABLES
1761 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1762 test/t1#p#p1 7 0 0 4 4 4
1763 # Metadata from INFORMATION_SCHEMA.COLUMNS
1764 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1765 c1 0 6 1027 0 0 0
1766 c2 1 6 1027 0 0 0
1767 c4 2 5 16711932 0 0 0
1768 c5 3 6 1027 0 0 0
1769 # Metadata from INFORMATION_SCHEMA.TABLES
1770 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1771 test/t1#p#p2 7 0 0 4 4 4
1772 # Metadata from INFORMATION_SCHEMA.COLUMNS
1773 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1774 c1 0 6 1027 0 0 0
1775 c2 1 6 1027 0 0 0
1776 c4 2 5 16711932 0 0 0
1777 c5 3 6 1027 0 0 0
1778 # Metadata from INFORMATION_SCHEMA.TABLES
1779 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1780 test/t1#p#p3 7 0 0 4 4 4
1781 # Metadata from INFORMATION_SCHEMA.COLUMNS
1782 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1783 c1 0 6 1027 0 0 0
1784 c2 1 6 1027 0 0 0
1785 c4 2 5 16711932 0 0 0
1786 c5 3 6 1027 0 0 0
1787 DROP TABLE t1;
1788 # Scenario 66
1789 # Purge crash
1790 create table t1 (c0 INT KEY, c1 varchar(10), c2 varchar(10)) ROW_FORMAT=REDUNDANT;
1791 alter table t1 add column c4 char(10), algorithm=instant;
1792 alter table t1 add index idx (c4);
1793 insert into t1 values (1, "r1c1", "r1c2", "c4");
1794 SET GLOBAL innodb_purge_stop_now=ON;
1795 Update t1 set c2="r122222", c4="c44";
1796 alter table t1 drop column c2, algorithm=instant;
1797 SET GLOBAL innodb_purge_run_now=ON;
1798 DROP TABLE t1;
1799 # Scenario 66
1800 # Inplace update is failing
1801 # INSTANT ADD and INPLACE UPDATE
1802 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT;
1803 Insert into t1 values ("r1c1", "r1c2", "r1c3");
1804 Select * from t1;
1805 c1 c2 c3
1806 r1c1 r1c2 r1c3
1807 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
1808 Select * from t1;
1809 c1 c4 c2 c3
1810 r1c1 NULL r1c2 r1c3
1811 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
1812 Select * from t1;
1813 c1 c4 c2 c3
1814 r1c1 NULL r1c2 r1c3
1815 r2c1 r2c4 r2c2 r2c3
1816 # Disable flush to make sure REDO is applied after restart
1817 Update t1 set c2="r112" where c2="r1c2";
1818 Update t1 set c2="r212" where c2="r2c2";
1819 Select * from t1;
1820 c1 c4 c2 c3
1821 r1c1 NULL r112 r1c3
1822 r2c1 r2c4 r212 r2c3
1823 # Kill the running server
1824 # Kill the server
1825 # Start the server
1826 Select * from t1;
1827 c1 c4 c2 c3
1828 r1c1 NULL r112 r1c3
1829 r2c1 r2c4 r212 r2c3
1830 DROP TABLE t1;
1831 # INSTANT DROP and INPLACE UPDATE
1832 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT;
1833 Insert into t1 values ("r1c1", "r1c2", "r1c3");
1834 Select * from t1;
1835 c1 c2 c3
1836 r1c1 r1c2 r1c3
1837 Alter table t1 drop column c1, algorithm=instant;
1838 Insert into t1 values ("r2c2", "r2c3");
1839 Select * from t1;
1840 c2 c3
1841 r1c2 r1c3
1842 r2c2 r2c3
1843 SET GLOBAL innodb_log_checkpoint_now = ON;
1844 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
1845 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
1846 SET GLOBAL innodb_master_thread_disabled_debug = 1;
1847 Update t1 set c2="r112" where c2="r1c2";
1848 Update t1 set c2="r212" where c2="r2c2";
1849 Select * from t1;
1850 c2 c3
1851 r112 r1c3
1852 r212 r2c3
1853 # Kill the running server
1854 # Kill the server
1855 # Start the server
1856 Select * from t1;
1857 c2 c3
1858 r112 r1c3
1859 r212 r2c3
1860 DROP TABLE t1;
1861 # INSTANT ADD and DROP and INPLACE UPDATE
1862 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=REDUNDANT;
1863 Insert into t1 values ("r1c1", "r1c2", "r1c3");
1864 Select * from t1;
1865 c1 c2 c3
1866 r1c1 r1c2 r1c3
1867 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
1868 Select * from t1;
1869 c1 c4 c2 c3
1870 r1c1 NULL r1c2 r1c3
1871 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
1872 Select * from t1;
1873 c1 c4 c2 c3
1874 r1c1 NULL r1c2 r1c3
1875 r2c1 r2c4 r2c2 r2c3
1876 Alter table t1 drop column c1, algorithm=instant;
1877 Select * from t1;
1878 c4 c2 c3
1879 NULL r1c2 r1c3
1880 r2c4 r2c2 r2c3
1881 Insert into t1 values ("r3c4", "r3c2", "r3c3");
1882 Select * from t1;
1883 c4 c2 c3
1884 NULL r1c2 r1c3
1885 r2c4 r2c2 r2c3
1886 r3c4 r3c2 r3c3
1887 SET GLOBAL innodb_log_checkpoint_now = ON;
1888 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
1889 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
1890 SET GLOBAL innodb_master_thread_disabled_debug = 1;
1891 Update t1 set c2="r112" where c2="r1c2";
1892 Update t1 set c2="r212" where c2="r2c2";
1893 Update t1 set c2="r312" where c2="r3c2";
1894 Select * from t1;
1895 c4 c2 c3
1896 NULL r112 r1c3
1897 r2c4 r212 r2c3
1898 r3c4 r312 r3c3
1899 # Kill the running server
1900 # Kill the server
1901 # Start the server
1902 Select * from t1;
1903 c4 c2 c3
1904 NULL r112 r1c3
1905 r2c4 r212 r2c3
1906 r3c4 r312 r3c3
1907 DROP TABLE t1;
1908 ###########
1909 # CLEANUP #
1910 ###########
1911 ############################################
1912 # Test instant ADD/DROP COLUMN for DYNAMIC format
1913 ############################################
1914 SET SESSION debug= '+d,show_dropped_column';
1915 # Scenario 1
1916 create table t1 (c1 char(10), c2 char(10));
1917 # Metadata from INFORMATION_SCHEMA.TABLES
1918 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1919 test/t1 5 0 0 2 2 2
1920 # Metadata from INFORMATION_SCHEMA.COLUMNS
1921 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1922 c1 0 13 16711934 0 0 0
1923 c2 1 13 16711934 0 0 0
1924 # DD Metadata of table
1925 NAME SE_PRIVATE_DATA
1926 t1 NULL
1927 # DD Metadata of columns in table
1928 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1929 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
1930 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
1931 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1932 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
1933 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
1934 insert into t1 values ("r1c1", "r1c2");
1935 select * from t1;
1936 c1 c2
1937 r1c1 r1c2
1938 alter table t1 add column c3 char(10) default "def_c3" after c1;
1939 # Metadata from INFORMATION_SCHEMA.TABLES
1940 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1941 test/t1 6 0 1 2 3 3
1942 # Metadata from INFORMATION_SCHEMA.COLUMNS
1943 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1944 c1 0 13 16711934 0 0 0
1945 c3 1 13 16711934 1 1 0
1946 c2 2 13 16711934 0 0 0
1947 # DD Metadata of table
1948 NAME SE_PRIVATE_DATA
1949 t1 NULL
1950 # DD Metadata of columns in table
1951 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1952 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
1953 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
1954 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
1955 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
1956 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1957 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1958 insert into t1 values ("r2c1", "r2c3", "r2c2");
1959 select * from t1;
1960 c1 c3 c2
1961 r1c1 def_c3 r1c2
1962 r2c1 r2c3 r2c2
1963 drop table t1;
1964 # Scenario 2
1965 create table t1 (c1 char(10), c2 char(10), c3 char(10));
1966 insert into t1 values ("r1c1", "r1c2", "r1c3");
1967 alter table t1 drop column c2;
1968 # Metadata from INFORMATION_SCHEMA.TABLES
1969 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
1970 test/t1 5 0 1 3 2 3
1971 # Metadata from INFORMATION_SCHEMA.COLUMNS
1972 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
1973 c1 0 13 16711934 0 0 0
1974 c3 1 13 16711934 0 0 0
1975 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
1976 # DD Metadata of table
1977 NAME SE_PRIVATE_DATA
1978 t1 NULL
1979 # DD Metadata of columns in table
1980 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
1981 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
1982 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
1983 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
1984 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
1985 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
1986 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
1987 select * from t1;
1988 c1 c3
1989 r1c1 r1c3
1990 drop table t1;
1991 # Scenario 3
1992 create table t1 (c1 char(10), c2 char(10));
1993 insert into t1 values ("r1c1", "r1c2");
1994 select * from t1;
1995 c1 c2
1996 r1c1 r1c2
1997 alter table t1 add column c3 char(10) default "def_c3" after c1, algorithm=INSTANT;
1998 insert into t1 values ("r2c1", "r2c3", "r2c2");
1999 select * from t1;
2000 c1 c3 c2
2001 r1c1 def_c3 r1c2
2002 r2c1 r2c3 r2c2
2003 alter table t1 drop column c2, algorithm=INSTANT;
2004 select * from t1;
2005 c1 c3
2006 r1c1 def_c3
2007 r2c1 r2c3
2008 drop table t1;
2009 # Scenario 4
2010 create table t1 (c1 char(10), c2 char(10), c3 char(10));
2011 insert into t1 values ("r1c1", "r1c2", "r1c3");
2012 select * from t1;
2013 c1 c2 c3
2014 r1c1 r1c2 r1c3
2015 alter table t1 drop column c2;
2016 select * from t1;
2017 c1 c3
2018 r1c1 r1c3
2019 drop table t1;
2020 # Scenario 5
2021 create table t1 (c1 char(10), c2 char(10));
2022 insert into t1 values ("r1c1", "r1c2");
2023 alter table t1 add column c3 char(10) default "def_c3" after c1;
2024 select * from t1;
2025 c1 c3 c2
2026 r1c1 def_c3 r1c2
2027 insert into t1 value ("r2c1", "r2c3", "r2c2");
2028 alter table t1 drop column c2;
2029 select * from t1;
2030 c1 c3
2031 r1c1 def_c3
2032 r2c1 r2c3
2033 drop table t1;
2034 # Scenario 6
2035 create table t1 (c1 char(10), c2 char(10));
2036 insert into t1 values ("r1c1", "r1c2");
2037 alter table t1 add column c2 char(10) default "def_c3", drop column c2;
2038 select * from t1;
2039 c1 c2
2040 r1c1 def_c3
2041 insert into t1 value ("r2c1", "r2c2");
2042 select * from t1;
2043 c1 c2
2044 r1c1 def_c3
2045 r2c1 r2c2
2046 drop table t1;
2047 # Scenario 7
2048 create table t1 (c1 char(10), c2 char(10));
2049 insert into t1 values ("r1c1", "r1c2");
2050 alter table t1 add column c3 int after c1;
2051 select * from t1;
2052 c1 c3 c2
2053 r1c1 NULL r1c2
2054 insert into t1 value ("r2c1", 3, "r2c2");
2055 select * from t1;
2056 c1 c3 c2
2057 r1c1 NULL r1c2
2058 r2c1 3 r2c2
2059 alter table t1 drop column c2;
2060 select * from t1;
2061 c1 c3
2062 r1c1 NULL
2063 r2c1 3
2064 drop table t1;
2065 # Scenario 8
2066 create table t1 (c1 char(10), c2 char(10), c3 char(10));
2067 insert into t1 values ("r1c1", NULL, "r1c3");
2068 select * from t1;
2069 c1 c2 c3
2070 r1c1 NULL r1c3
2071 alter table t1 drop column c2;
2072 # Metadata from INFORMATION_SCHEMA.TABLES
2073 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2074 test/t1 5 0 1 3 2 3
2075 # Metadata from INFORMATION_SCHEMA.COLUMNS
2076 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
2077 c1 0 13 16711934 0 0 0
2078 c3 1 13 16711934 0 0 0
2079 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
2080 # DD Metadata of table
2081 NAME SE_PRIVATE_DATA
2082 t1 NULL
2083 # DD Metadata of columns in table
2084 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
2085 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
2086 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
2087 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
2088 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
2089 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
2090 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
2091 select * from t1;
2092 c1 c3
2093 r1c1 r1c3
2094 drop table t1;
2095 # Scenario 9
2096 CREATE TABLE t1 (C1 char(10), C2 char(10), C3 char(10)) ROW_FORMAT=DYNAMIC;
2097 INSERT INTO t1 values ("r1c1", "r1c2", "r1c3");
2098 alter table t1 drop column c1;
2099 select * from t1;
2100 C2 C3
2101 r1c2 r1c3
2102 alter table t1 drop column c3;
2103 select * from t1;
2104 C2
2105 r1c2
2106 drop table t1;
2107 # Scenario 10
2108 create table t1 (c1 char(10) KEY, c2 char(10), key sec_idx(c2));
2109 insert into t1 values ("r1c1", "r1c2");
2110 select * from t1;
2111 c1 c2
2112 r1c1 r1c2
2113 alter table t1 add column c3 char(10) default "def_c3";
2114 select * from t1;
2115 c1 c2 c3
2116 r1c1 r1c2 def_c3
2117 insert into t1 values ("r2c1", "r2c2", "r3c3");
2118 drop table t1;
2119 # Scenario 11
2120 CREATE TABLE t1(c2 char(100) , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
2121 ALTER TABLE t1 DROP INDEX idx1;
2122 DROP TABLE t1;
2123 # Scenario 12
2124 CREATE TABLE t1(c2 char(100)) ROW_FORMAT=DYNAMIC;
2125 ALTER TABLE t1 ADD FULLTEXT INDEX `ft_idx` (c2);
2126 Warnings:
2127 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
2128 DROP TABLE t1;
2129 # Scenario 13
2130 CREATE TABLE t1(a INT) ROW_FORMAT=DYNAMIC;
2131 INSERT INTO t1 VALUES(1);
2132 ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT );
2133 ALTER TABLE t1 add COLUMN (h INT generated always as (a+1) virtual), add INDEX idx (h), algorithm=inplace;
2134 DROP TABLE t1;
2135 # Scenario 14
2136 CREATE TABLE t1 (col1 int(11) DEFAULT NULL, col2 int(11) DEFAULT NULL, col3 int(11) DEFAULT NULL, col4 int(11) DEFAULT NULL, col5 int(11) GENERATED ALWAYS AS (col4 * col2) VIRTUAL, col6 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, col7 int(11) GENERATED ALWAYS AS (col5 / col6) VIRTUAL, col8 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, col9 text, extra int(11) DEFAULT NULL) ROW_FORMAT=DYNAMIC;
2137 Warnings:
2138 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2139 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2140 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2141 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2142 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2143 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2144 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2145 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2146 Warning 1681 Integer display width is deprecated and will be removed in a future release.
2147 ALTER TABLE t1 DROP COLUMN col7;
2148 ALTER TABLE t1 DROP COLUMN col6, DROP COLUMN col9;
2149 DROP TABLE t1;
2150 # Scenario 15
2151 create table t1(a text, b text, fulltext(a,b));
2152 insert into t1 values('text1', 'text2');
2153 insert into t1 values('test1', 'test2');
2154 alter table t1 add fulltext(b);
2155 drop table t1;
2156 # Scenario 16
2157 CREATE TABLE t1 (a serial key, b text) ROW_FORMAT=DYNAMIC;
2158 INSERT INTO t1(b) VALUES(repeat("a short string - ",5));
2159 INSERT INTO t1(b) VALUES(repeat("a long string - ",50));
2160 INSERT INTO t1(b) SELECT b FROM t1;
2161 ALTER TABLE t1 ADD COLUMN (c int), algorithm=INSTANT;
2162 ALTER TABLE t1 ADD INDEX c (c), algorithm=INSTANT;
2163 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
2164 ALTER TABLE t1 ADD INDEX c (c), algorithm=INPLACE;
2165 DROP TABLE t1;
2166 # Scenario 17
2167 CREATE TABLE t1 (c1 char(20), c2 char(20), c3 char(20), c4 char(20)) ROW_FORMAT=DYNAMIC;
2168 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
2169 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
2170 ALTER TABLE test.t1 ADD c6 char(20), DROP COLUMN c3;
2171 DROP TABLE t1;
2172 # Scenario 18
2173 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) ROW_FORMAT=DYNAMIC;
2174 ALTER TABLE t1 DISCARD TABLESPACE;
2175 ALTER TABLE t1 ADD FULLTEXT INDEX (ct), ALGORITHM=INPLACE;
2176 Warnings:
2177 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
2178 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
2179 ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1, ALGORITHM=INPLACE;
2180 Warnings:
2181 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
2182 DROP TABLE t1;
2183 # Scenario 19
2184 CREATE TABLE t1 (a INT, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
2185 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 FIRST;
2186 ALTER TABLE t1 CHANGE aa e INT;
2187 INSERT INTO t1 VALUES (1,1,1,1,1);
2188 ALTER TABLE t1 ADD COLUMN a INT DEFAULT 1 FIRST, DROP COLUMN a, CHANGE b b INT;
2189 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 AFTER a, DROP COLUMN b, CHANGE c c INT;
2190 ALTER TABLE t1 CHANGE aa b INT;
2191 DROP TABLE t1;
2192 # Scenario 20
2193 CREATE TABLE t1 (a varchar(512) NOT NULL, b varchar(512) NOT NULL, FULLTEXT KEY fts_idx (a)) ROW_FORMAT=DYNAMIC;
2194 ALTER TABLE t1 DROP KEY fts_idx;
2195 ALTER TABLE t1 ADD COLUMN b_hash char(64) AS(b) VIRTUAL NOT NULL;
2196 DROP TABLE t1;
2197 # Scenario 21
2198 CREATE PROCEDURE test.fill_table (IN start INT) BEGIN SET @idx =start; WHILE (@idx > 0) DO INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa"); SET @idx = @idx - 1; END WHILE; END|
2199 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=DYNAMIC;
2200 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
2201 call fill_table(400);
2202 DROP PROCEDURE test.fill_table;
2203 DROP TABLE t1;
2204 # Scenario 22
2205 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=DYNAMIC;
2206 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
2207 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
2208 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
2209 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
2210 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
2211 SELECT * FROM t1;
2212 id v
2213 1 aaaaaaaaaaaaa
2214 2 aaaaaaaaaaaaa
2215 3 aaaaaaaaaaaaa
2216 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
2217 DROP TABLE t1;
2218 # Scenario 23
2219 create table t1 (c1 char(10), c2 char(10));
2220 # Metadata from INFORMATION_SCHEMA.TABLES
2221 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2222 test/t1 5 0 0 2 2 2
2223 # Metadata from INFORMATION_SCHEMA.COLUMNS
2224 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
2225 c1 0 13 16711934 0 0 0
2226 c2 1 13 16711934 0 0 0
2227 # DD Metadata of table
2228 NAME SE_PRIVATE_DATA
2229 t1 NULL
2230 # DD Metadata of columns in table
2231 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
2232 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
2233 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
2234 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
2235 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
2236 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
2237 insert into t1 values ("r1c1", "r1c2");
2238 select * from t1;
2239 c1 c2
2240 r1c1 r1c2
2241 alter table t1 add column c3 char(10) default "def_c3" after c1;
2242 # Metadata from INFORMATION_SCHEMA.TABLES
2243 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2244 test/t1 6 0 1 2 3 3
2245 # Metadata from INFORMATION_SCHEMA.COLUMNS
2246 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
2247 c1 0 13 16711934 0 0 0
2248 c3 1 13 16711934 1 1 0
2249 c2 2 13 16711934 0 0 0
2250 # DD Metadata of table
2251 NAME SE_PRIVATE_DATA
2252 t1 NULL
2253 # DD Metadata of columns in table
2254 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
2255 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
2256 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
2257 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
2258 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
2259 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
2260 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
2261 insert into t1 values ("r2c1", "r2c3", "r2c2");
2262 select * from t1;
2263 c1 c3 c2
2264 r1c1 def_c3 r1c2
2265 r2c1 r2c3 r2c2
2266 alter table t1 add column c3 char(10) default "newnewnew", drop column c3;
2267 select * from t1;
2268 c1 c2 c3
2269 r1c1 r1c2 newnewnew
2270 r2c1 r2c2 newnewnew
2271 DROP TABLE t1;
2272 # Scenario 24
2273 CREATE TABLE t1 (c1 char(10)) ROW_FORMAT=DYNAMIC;
2274 ALTER TABLE t1 ADD COLUMN c2 INT;
2275 ALTER TABLE t1 DROP COLUMN c2;
2276 INSERT INTO t1 (c1) VALUES("aaaa");
2277 select * from t1;
2278 c1
2279 aaaa
2280 check table t1;
2281 Table Op Msg_type Msg_text
2282 test.t1 check status OK
2283 DROP TABLE t1;
2284 # Scenario 25
2285 CREATE TABLE t1 (c1 int, c2 char(10)) ROW_FORMAT=DYNAMIC PARTITION BY HASH (c1) PARTITIONS 2;
2286 alter table t1 drop column c2;
2287 DROP TABLE t1;
2288 # Scenario 26
2289 CREATE TABLE t1 (c1 char(10) KEY, c2 char(10)) ROW_FORMAT=DYNAMIC;
2290 INSERT INTO t1 values ("row1_c1", "row1_c2");
2291 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "default_c3", ALGORITHM=INSTANT;
2292 INSERT INTO t1 values ("row2_c1", "row2_c2", "row2_c3");
2293 ALTER TABLE t1 ADD COLUMN c4 char(20) DEFAULT NULL AFTER c1, ALGORITHM=INSTANT;
2294 INSERT INTO t1 values ("row3_c1", "row3_c4", "row3_c2", "row3_c3");
2295 ALTER TABLE t1 force;
2296 SELECT * FROM t1;
2297 c1 c4 c2 c3
2298 row1_c1 NULL row1_c2 default_c3
2299 row2_c1 NULL row2_c2 row2_c3
2300 row3_c1 row3_c4 row3_c2 row3_c3
2301 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
2302 ALTER TABLE t1 ADD COLUMN c5 INT after c2, ALGORITHM=INSTANT;
2303 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
2304 DROP TABLE t1;
2305 # Scenario 27
2306 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=DYNAMIC;
2307 ALTER TABLE t1 ADD COLUMN c INT NOT NULL;
2308 ALTER TABLE t1 ADD COLUMN d VARCHAR(100);
2309 INSERT INTO t1 VALUES(0, 5, 20, 'Hello world');
2310 DROP TABLE t1;
2311 # Scenario 28
2312 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=DYNAMIC;
2313 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
2314 SELECT * from t1;
2315 a b
2316 1 1
2317 2 2
2318 3 3
2319 4 4
2320 5 5
2321 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 100, ADD COLUMN d INT GENERATED ALWAYS AS ((c * 2 + b)) VIRTUAL, ADD COLUMN e VARCHAR(100) DEFAULT 'Hello world';
2322 SELECT * from t1;
2323 a b c d e
2324 1 1 100 201 Hello world
2325 2 2 100 202 Hello world
2326 3 3 100 203 Hello world
2327 4 4 100 204 Hello world
2328 5 5 100 205 Hello world
2329 UPDATE t1 SET c = 200 WHERE a > 3;
2330 SELECT * from t1;
2331 a b c d e
2332 1 1 100 201 Hello world
2333 2 2 100 202 Hello world
2334 3 3 100 203 Hello world
2335 4 4 200 404 Hello world
2336 5 5 200 405 Hello world
2337 DROP TABLE t1;
2338 # Scenario 29
2339 CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ROW_FORMAT=DYNAMIC;;
2340 INSERT INTO t1 VALUES(0, 1);
2341 SELECT * from t1;
2342 c1 c2
2343 1 1
2344 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
2345 SELECT * from t1;
2346 c1 c2 c3
2347 1 1 NULL
2348 ALTER TABLE t1 ADD COLUMN c4 CHAR(100), ALGORITHM=INSTANT;
2349 SELECT * from t1;
2350 c1 c2 c3 c4
2351 1 1 NULL NULL
2352 UPDATE t1 SET c3 = 2;
2353 SELECT * from t1;
2354 c1 c2 c3 c4
2355 1 1 2 NULL
2356 DROP TABLE t1;
2357 # Scenario 30
2358 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;;
2359 INSERT INTO t1 VALUES("r1c1", "r1c2");
2360 SELECT * from t1;
2361 c1 c2
2362 r1c1 r1c2
2363 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
2364 SELECT * from t1;
2365 c1 c2 c3
2366 r1c1 r1c2 NULL
2367 ALTER TABLE t1 ADD COLUMN c4 char(100), ALGORITHM=INSTANT;
2368 SELECT * from t1;
2369 c1 c2 c3 c4
2370 r1c1 r1c2 NULL NULL
2371 UPDATE t1 SET c3 = 2;
2372 SELECT * from t1;
2373 c1 c2 c3 c4
2374 r1c1 r1c2 2 NULL
2375 DROP TABLE t1;
2376 # Scenario 31
2377 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;
2378 INSERT INTO t1 VALUES("r1c1", "r1c2");
2379 ALTER TABLE t1 ADD COLUMN c3 char(10) default "def_c3";
2380 SELECT * from t1;
2381 c1 c2 c3
2382 r1c1 r1c2 def_c3
2383 UPDATE t1 SET c3 = "new_c3";
2384 SELECT * from t1;
2385 c1 c2 c3
2386 r1c1 r1c2 new_c3
2387 UPDATE t1 SET c3 = "new2_c3";
2388 SELECT * from t1;
2389 c1 c2 c3
2390 r1c1 r1c2 new2_c3
2391 DROP TABLE t1;
2392 # Scenario 32
2393 CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a, b)) ROW_FORMAT=DYNAMIC;
2394 INSERT INTO t1 VALUES(0, 1), (1, 2), (2, 3), (3, 4);
2395 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
2396 CHECK TABLE t1;
2397 Table Op Msg_type Msg_text
2398 test.t1 check status OK
2399 SELECT * FROM t1;
2400 a b c
2401 0 1 5
2402 1 2 5
2403 2 3 5
2404 3 4 5
2405 UPDATE t1 SET c = b WHERE b <= 2;
2406 CHECK TABLE t1;
2407 Table Op Msg_type Msg_text
2408 test.t1 check status OK
2409 SELECT * FROM t1;
2410 a b c
2411 0 1 1
2412 1 2 2
2413 2 3 5
2414 3 4 5
2415 DROP TABLE t1;
2416 # Scenario 33
2417 CREATE TABLE t1(c1 longtext) ROW_FORMAT=DYNAMIC;
2418 INSERT INTO t1 VALUES (repeat('x', 8098));
2419 SELECT SUBSTRING(c1, 1000, 32) FROM t1;
2420 SUBSTRING(c1, 1000, 32)
2421 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2422 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
2423 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
2424 SUBSTRING(c1, 1000, 32) c2
2425 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
2426 BEGIN;
2427 UPDATE t1 SET c2 = 0;
2428 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
2429 SUBSTRING(c1, 1000, 32) c2
2430 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0
2431 ROLLBACK;
2432 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
2433 SUBSTRING(c1, 1000, 32) c2
2434 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
2435 DROP TABLE t1;
2436 # Scenario 34
2437 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;
2438 INSERT INTO t1 VALUES("r1c1", "r1c2");
2439 SELECT * FROM t1;
2440 c1 c2
2441 r1c1 r1c2
2442 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
2443 SELECT * FROM t1;
2444 c1 c2 c3
2445 r1c1 r1c2 c3_def
2446 SET GLOBAL innodb_log_checkpoint_now = ON;
2447 START TRANSACTION;
2448 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
2449 SELECT * FROM t1;
2450 c1 c2 c3
2451 r1c1 r1c2 c3_def
2452 r2c1 r2c2 r2c3
2453 SET SESSION DEBUG="+d,crash_commit_after";
2454 COMMIT;
2455 ERROR HY000: Lost connection to MySQL server during query
2456 # restart
2457 CHECK TABLE t1;
2458 Table Op Msg_type Msg_text
2459 test.t1 check status OK
2460 SELECT * FROM t1;
2461 c1 c2 c3
2462 r1c1 r1c2 c3_def
2463 r2c1 r2c2 r2c3
2464 INSERT INTO t1 VALUES("r3c1", "r3c2", "r3c3");
2465 START TRANSACTION;
2466 UPDATE t1 SET c2 = "temp";
2467 SELECT * FROM t1;
2468 c1 c2 c3
2469 r1c1 temp c3_def
2470 r2c1 temp r2c3
2471 r3c1 temp r3c3
2472 SET SESSION DEBUG="+d,crash_commit_after";
2473 COMMIT;
2474 ERROR HY000: Lost connection to MySQL server during query
2475 # restart
2476 CHECK TABLE t1;
2477 Table Op Msg_type Msg_text
2478 test.t1 check status OK
2479 SELECT * FROM t1;
2480 c1 c2 c3
2481 r1c1 temp c3_def
2482 r2c1 temp r2c3
2483 r3c1 temp r3c3
2484 DROP TABLE t1;
2485 # Scenario 35
2486 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=DYNAMIC;
2487 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
2488 ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10, algorithm=INSTANT;
2489 CHECK TABLE t1;
2490 Table Op Msg_type Msg_text
2491 test.t1 check status OK
2492 START TRANSACTION;
2493 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
2494 SELECT * FROM t1;
2495 a b c1
2496 1 1 10
2497 2 2 10
2498 3 3 10
2499 4 4 10
2500 5 5 10
2501 6 6 20
2502 7 7 20
2503 SET SESSION DEBUG="+d,crash_commit_after";
2504 COMMIT;
2505 ERROR HY000: Lost connection to MySQL server during query
2506 # restart
2507 CHECK TABLE t1;
2508 Table Op Msg_type Msg_text
2509 test.t1 check status OK
2510 SELECT * FROM t1;
2511 a b c1
2512 1 1 10
2513 2 2 10
2514 3 3 10
2515 4 4 10
2516 5 5 10
2517 6 6 20
2518 7 7 20
2519 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
2520 START TRANSACTION;
2521 UPDATE t1 SET b = 10;
2522 SELECT * FROM t1;
2523 a b c1
2524 1 10 10
2525 2 10 10
2526 3 10 10
2527 4 10 10
2528 5 10 10
2529 6 10 20
2530 7 10 20
2531 8 10 20
2532 9 10 20
2533 SET SESSION DEBUG="+d,crash_commit_after";
2534 COMMIT;
2535 ERROR HY000: Lost connection to MySQL server during query
2536 # restart
2537 CHECK TABLE t1;
2538 Table Op Msg_type Msg_text
2539 test.t1 check status OK
2540 SELECT * FROM t1;
2541 a b c1
2542 1 10 10
2543 2 10 10
2544 3 10 10
2545 4 10 10
2546 5 10 10
2547 6 10 20
2548 7 10 20
2549 8 10 20
2550 9 10 20
2551 DROP TABLE t1;
2552 # Scenario 36
2553 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;
2554 INSERT INTO t1 VALUES("r1c1", "r1c2");
2555 SELECT * FROM t1;
2556 c1 c2
2557 r1c1 r1c2
2558 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
2559 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
2560 SELECT * FROM t1;
2561 c1 c2 c3
2562 r1c1 r1c2 c3_def
2563 r2c1 r2c2 r2c3
2564 START TRANSACTION;
2565 UPDATE t1 SET c2 = "temp";
2566 SELECT * FROM t1;
2567 c1 c2 c3
2568 r1c1 temp c3_def
2569 r2c1 temp r2c3
2570 SET SESSION DEBUG="+d,crash_commit_after";
2571 COMMIT;
2572 ERROR HY000: Lost connection to MySQL server during query
2573 # restart
2574 CHECK TABLE t1;
2575 Table Op Msg_type Msg_text
2576 test.t1 check status OK
2577 SELECT * FROM t1;
2578 c1 c2 c3
2579 r1c1 temp c3_def
2580 r2c1 temp r2c3
2581 DROP TABLE t1;
2582 # Scenario 37
2583 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;
2584 INSERT INTO t1 VALUES("r1c1", "r1c2");
2585 SELECT * FROM t1;
2586 c1 c2
2587 r1c1 r1c2
2588 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
2589 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
2590 SELECT * FROM t1;
2591 c1 c2 c3
2592 r1c1 r1c2 c3_def
2593 r2c1 r2c2 r2c3
2594 SET GLOBAL innodb_log_checkpoint_now = ON;
2595 START TRANSACTION;
2596 UPDATE t1 SET c3 = "temp";
2597 SELECT * FROM t1;
2598 c1 c2 c3
2599 r1c1 r1c2 temp
2600 r2c1 r2c2 temp
2601 SET SESSION DEBUG="+d,crash_commit_after";
2602 COMMIT;
2603 ERROR HY000: Lost connection to MySQL server during query
2604 # restart
2605 CHECK TABLE t1;
2606 Table Op Msg_type Msg_text
2607 test.t1 check status OK
2608 SELECT * FROM t1;
2609 c1 c2 c3
2610 r1c1 r1c2 temp
2611 r2c1 r2c2 temp
2612 DROP TABLE t1;
2613 # Scenario 38
2614 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(col1 * 2) ( PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256) , PARTITION p2 VALUES LESS THAN (384) , PARTITION p3 VALUES LESS THAN MAXVALUE);;
2615 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
2616 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
2617 CHECK TABLE t1;
2618 Table Op Msg_type Msg_text
2619 test.t1 check status OK
2620 SELECT count(*) AS `Expect 4` FROM information_schema.innodb_tables WHERE instant_cols != 0;
2621 Expect 4
2622 0
2623 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
2624 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
2625 Expect 3
2626 0
2627 CHECK TABLE t1;
2628 Table Op Msg_type Msg_text
2629 test.t1 check status OK
2630 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
2631 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
2632 Expect 3
2633 0
2634 CHECK TABLE t1;
2635 Table Op Msg_type Msg_text
2636 test.t1 check status OK
2637 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
2638 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
2639 Expect 3
2640 0
2641 CHECK TABLE t1;
2642 Table Op Msg_type Msg_text
2643 test.t1 check status OK
2644 ALTER TABLE t1 ADD KEY idx3(col3);
2645 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
2646 Expect 3
2647 0
2648 CHECK TABLE t1;
2649 Table Op Msg_type Msg_text
2650 test.t1 check status OK
2651 SELECT * FROM t1;
2652 col1 col2 col3 col4 col5 col6
2653 1 2 3 abcdefg def NULL
2654 100 200 300 qwerty def NULL
2655 200 300 400 asdfg def NULL
2656 DROP TABLE t1;
2657 # Scenario 39
2658 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
2659 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
2660 SELECT * FROM t1;
2661 c1 c2 c3
2662 1 r1c2 r1c3
2663 100 r2c2 r2c3
2664 200 r3c2 r3c3
2665 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2666 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2667 test/t1#p#p0 6 0 3 3 3
2668 test/t1#p#p1 6 0 3 3 3
2669 test/t1#p#p2 6 0 3 3 3
2670 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
2671 SELECT * FROM t1;
2672 c1 c2 c3 col4
2673 1 r1c2 r1c3 def_4
2674 100 r2c2 r2c3 def_4
2675 200 r3c2 r3c3 def_4
2676 CHECK TABLE t1;
2677 Table Op Msg_type Msg_text
2678 test.t1 check status OK
2679 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2680 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2681 test/t1#p#p0 7 1 3 4 4
2682 test/t1#p#p1 7 1 3 4 4
2683 test/t1#p#p2 7 1 3 4 4
2684 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
2685 SELECT * FROM t1;
2686 c1 c2 c3 col4
2687 1 r1c2 r1c3 def_4
2688 100 r2c2 r2c3 def_4
2689 200 r3c2 r3c3 def_4
2690 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2691 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2692 test/t1#p#p0_a 7 1 3 4 4
2693 test/t1#p#p0_b 7 1 3 4 4
2694 test/t1#p#p1 7 1 3 4 4
2695 test/t1#p#p2 7 1 3 4 4
2696 CHECK TABLE t1;
2697 Table Op Msg_type Msg_text
2698 test.t1 check status OK
2699 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
2700 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2701 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2702 test/t1#p#p0_a 7 1 3 4 4
2703 test/t1#p#p0_b 7 1 3 4 4
2704 test/t1#p#p1 7 1 3 4 4
2705 test/t1#p#p2 7 1 3 4 4
2706 CHECK TABLE t1;
2707 Table Op Msg_type Msg_text
2708 test.t1 check status OK
2709 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
2710 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
2711 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2712 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2713 test/t1#p#p0_a 7 1 3 4 4
2714 test/t1#p#p0_b 7 1 3 4 4
2715 test/t1#p#p1 7 1 3 4 4
2716 test/t1#p#p2 7 1 3 4 4
2717 CHECK TABLE t1;
2718 Table Op Msg_type Msg_text
2719 test.t1 check status OK
2720 ALTER TABLE t1 ADD KEY idx3(c3);
2721 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
2722 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
2723 test/t1#p#p0_a 7 1 3 4 4
2724 test/t1#p#p0_b 7 1 3 4 4
2725 test/t1#p#p1 7 1 3 4 4
2726 test/t1#p#p2 7 1 3 4 4
2727 CHECK TABLE t1;
2728 Table Op Msg_type Msg_text
2729 test.t1 check status OK
2730 SELECT * FROM t1;
2731 c1 c2 c3 col4
2732 1 r1c2 r1c3 def_4
2733 100 r2c2 r2c3 def_4
2734 200 r3c2 r3c3 def_4
2735 DROP TABLE t1;
2736 # Scenario 40
2737 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
2738 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
2739 SELECT * FROM t1;
2740 c1 c2 c3
2741 1 r1c2 r1c3
2742 100 r2c2 r2c3
2743 200 r3c2 r3c3
2744 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
2745 CHECK TABLE t1;
2746 Table Op Msg_type Msg_text
2747 test.t1 check status OK
2748 SELECT * FROM t1;
2749 c1 c2 c3 col4
2750 1 r1c2 r1c3 def_4
2751 100 r2c2 r2c3 def_4
2752 200 r3c2 r3c3 def_4
2753 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
2754 CHECK TABLE t1;
2755 Table Op Msg_type Msg_text
2756 test.t1 check status OK
2757 SELECT * FROM t1;
2758 c1 c2 c3 col4
2759 1 r1c2 r1c3 def_4
2760 100 r2c2 r2c3 def_4
2761 200 r3c2 r3c3 def_4
2762 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
2763 CHECK TABLE t1;
2764 Table Op Msg_type Msg_text
2765 test.t1 check status OK
2766 SELECT * FROM t1;
2767 c1 c2 c3 col4
2768 1 r1c2 r1c3 def_4
2769 100 r2c2 r2c3 def_4
2770 200 r3c2 r3c3 def_4
2771 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
2772 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
2773 CHECK TABLE t1;
2774 Table Op Msg_type Msg_text
2775 test.t1 check status OK
2776 SELECT * FROM t1;
2777 c1 c2 c3 col4
2778 1 r1c2 r1c3 def_4
2779 100 r2c2 r2c3 def_4
2780 200 r3c2 r3c3 def_4
2781 ALTER TABLE t1 ADD KEY idx3(c3);
2782 CHECK TABLE t1;
2783 Table Op Msg_type Msg_text
2784 test.t1 check status OK
2785 SELECT * FROM t1;
2786 c1 c2 c3 col4
2787 1 r1c2 r1c3 def_4
2788 100 r2c2 r2c3 def_4
2789 200 r3c2 r3c3 def_4
2790 DROP TABLE t1;
2791 # Scenario 41
2792 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256), PARTITION p2 VALUES LESS THAN (384), PARTITION p3 VALUES LESS THAN MAXVALUE);;
2793 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
2794 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
2795 CHECK TABLE t1;
2796 Table Op Msg_type Msg_text
2797 test.t1 check status OK
2798 SELECT * FROM t1;
2799 col1 col2 col3 col4 col5 col6
2800 1 2 3 abcdefg def NULL
2801 100 200 300 qwerty def NULL
2802 200 300 400 asdfg def NULL
2803 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
2804 CHECK TABLE t1;
2805 Table Op Msg_type Msg_text
2806 test.t1 check status OK
2807 SELECT * FROM t1;
2808 col1 col2 col3 col4 col5 col6
2809 1 2 3 abcdefg def NULL
2810 100 200 300 qwerty def NULL
2811 200 300 400 asdfg def NULL
2812 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
2813 CHECK TABLE t1;
2814 Table Op Msg_type Msg_text
2815 test.t1 check status OK
2816 SELECT * FROM t1;
2817 col1 col2 col3 col4 col5 col6
2818 1 2 3 abcdefg def NULL
2819 100 200 300 qwerty def NULL
2820 200 300 400 asdfg def NULL
2821 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
2822 CHECK TABLE t1;
2823 Table Op Msg_type Msg_text
2824 test.t1 check status OK
2825 SELECT * FROM t1;
2826 col1 col2 col3 col4 col5 col6
2827 1 2 3 abcdefg def NULL
2828 100 200 300 qwerty def NULL
2829 200 300 400 asdfg def NULL
2830 ALTER TABLE t1 ADD KEY idx3(col3);
2831 CHECK TABLE t1;
2832 Table Op Msg_type Msg_text
2833 test.t1 check status OK
2834 SELECT * FROM t1;
2835 col1 col2 col3 col4 col5 col6
2836 1 2 3 abcdefg def NULL
2837 100 200 300 qwerty def NULL
2838 200 300 400 asdfg def NULL
2839 DROP TABLE t1;
2840 # Scenario 42
2841 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
2842 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
2843 SELECT * FROM t1;
2844 c1 c2 c3
2845 1 r1c2 r1c3
2846 100 r2c2 r2c3
2847 200 r3c2 r3c3
2848 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
2849 CHECK TABLE t1;
2850 Table Op Msg_type Msg_text
2851 test.t1 check status OK
2852 SELECT * FROM t1;
2853 c1 c2 c3 col4
2854 1 r1c2 r1c3 def_4
2855 100 r2c2 r2c3 def_4
2856 200 r3c2 r3c3 def_4
2857 ALTER TABLE t1 ALGORITHM INSTANT, DROP COLUMN c2;
2858 CHECK TABLE t1;
2859 Table Op Msg_type Msg_text
2860 test.t1 check status OK
2861 SELECT * FROM t1;
2862 c1 c3 col4
2863 1 r1c3 def_4
2864 100 r2c3 def_4
2865 200 r3c3 def_4
2866 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
2867 CHECK TABLE t1;
2868 Table Op Msg_type Msg_text
2869 test.t1 check status OK
2870 SELECT * FROM t1;
2871 c1 c3 col4
2872 1 r1c3 def_4
2873 100 r2c3 def_4
2874 200 r3c3 def_4
2875 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
2876 CHECK TABLE t1;
2877 Table Op Msg_type Msg_text
2878 test.t1 check status OK
2879 SELECT * FROM t1;
2880 c1 c3 col4
2881 1 r1c3 def_4
2882 100 r2c3 def_4
2883 200 r3c3 def_4
2884 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
2885 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
2886 CHECK TABLE t1;
2887 Table Op Msg_type Msg_text
2888 test.t1 check status OK
2889 SELECT * FROM t1;
2890 c1 c3 col4
2891 1 r1c3 def_4
2892 100 r2c3 def_4
2893 200 r3c3 def_4
2894 ALTER TABLE t1 ADD KEY idx3(c3);
2895 CHECK TABLE t1;
2896 Table Op Msg_type Msg_text
2897 test.t1 check status OK
2898 SELECT * FROM t1;
2899 c1 c3 col4
2900 1 r1c3 def_4
2901 100 r2c3 def_4
2902 200 r3c3 def_4
2903 DROP TABLE t1;
2904 # Scenario 43
2905 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=DYNAMIC PARTITION BY HASH(a) PARTITIONS 3;;
2906 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8);
2907 SELECT * FROM t1;
2908 a b
2909 3 3
2910 6 6
2911 1 1
2912 4 4
2913 7 7
2914 2 2
2915 5 5
2916 8 8
2917 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
2918 CHECK TABLE t1;
2919 Table Op Msg_type Msg_text
2920 test.t1 check status OK
2921 SELECT * FROM t1;
2922 a b c
2923 3 3 5
2924 6 6 5
2925 1 1 5
2926 4 4 5
2927 7 7 5
2928 2 2 5
2929 5 5 5
2930 8 8 5
2931 ALTER TABLE t1 ADD PARTITION PARTITIONS 10;
2932 CHECK TABLE t1;
2933 Table Op Msg_type Msg_text
2934 test.t1 check status OK
2935 SELECT * FROM t1;
2936 a b c
2937 1 1 5
2938 2 2 5
2939 3 3 5
2940 4 4 5
2941 5 5 5
2942 6 6 5
2943 7 7 5
2944 8 8 5
2945 ALTER TABLE t1 ADD KEY(b);
2946 CHECK TABLE t1;
2947 Table Op Msg_type Msg_text
2948 test.t1 check status OK
2949 SELECT * FROM t1;
2950 a b c
2951 1 1 5
2952 2 2 5
2953 3 3 5
2954 4 4 5
2955 5 5 5
2956 6 6 5
2957 7 7 5
2958 8 8 5
2959 DROP TABLE t1;
2960 # Scenario 44
2961 CREATE TABLE t1 (a BLOB, b BLOB, c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, h VARCHAR(10) DEFAULT NULL) ROW_FORMAT=DYNAMIC;
2962 INSERT INTO t1 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk");
2963 CREATE INDEX idx ON t1(c(100));
2964 SELECT length(c) FROM t1;
2965 length(c)
2966 32000
2967 START TRANSACTION;
2968 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
2969 ROLLBACK;
2970 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
2971 START TRANSACTION;
2972 UPDATE t1 SET a = REPEAT('m', 16000) WHERE a like "aaa%";
2973 ROLLBACK;
2974 DROP TABLE t1;
2975 # Scenario 45
2976 CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)) ROW_FORMAT=DYNAMIC;
2977 INSERT INTO t1 VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT);
2978 INSERT INTO t1 VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT);
2979 INSERT INTO t1 VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT);
2980 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;
2981 ALTER TABLE t1 DROP COLUMN p, ADD COLUMN s VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), algorithm=inplace;
2982 DROP TABLE t1;
2983 # Scenario 46
2984 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c INT) ROW_FORMAT=DYNAMIC;
2985 INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2), (3, 3, 3), (6, 6, 6);
2986 ALTER TABLE t1 ADD COLUMN d INT DEFAULT 10;
2987 SELECT * FROM t1;
2988 a b c d
2989 1 1 1 10
2990 2 2 2 10
2991 3 3 3 10
2992 6 6 6 10
2993 SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL altered WAIT_FOR dmls_done';
2994 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;;
2995 SET DEBUG_SYNC = 'now WAIT_FOR altered';
2996 INSERT INTO t1(a, b, c) VALUES(7, 7, 7);
2997 UPDATE t1 SET a = 10 WHERE a = 1;
2998 DELETE FROM t1 WHERE a = 2;
2999 UPDATE t1 SET c = 10 WHERE a = 3;
3000 UPDATE t1 SET d = 20 WHERE a = 5;
3001 UPDATE t1 SET a = 8, d = 20 WHERE a = 6;
3002 SET DEBUG_SYNC = 'now SIGNAL dmls_done';
3003 SELECT * FROM t1;
3004 a b d
3005 3 3 10
3006 7 7 10
3007 8 6 20
3008 10 1 10
3009 DROP TABLE t1;
3010 # Scenario 47
3011 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (20));
3012 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
3013 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
3014 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
3015 c 2 6 1027 4 1 80000064 1 0 4
3016 c 2 6 1027 4 1 80000064 1 0 4
3017 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p21 VALUES LESS THAN(15), PARTITION p22 VALUES LESS THAN(20));
3018 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
3019 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
3020 c 2 6 1027 4 1 80000064 1 0 4
3021 c 2 6 1027 4 1 80000064 1 0 4
3022 c 2 6 1027 4 1 80000064 1 0 4
3023 DROP TABLE t1;
3024 # Scenario 48
3025 CREATE TABLE t1 (c1 integer PRIMARY KEY AUTO_INCREMENT, c2 integer NULL UNIQUE) ROW_FORMAT=DYNAMIC;
3026 ALTER TABLE t1 ADD COLUMN c3 int;
3027 ALTER TABLE t1 DROP COLUMN c3;
3028 ALTER TABLE t1 ADD COLUMN c4 int DEFAULT 1;
3029 ALTER TABLE t1 CHANGE COLUMN c4 c4_new int NULL DEFAULT 1;
3030 ALTER TABLE t1 CHANGE COLUMN c4_new c4_new int NULL DEFAULT 1;
3031 DROP TABLE t1;
3032 # Scenario 49
3033 CREATE TABLE t1 (c1 char(20) KEY, c2 enum('a', 'b', 'c')) ROW_FORMAT=DYNAMIC;
3034 INSERT INTO t1 values ("row1_c1", "a");
3035 SELECT * from t1;
3036 c1 c2
3037 row1_c1 a
3038 ALTER TABLE t1 ADD COLUMN c3 enum('x', 'y', 'z'), ALGORITHM=INSTANT;
3039 SELECT * from t1;
3040 c1 c2 c3
3041 row1_c1 a NULL
3042 INSERT INTO t1 values ("row2_c2", "b", "y");
3043 SELECT * from t1;
3044 c1 c2 c3
3045 row1_c1 a NULL
3046 row2_c2 b y
3047 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3048 SELECT * from t1;
3049 c1 c3
3050 row1_c1 NULL
3051 row2_c2 y
3052 DROP TABLE t1;
3053 # Scenario 50
3054 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=DYNAMIC;
3055 ALTER TABLE t1 DROP COLUMN c2;
3056 truncate table t1;
3057 truncate table t1;
3058 truncate table t1;
3059 DROP TABLE t1;
3060 # Scenario 51
3061 CREATE TABLE t1 (c1 int KEY, c2 int) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20), PARTITION p2 VALUES LESS THAN (30));
3062 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3063 ALTER TABLE t1 DROP PARTITION p1;
3064 DROP TABLE t1;
3065 # Scenario 52
3066 CREATE TABLE t1(c1 int, c2 int, c3 int, c4 DOUBLE GENERATED ALWAYS AS (c1+c2) STORED, c5 DOUBLE GENERATED ALWAYS AS (c1-c2) VIRTUAL) ROW_FORMAT=DYNAMIC;;
3067 INSERT INTO t1(c1,c2,c3) VALUES (1,1,1);
3068 SELECT * FROM t1;
3069 c1 c2 c3 c4 c5
3070 1 1 1 2 0
3071 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3072 ERROR HY000: Column 'c2' has a generated column dependency.
3073 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
3074 SELECT * FROM t1;
3075 c1 c2 c4 c5
3076 1 1 2 0
3077 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
3078 SELECT * FROM t1;
3079 c1 c2 c5
3080 1 1 0
3081 ALTER TABLE t1 ADD COLUMN c6 DOUBLE GENERATED ALWAYS AS (2*c1+c2) VIRTUAL, ALGORITHM=INSTANT;
3082 SELECT * FROM t1;
3083 c1 c2 c5 c6
3084 1 1 0 3
3085 ALTER TABLE t1 ADD COLUMN c7 DOUBLE GENERATED ALWAYS AS (c1+2*c2) STORED, ALGORITHM=INSTANT;
3086 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
3087 SELECT * FROM t1;
3088 c1 c2 c5 c6
3089 1 1 0 3
3090 ALTER TABLE t1 ADD COLUMN c8 DOUBLE GENERATED ALWAYS AS (c1+2*c2) VIRTUAL FIRST, ALGORITHM=INSTANT;
3091 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
3092 SELECT * FROM t1;
3093 c1 c2 c5 c6
3094 1 1 0 3
3095 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
3096 SELECT * FROM t1;
3097 c1 c2 c3 c5 c6
3098 1 1 NULL 0 3
3099 ALTER TABLE t1 DROP column c3, add column c10 int as (c1+c2) virtual, ALGORITHM=INSTANT;
3100 SELECT * FROM t1;
3101 c1 c2 c5 c6 c10
3102 1 1 0 3 2
3103 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
3104 SELECT * FROM t1;
3105 c1 c2 c3 c5 c6 c10
3106 1 1 NULL 0 3 2
3107 ALTER TABLE t1 DROP column c3, drop column c6, ALGORITHM=INSTANT;
3108 SELECT * FROM t1;
3109 c1 c2 c5 c10
3110 1 1 0 2
3111 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
3112 SELECT * FROM t1;
3113 c1 c2 c3 c5 c10
3114 1 1 NULL 0 2
3115 ALTER TABLE t1 DROP column c3, add column c11 int as (c1+c2) virtual first, ALGORITHM=INSTANT;
3116 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
3117 SELECT * FROM t1;
3118 c1 c2 c3 c5 c10
3119 1 1 NULL 0 2
3120 DROP TABLE t1;
3121 # Scenario 53
3122 # Table with functional index.
3123 CREATE TABLE t1 (id int NOT NULL AUTO_INCREMENT KEY, c1 varchar(10) DEFAULT NULL, c2 varchar(10) DEFAULT NULL, INDEX idx((concat(c1, "c1")))) ROW_FORMAT=DYNAMIC;;
3124 INSERT INTO t1(c1, c2) values("abc", "def");
3125 SELECT * FROM t1;
3126 id c1 c2
3127 1 abc def
3128 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual after id, ALGORITHM=INSTANT;
3129 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
3130 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual, ALGORITHM=INSTANT;
3131 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
3132 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3133 SELECT * FROM t1;
3134 id c1
3135 1 abc
3136 DROP TABLE t1;
3137 # Scenarion 54
3138 CREATE TABLE t1 (c1 TEXT, c2 INT, PRIMARY KEY (c1(1))) ROW_FORMAT=DYNAMIC;;
3139 SELECT * FROM t1;
3140 c1 c2
3141 REPLACE INTO t1(c1) VALUES ('');
3142 REPLACE INTO t1(c1) VALUES ('');
3143 SELECT * From t1;
3144 c1 c2
3145 NULL
3146 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3147 REPLACE INTO t1(c1) VALUES ('');
3148 DROP TABLE t1;
3149 # Scenario 55
3150 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20));
3151 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
3152 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3153 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
3154 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
3155 ALTER TABLE t1 ADD PARTITION (PARTITION p5 VALUES LESS THAN (60));
3156 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
3157 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3158 ALTER TABLE t1 REORGANIZE PARTITION p5 INTO
3159 (
3160 PARTITION p51 VALUES LESS THAN (50),
3161 PARTITION p52 VALUES LESS THAN (60)
3162 );
3163 DROP TABLE t1;
3164 # Scenario 56
3165 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT, PRIMARY KEY(c1, c4(10))) ROW_FORMAT=DYNAMIC;;
3166 INSERT INTO t1 VALUES (1, 2, 3, "abcdefghijklmnop");
3167 SELECT * FROM t1;
3168 c1 c2 c3 c4
3169 1 2 3 abcdefghijklmnop
3170 ALTER TABLE t1 ADD COLUMN c5 INT, ALGORITHM=INSTANT;
3171 SELECT * FROM t1;
3172 c1 c2 c3 c4 c5
3173 1 2 3 abcdefghijklmnop NULL
3174 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3175 SELECT * FROM t1;
3176 c1 c3 c4 c5
3177 1 3 abcdefghijklmnop NULL
3178 DROP TABLE t1;
3179 # Scenario 57
3180 CREATE TABLE t1 (c1 CHAR(20), c2 CHAR(20), PRIMARY KEY PK(c1(4))) ROW_FORMAT=DYNAMIC;;
3181 INSERT INTO t1 VALUES ("r1c1", "r1c2");
3182 SELECT * FROM t1;
3183 c1 c2
3184 r1c1 r1c2
3185 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "c3_def", ALGORITHM=INSTANT;
3186 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
3187 SELECT * FROM t1;
3188 c1 c2 c3
3189 r1c1 r1c2 c3_def
3190 r2c1 r2c2 r2c3
3191 DROP TABLE t1;
3192 # Scenario 58
3193 # Validating record in table with INSTANT ADD/DROP columns
3194 CREATE TABLE t1 (c1 CHAR(10), c2 CHAR(10)) ROW_FORMAT=DYNAMIC;
3195 INSERT INTO t1 VALUES ("r1c1", "r1c2");
3196 ALTER TABLE t1 ADD COLUMN c3 CHAR(10), ALGORITHM=INSTANT;
3197 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
3198 ALTER TABLE t1 DROP COLUMN c1, ALGORITHM=INSTANT;
3199 INSERT INTO t1 (c2) VALUES ("r3c2");
3200 ALTER TABLE t1 ADD COLUMN c4 CHAR(10), ALGORITHM=INSTANT;
3201 INSERT INTO t1 (c2) VALUES ("r4c2");
3202 SELECT * From t1;
3203 c2 c3 c4
3204 r1c2 NULL NULL
3205 r2c2 r2c3 NULL
3206 r3c2 NULL NULL
3207 r4c2 NULL NULL
3208 DROP TABLE t1;
3209 CREATE TABLE t1 (id INT KEY, c2 CHAR(10)) ROW_FORMAT=DYNAMIC PARTITION BY RANGE( id ) (PARTITION P0 VALUES LESS THAN (40), PARTITION P1 VALUES LESS THAN (50));
3210 INSERT INTO t1 VALUES(1,"r1c2");
3211 INSERT INTO t1 VALUES(2,"r2c2");
3212 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3213 ALTER TABLE t1 ADD COLUMN c2 CHAR(10), ALGORITHM=INSTANT;
3214 ALTER TABLE t1 REORGANIZE PARTITION P0, P1 INTO (PARTITION P1 VALUES LESS THAN (50));
3215 SELECT * FROM t1;
3216 id c2
3217 1 NULL
3218 2 NULL
3219 DROP TABLE t1;
3220 # Scenario 59
3221 # A scenario when #fields were not updated correctly in REDUNDANT record for not-inplace update.
3222 CREATE TABLE t1 (c1 VARCHAR(20), c2 CHAR(20)) ROW_FORMAT=DYNAMIC;
3223 INSERT INTO t1 VALUES ("r1c1", "r1c2");
3224 SELECT * FROM t1;
3225 c1 c2
3226 r1c1 r1c2
3227 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
3228 UPDATE t1 SET c1="r1c11111111111";
3229 SELECT * FROM t1;
3230 c1
3231 r1c11111111111
3232 DROP TABLE t1;
3233 # Scenario 60
3234 # When a new partition is added in a table with instant columns and virtual column,
3235 # during inheriting INSTANT metadat for new partitions, virtual columns were not skipped.
3236 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300));
3237 ALTER TABLE t1 ADD COLUMN col5 INT, ADD COLUMN col6 INT GENERATED ALWAYS AS (col5 + 1) VIRTUAL, ALGORITHM=INSTANT;
3238 ALTER TABLE t1 DROP COLUMN col2, algorithm=INSTANT;
3239 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO(PARTITION p21 VALUES LESS THAN (250), PARTITION p22 VALUES LESS THAN (300));
3240 DROP TABLE t1;
3241 # Scenario 61
3242 # When a table is truncated, it's instant metadata is reset. It shall
3243 # also reset instant metadata of columns.
3244 CREATE TABLE t1 (c1 VARCHAR(1008)) ROW_FORMAT=DYNAMIC;
3245 ALTER TABLE t1 ADD COLUMN c2 INT;
3246 TRUNCATE TABLE t1;
3247 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),1);
3248 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),2);
3249 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),3);
3250 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),4);
3251 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),5);
3252 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),6);
3253 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),7);
3254 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),8);
3255 ALTER TABLE t1 ADD COLUMN c3 VARCHAR(500);
3256 UPDATE t1 SET c3 = CONCAT(REPEAT('c', 500));
3257 DROP TABLE t1;
3258 # Scenario 62
3259 # While updating lob columns on a rebuilt table which had INSTANT cols
3260 CREATE TABLE t1 (c1 CHAR(10)) ROW_FORMAT=DYNAMIC;
3261 INSERT INTO t1 VALUES ("r1c1");
3262 SELECT * FROM t1;
3263 c1
3264 r1c1
3265 ALTER TABLE t1 ADD COLUMN c2 INT;
3266 ALTER TABLE t1 DROP COLUMN c2;
3267 ALTER TABLE t1 ADD COLUMN c3 TEXT;
3268 UPDATE t1 SET c3 = CONCAT(REPEAT('z', 8204));
3269 ALTER TABLE t1 ADD PRIMARY KEY (c3(10)), ADD FULLTEXT KEY idx (c3);
3270 Warnings:
3271 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
3272 SELECT * FROM t1;
3273 c1 c3
3274 r1c1 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz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ES LESS THAN (20));
3279 # DD Metadata of columns in table
3280 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3281 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
3282 b 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3283 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3284 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
3285 # DD Metadata of partitions in table
3286 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3287 p1 10 NULL
3288 p2 20 NULL
3289 # Metadata from INFORMATION_SCHEMA.TABLES
3290 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3291 test/t1#p#p1 5 0 0 2 2 2
3292 # Metadata from INFORMATION_SCHEMA.COLUMNS
3293 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3294 a 0 6 1283 0 0 0
3295 b 1 6 1027 0 0 0
3296 # Metadata from INFORMATION_SCHEMA.TABLES
3297 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3298 test/t1#p#p2 5 0 0 2 2 2
3299 # Metadata from INFORMATION_SCHEMA.COLUMNS
3300 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3301 a 0 6 1283 0 0 0
3302 b 1 6 1027 0 0 0
3303 INSERT INTO t1 values (5, 50), (15, 150);
3304 SELECT * FROM t1 PARTITION (p1);
3305 a b
3306 5 50
3307 SELECT * FROM t1 PARTITION (p2);
3308 a b
3309 15 150
3310 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
3311 # DD Metadata of columns in table
3312 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3313 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
3314 b 2 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
3315 c 3 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
3316 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3317 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3318 # DD Metadata of partitions in table
3319 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3320 p1 10 NULL
3321 p2 20 NULL
3322 # Metadata from INFORMATION_SCHEMA.TABLES
3323 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3324 test/t1#p#p1 6 0 1 2 3 3
3325 # Metadata from INFORMATION_SCHEMA.COLUMNS
3326 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3327 a 0 6 1283 0 0 0
3328 b 1 6 1027 0 0 0
3329 c 2 6 1027 1 1 0
3330 # Metadata from INFORMATION_SCHEMA.TABLES
3331 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3332 test/t1#p#p2 6 0 1 2 3 3
3333 # Metadata from INFORMATION_SCHEMA.COLUMNS
3334 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3335 a 0 6 1283 0 0 0
3336 b 1 6 1027 0 0 0
3337 c 2 6 1027 1 1 0
3338 ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN(30));
3339 INSERT INTO t1 (a, b) values (25, 250);
3340 SELECT * FROM t1 PARTITION (p1);
3341 a b c
3342 5 50 100
3343 SELECT * FROM t1 PARTITION (p2);
3344 a b c
3345 15 150 100
3346 SELECT * FROM t1 PARTITION (p3);
3347 a b c
3348 25 250 100
3349 alter table t1 drop column b, algorithm=instant;
3350 # DD Metadata of columns in table
3351 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3352 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
3353 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
3354 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3355 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3356 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;version_dropped=2;
3357 # DD Metadata of partitions in table
3358 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3359 p1 10 NULL
3360 p2 20 NULL
3361 p3 30 NULL
3362 # Metadata from INFORMATION_SCHEMA.TABLES
3363 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3364 test/t1#p#p1 5 0 2 2 2 3
3365 # Metadata from INFORMATION_SCHEMA.COLUMNS
3366 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3367 a 0 6 1283 0 0 0
3368 c 1 6 1027 1 1 0
3369 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3370 # Metadata from INFORMATION_SCHEMA.TABLES
3371 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3372 test/t1#p#p2 5 0 2 2 2 3
3373 # Metadata from INFORMATION_SCHEMA.COLUMNS
3374 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3375 a 0 6 1283 0 0 0
3376 c 1 6 1027 1 1 0
3377 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3378 # Metadata from INFORMATION_SCHEMA.TABLES
3379 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3380 test/t1#p#p3 5 0 2 2 2 3
3381 # Metadata from INFORMATION_SCHEMA.COLUMNS
3382 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3383 a 0 6 1283 0 0 0
3384 c 1 6 1027 1 1 0
3385 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3386 SELECT * FROM t1;
3387 a c
3388 5 100
3389 15 100
3390 25 100
3391 ALTER TABLE t1 TRUNCATE PARTITION p1;
3392 # DD Metadata of columns in table
3393 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3394 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
3395 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
3396 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3397 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3398 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
3399 # DD Metadata of partitions in table
3400 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3401 p1 10 NULL
3402 p2 20 NULL
3403 p3 30 NULL
3404 # Metadata from INFORMATION_SCHEMA.TABLES
3405 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3406 test/t1#p#p1 5 0 2 2 2 3
3407 # Metadata from INFORMATION_SCHEMA.COLUMNS
3408 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3409 a 0 6 1283 0 0 0
3410 c 1 6 1027 1 1 0
3411 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3412 # Metadata from INFORMATION_SCHEMA.TABLES
3413 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3414 test/t1#p#p2 5 0 2 2 2 3
3415 # Metadata from INFORMATION_SCHEMA.COLUMNS
3416 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3417 a 0 6 1283 0 0 0
3418 c 1 6 1027 1 1 0
3419 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3420 # Metadata from INFORMATION_SCHEMA.TABLES
3421 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3422 test/t1#p#p3 5 0 2 2 2 3
3423 # Metadata from INFORMATION_SCHEMA.COLUMNS
3424 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3425 a 0 6 1283 0 0 0
3426 c 1 6 1027 1 1 0
3427 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3428 SELECT * FROM t1;
3429 a c
3430 15 100
3431 25 100
3432 ALTER TABLE t1 TRUNCATE PARTITION p3;
3433 # DD Metadata of columns in table
3434 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3435 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
3436 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
3437 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3438 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3439 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
3440 # DD Metadata of partitions in table
3441 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3442 p1 10 NULL
3443 p2 20 NULL
3444 p3 30 NULL
3445 # Metadata from INFORMATION_SCHEMA.TABLES
3446 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3447 test/t1#p#p1 5 0 2 2 2 3
3448 # Metadata from INFORMATION_SCHEMA.COLUMNS
3449 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3450 a 0 6 1283 0 0 0
3451 c 1 6 1027 1 1 0
3452 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3453 # Metadata from INFORMATION_SCHEMA.TABLES
3454 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3455 test/t1#p#p2 5 0 2 2 2 3
3456 # Metadata from INFORMATION_SCHEMA.COLUMNS
3457 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3458 a 0 6 1283 0 0 0
3459 c 1 6 1027 1 1 0
3460 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3461 # Metadata from INFORMATION_SCHEMA.TABLES
3462 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3463 test/t1#p#p3 5 0 2 2 2 3
3464 # Metadata from INFORMATION_SCHEMA.COLUMNS
3465 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3466 a 0 6 1283 0 0 0
3467 c 1 6 1027 1 1 0
3468 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
3469 SELECT * FROM t1;
3470 a c
3471 15 100
3472 TRUNCATE TABLE t1;
3473 # DD Metadata of columns in table
3474 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3475 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
3476 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3477 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3478 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
3479 # DD Metadata of partitions in table
3480 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3481 p1 10 NULL
3482 p2 20 NULL
3483 p3 30 NULL
3484 # Metadata from INFORMATION_SCHEMA.TABLES
3485 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3486 test/t1#p#p1 5 0 0 2 2 2
3487 # Metadata from INFORMATION_SCHEMA.COLUMNS
3488 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3489 a 0 6 1283 0 0 0
3490 c 1 6 1027 0 0 0
3491 # Metadata from INFORMATION_SCHEMA.TABLES
3492 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3493 test/t1#p#p2 5 0 0 2 2 2
3494 # Metadata from INFORMATION_SCHEMA.COLUMNS
3495 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3496 a 0 6 1283 0 0 0
3497 c 1 6 1027 0 0 0
3498 # Metadata from INFORMATION_SCHEMA.TABLES
3499 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3500 test/t1#p#p3 5 0 0 2 2 2
3501 # Metadata from INFORMATION_SCHEMA.COLUMNS
3502 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3503 a 0 6 1283 0 0 0
3504 c 1 6 1027 0 0 0
3505 SELECT * FROM t1;
3506 a c
3507 TRUNCATE TABLE t1;
3508 ALTER TABLE t1 TRUNCATE PARTITION p1;
3509 ALTER TABLE t1 TRUNCATE PARTITION p3;
3510 # DD Metadata of columns in table
3511 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3512 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
3513 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3514 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3515 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
3516 # DD Metadata of partitions in table
3517 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3518 p1 10 NULL
3519 p2 20 NULL
3520 p3 30 NULL
3521 # Metadata from INFORMATION_SCHEMA.TABLES
3522 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3523 test/t1#p#p1 5 0 0 2 2 2
3524 # Metadata from INFORMATION_SCHEMA.COLUMNS
3525 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3526 a 0 6 1283 0 0 0
3527 c 1 6 1027 0 0 0
3528 # Metadata from INFORMATION_SCHEMA.TABLES
3529 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3530 test/t1#p#p2 5 0 0 2 2 2
3531 # Metadata from INFORMATION_SCHEMA.COLUMNS
3532 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3533 a 0 6 1283 0 0 0
3534 c 1 6 1027 0 0 0
3535 # Metadata from INFORMATION_SCHEMA.TABLES
3536 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3537 test/t1#p#p3 5 0 0 2 2 2
3538 # Metadata from INFORMATION_SCHEMA.COLUMNS
3539 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3540 a 0 6 1283 0 0 0
3541 c 1 6 1027 0 0 0
3542 SELECT * FROM t1;
3543 a c
3544 DROP TABLE t1;
3545 # Scenario 64
3546 # When nullbitmap size on physical record changes after INSTANT ADD columns.
3547 CREATE TABLE t1 (c0 char(9) KEY, c1 char (10), c2 char(20), c3 char(30), c4 char(40), c5 char(50), c6 char(60), c7 char(70), c8 char(80)) ROW_FORMAT=DYNAMIC;
3548 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
3549 Insert into t1 values(
3550 REPEAT("a", 8),
3551 REPEAT("1", 9),
3552 REPEAT("2", 19),
3553 REPEAT("3", 29),
3554 REPEAT("4", 39),
3555 REPEAT("5", 49),
3556 REPEAT("6", 59),
3557 REPEAT("7", 69),
3558 REPEAT("8", 79));
3559 Insert into t1 values(
3560 REPEAT("b", 8),
3561 REPEAT("1", 9),
3562 REPEAT("2", 19),
3563 REPEAT("3", 29),
3564 REPEAT("4", 39),
3565 REPEAT("5", 49),
3566 REPEAT("6", 59),
3567 REPEAT("7", 69),
3568 REPEAT("8", 79));
3569 Alter table t1 add column c9 char(90);
3570 Insert into t1 values(
3571 REPEAT("c", 8),
3572 REPEAT("1", 9),
3573 REPEAT("2", 19),
3574 REPEAT("3", 29),
3575 REPEAT("4", 39),
3576 REPEAT("5", 49),
3577 REPEAT("6", 59),
3578 REPEAT("7", 69),
3579 REPEAT("8", 79),
3580 REPEAT("9", 89));
3581 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
3582 DROP table t1;
3583 # Scenario 65
3584 # Truncate all partition shall reset INSTANT Metadata
3585 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT) ROW_FORMAT=DYNAMIC PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300), PARTITION p3 VALUES LESS THAN MAXVALUE);
3586 INSERT INTO t1 VALUES (90, 1, 1, "1"), (190, 1, 1, "2"), (290, 1, 1, "3"), (390, 1, 1, "3");
3587 Alter table t1 add column c5 int, algorithm=INSTANT;
3588 Alter table t1 drop column c3, algorithm=INSTANT;
3589 # DD Metadata of columns in table
3590 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3591 c1 1 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
3592 c2 2 MYSQL_TYPE_LONG 0 Visible physical_pos=4;table_id=TABLE_ID;
3593 c4 3 MYSQL_TYPE_BLOB 0 Visible physical_pos=6;table_id=TABLE_ID;
3594 c5 4 MYSQL_TYPE_LONG 0 Visible default_null=1;physical_pos=7;table_id=TABLE_ID;version_added=1;
3595 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
3596 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3597 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3598 !hidden!_dropped_v2_p5_c3 8 MYSQL_TYPE_LONG 0 SE physical_pos=5;version_dropped=2;
3599 # DD Metadata of partitions in table
3600 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3601 p0 100 NULL
3602 p1 200 NULL
3603 p2 300 NULL
3604 p3 MAXVALUE NULL
3605 # Metadata from INFORMATION_SCHEMA.TABLES
3606 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3607 test/t1#p#p0 7 0 2 4 4 5
3608 # Metadata from INFORMATION_SCHEMA.COLUMNS
3609 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3610 c1 0 6 1027 0 0 0
3611 c2 1 6 1027 0 0 0
3612 c4 2 5 16711932 0 0 0
3613 c5 3 6 1027 1 1 0
3614 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
3615 # Metadata from INFORMATION_SCHEMA.TABLES
3616 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3617 test/t1#p#p1 7 0 2 4 4 5
3618 # Metadata from INFORMATION_SCHEMA.COLUMNS
3619 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3620 c1 0 6 1027 0 0 0
3621 c2 1 6 1027 0 0 0
3622 c4 2 5 16711932 0 0 0
3623 c5 3 6 1027 1 1 0
3624 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
3625 # Metadata from INFORMATION_SCHEMA.TABLES
3626 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3627 test/t1#p#p2 7 0 2 4 4 5
3628 # Metadata from INFORMATION_SCHEMA.COLUMNS
3629 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3630 c1 0 6 1027 0 0 0
3631 c2 1 6 1027 0 0 0
3632 c4 2 5 16711932 0 0 0
3633 c5 3 6 1027 1 1 0
3634 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
3635 # Metadata from INFORMATION_SCHEMA.TABLES
3636 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3637 test/t1#p#p3 7 0 2 4 4 5
3638 # Metadata from INFORMATION_SCHEMA.COLUMNS
3639 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3640 c1 0 6 1027 0 0 0
3641 c2 1 6 1027 0 0 0
3642 c4 2 5 16711932 0 0 0
3643 c5 3 6 1027 1 1 0
3644 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
3645 ALTER TABLE t1 TRUNCATE partition p0, p1, p2, p3;
3646 # DD Metadata of columns in table
3647 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3648 c1 1 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3649 c2 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3650 c4 3 MYSQL_TYPE_BLOB 0 Visible table_id=TABLE_ID;
3651 c5 4 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
3652 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3653 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3654 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
3655 # DD Metadata of partitions in table
3656 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
3657 p0 100 NULL
3658 p1 200 NULL
3659 p2 300 NULL
3660 p3 MAXVALUE NULL
3661 # Metadata from INFORMATION_SCHEMA.TABLES
3662 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3663 test/t1#p#p0 7 0 0 4 4 4
3664 # Metadata from INFORMATION_SCHEMA.COLUMNS
3665 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3666 c1 0 6 1027 0 0 0
3667 c2 1 6 1027 0 0 0
3668 c4 2 5 16711932 0 0 0
3669 c5 3 6 1027 0 0 0
3670 # Metadata from INFORMATION_SCHEMA.TABLES
3671 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3672 test/t1#p#p1 7 0 0 4 4 4
3673 # Metadata from INFORMATION_SCHEMA.COLUMNS
3674 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3675 c1 0 6 1027 0 0 0
3676 c2 1 6 1027 0 0 0
3677 c4 2 5 16711932 0 0 0
3678 c5 3 6 1027 0 0 0
3679 # Metadata from INFORMATION_SCHEMA.TABLES
3680 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3681 test/t1#p#p2 7 0 0 4 4 4
3682 # Metadata from INFORMATION_SCHEMA.COLUMNS
3683 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3684 c1 0 6 1027 0 0 0
3685 c2 1 6 1027 0 0 0
3686 c4 2 5 16711932 0 0 0
3687 c5 3 6 1027 0 0 0
3688 # Metadata from INFORMATION_SCHEMA.TABLES
3689 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3690 test/t1#p#p3 7 0 0 4 4 4
3691 # Metadata from INFORMATION_SCHEMA.COLUMNS
3692 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3693 c1 0 6 1027 0 0 0
3694 c2 1 6 1027 0 0 0
3695 c4 2 5 16711932 0 0 0
3696 c5 3 6 1027 0 0 0
3697 DROP TABLE t1;
3698 # Scenario 66
3699 # Purge crash
3700 create table t1 (c0 INT KEY, c1 varchar(10), c2 varchar(10)) ROW_FORMAT=DYNAMIC;
3701 alter table t1 add column c4 char(10), algorithm=instant;
3702 alter table t1 add index idx (c4);
3703 insert into t1 values (1, "r1c1", "r1c2", "c4");
3704 SET GLOBAL innodb_purge_stop_now=ON;
3705 Update t1 set c2="r122222", c4="c44";
3706 alter table t1 drop column c2, algorithm=instant;
3707 SET GLOBAL innodb_purge_run_now=ON;
3708 DROP TABLE t1;
3709 # Scenario 66
3710 # Inplace update is failing
3711 # INSTANT ADD and INPLACE UPDATE
3712 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC;
3713 Insert into t1 values ("r1c1", "r1c2", "r1c3");
3714 Select * from t1;
3715 c1 c2 c3
3716 r1c1 r1c2 r1c3
3717 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
3718 Select * from t1;
3719 c1 c4 c2 c3
3720 r1c1 NULL r1c2 r1c3
3721 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
3722 Select * from t1;
3723 c1 c4 c2 c3
3724 r1c1 NULL r1c2 r1c3
3725 r2c1 r2c4 r2c2 r2c3
3726 # Disable flush to make sure REDO is applied after restart
3727 Update t1 set c2="r112" where c2="r1c2";
3728 Update t1 set c2="r212" where c2="r2c2";
3729 Select * from t1;
3730 c1 c4 c2 c3
3731 r1c1 NULL r112 r1c3
3732 r2c1 r2c4 r212 r2c3
3733 # Kill the running server
3734 # Kill the server
3735 # Start the server
3736 Select * from t1;
3737 c1 c4 c2 c3
3738 r1c1 NULL r112 r1c3
3739 r2c1 r2c4 r212 r2c3
3740 DROP TABLE t1;
3741 # INSTANT DROP and INPLACE UPDATE
3742 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC;
3743 Insert into t1 values ("r1c1", "r1c2", "r1c3");
3744 Select * from t1;
3745 c1 c2 c3
3746 r1c1 r1c2 r1c3
3747 Alter table t1 drop column c1, algorithm=instant;
3748 Insert into t1 values ("r2c2", "r2c3");
3749 Select * from t1;
3750 c2 c3
3751 r1c2 r1c3
3752 r2c2 r2c3
3753 SET GLOBAL innodb_log_checkpoint_now = ON;
3754 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
3755 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
3756 SET GLOBAL innodb_master_thread_disabled_debug = 1;
3757 Update t1 set c2="r112" where c2="r1c2";
3758 Update t1 set c2="r212" where c2="r2c2";
3759 Select * from t1;
3760 c2 c3
3761 r112 r1c3
3762 r212 r2c3
3763 # Kill the running server
3764 # Kill the server
3765 # Start the server
3766 Select * from t1;
3767 c2 c3
3768 r112 r1c3
3769 r212 r2c3
3770 DROP TABLE t1;
3771 # INSTANT ADD and DROP and INPLACE UPDATE
3772 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=DYNAMIC;
3773 Insert into t1 values ("r1c1", "r1c2", "r1c3");
3774 Select * from t1;
3775 c1 c2 c3
3776 r1c1 r1c2 r1c3
3777 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
3778 Select * from t1;
3779 c1 c4 c2 c3
3780 r1c1 NULL r1c2 r1c3
3781 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
3782 Select * from t1;
3783 c1 c4 c2 c3
3784 r1c1 NULL r1c2 r1c3
3785 r2c1 r2c4 r2c2 r2c3
3786 Alter table t1 drop column c1, algorithm=instant;
3787 Select * from t1;
3788 c4 c2 c3
3789 NULL r1c2 r1c3
3790 r2c4 r2c2 r2c3
3791 Insert into t1 values ("r3c4", "r3c2", "r3c3");
3792 Select * from t1;
3793 c4 c2 c3
3794 NULL r1c2 r1c3
3795 r2c4 r2c2 r2c3
3796 r3c4 r3c2 r3c3
3797 SET GLOBAL innodb_log_checkpoint_now = ON;
3798 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
3799 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
3800 SET GLOBAL innodb_master_thread_disabled_debug = 1;
3801 Update t1 set c2="r112" where c2="r1c2";
3802 Update t1 set c2="r212" where c2="r2c2";
3803 Update t1 set c2="r312" where c2="r3c2";
3804 Select * from t1;
3805 c4 c2 c3
3806 NULL r112 r1c3
3807 r2c4 r212 r2c3
3808 r3c4 r312 r3c3
3809 # Kill the running server
3810 # Kill the server
3811 # Start the server
3812 Select * from t1;
3813 c4 c2 c3
3814 NULL r112 r1c3
3815 r2c4 r212 r2c3
3816 r3c4 r312 r3c3
3817 DROP TABLE t1;
3818 ###########
3819 # CLEANUP #
3820 ###########
3821 ############################################
3822 # Test instant ADD/DROP COLUMN for COMPACT format
3823 ############################################
3824 SET SESSION debug= '+d,show_dropped_column';
3825 # Scenario 1
3826 create table t1 (c1 char(10), c2 char(10));
3827 # Metadata from INFORMATION_SCHEMA.TABLES
3828 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3829 test/t1 5 0 0 2 2 2
3830 # Metadata from INFORMATION_SCHEMA.COLUMNS
3831 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3832 c1 0 13 16711934 0 0 0
3833 c2 1 13 16711934 0 0 0
3834 # DD Metadata of table
3835 NAME SE_PRIVATE_DATA
3836 t1 NULL
3837 # DD Metadata of columns in table
3838 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3839 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
3840 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
3841 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3842 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
3843 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
3844 insert into t1 values ("r1c1", "r1c2");
3845 select * from t1;
3846 c1 c2
3847 r1c1 r1c2
3848 alter table t1 add column c3 char(10) default "def_c3" after c1;
3849 # Metadata from INFORMATION_SCHEMA.TABLES
3850 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3851 test/t1 6 0 1 2 3 3
3852 # Metadata from INFORMATION_SCHEMA.COLUMNS
3853 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3854 c1 0 13 16711934 0 0 0
3855 c3 1 13 16711934 1 1 0
3856 c2 2 13 16711934 0 0 0
3857 # DD Metadata of table
3858 NAME SE_PRIVATE_DATA
3859 t1 NULL
3860 # DD Metadata of columns in table
3861 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3862 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
3863 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
3864 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
3865 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
3866 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3867 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3868 insert into t1 values ("r2c1", "r2c3", "r2c2");
3869 select * from t1;
3870 c1 c3 c2
3871 r1c1 def_c3 r1c2
3872 r2c1 r2c3 r2c2
3873 drop table t1;
3874 # Scenario 2
3875 create table t1 (c1 char(10), c2 char(10), c3 char(10));
3876 insert into t1 values ("r1c1", "r1c2", "r1c3");
3877 alter table t1 drop column c2;
3878 # Metadata from INFORMATION_SCHEMA.TABLES
3879 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3880 test/t1 5 0 1 3 2 3
3881 # Metadata from INFORMATION_SCHEMA.COLUMNS
3882 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3883 c1 0 13 16711934 0 0 0
3884 c3 1 13 16711934 0 0 0
3885 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
3886 # DD Metadata of table
3887 NAME SE_PRIVATE_DATA
3888 t1 NULL
3889 # DD Metadata of columns in table
3890 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3891 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
3892 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
3893 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
3894 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3895 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
3896 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
3897 select * from t1;
3898 c1 c3
3899 r1c1 r1c3
3900 drop table t1;
3901 # Scenario 3
3902 create table t1 (c1 char(10), c2 char(10));
3903 insert into t1 values ("r1c1", "r1c2");
3904 select * from t1;
3905 c1 c2
3906 r1c1 r1c2
3907 alter table t1 add column c3 char(10) default "def_c3" after c1, algorithm=INSTANT;
3908 insert into t1 values ("r2c1", "r2c3", "r2c2");
3909 select * from t1;
3910 c1 c3 c2
3911 r1c1 def_c3 r1c2
3912 r2c1 r2c3 r2c2
3913 alter table t1 drop column c2, algorithm=INSTANT;
3914 select * from t1;
3915 c1 c3
3916 r1c1 def_c3
3917 r2c1 r2c3
3918 drop table t1;
3919 # Scenario 4
3920 create table t1 (c1 char(10), c2 char(10), c3 char(10));
3921 insert into t1 values ("r1c1", "r1c2", "r1c3");
3922 select * from t1;
3923 c1 c2 c3
3924 r1c1 r1c2 r1c3
3925 alter table t1 drop column c2;
3926 select * from t1;
3927 c1 c3
3928 r1c1 r1c3
3929 drop table t1;
3930 # Scenario 5
3931 create table t1 (c1 char(10), c2 char(10));
3932 insert into t1 values ("r1c1", "r1c2");
3933 alter table t1 add column c3 char(10) default "def_c3" after c1;
3934 select * from t1;
3935 c1 c3 c2
3936 r1c1 def_c3 r1c2
3937 insert into t1 value ("r2c1", "r2c3", "r2c2");
3938 alter table t1 drop column c2;
3939 select * from t1;
3940 c1 c3
3941 r1c1 def_c3
3942 r2c1 r2c3
3943 drop table t1;
3944 # Scenario 6
3945 create table t1 (c1 char(10), c2 char(10));
3946 insert into t1 values ("r1c1", "r1c2");
3947 alter table t1 add column c2 char(10) default "def_c3", drop column c2;
3948 select * from t1;
3949 c1 c2
3950 r1c1 def_c3
3951 insert into t1 value ("r2c1", "r2c2");
3952 select * from t1;
3953 c1 c2
3954 r1c1 def_c3
3955 r2c1 r2c2
3956 drop table t1;
3957 # Scenario 7
3958 create table t1 (c1 char(10), c2 char(10));
3959 insert into t1 values ("r1c1", "r1c2");
3960 alter table t1 add column c3 int after c1;
3961 select * from t1;
3962 c1 c3 c2
3963 r1c1 NULL r1c2
3964 insert into t1 value ("r2c1", 3, "r2c2");
3965 select * from t1;
3966 c1 c3 c2
3967 r1c1 NULL r1c2
3968 r2c1 3 r2c2
3969 alter table t1 drop column c2;
3970 select * from t1;
3971 c1 c3
3972 r1c1 NULL
3973 r2c1 3
3974 drop table t1;
3975 # Scenario 8
3976 create table t1 (c1 char(10), c2 char(10), c3 char(10));
3977 insert into t1 values ("r1c1", NULL, "r1c3");
3978 select * from t1;
3979 c1 c2 c3
3980 r1c1 NULL r1c3
3981 alter table t1 drop column c2;
3982 # Metadata from INFORMATION_SCHEMA.TABLES
3983 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
3984 test/t1 5 0 1 3 2 3
3985 # Metadata from INFORMATION_SCHEMA.COLUMNS
3986 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
3987 c1 0 13 16711934 0 0 0
3988 c3 1 13 16711934 0 0 0
3989 !hidden!_dropped_v1_p4_c2 5 13 16711934 0 0 1
3990 # DD Metadata of table
3991 NAME SE_PRIVATE_DATA
3992 t1 NULL
3993 # DD Metadata of columns in table
3994 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
3995 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
3996 c3 2 MYSQL_TYPE_STRING 0 Visible physical_pos=5;table_id=TABLE_ID;
3997 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
3998 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
3999 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
4000 !hidden!_dropped_v1_p4_c2 6 MYSQL_TYPE_STRING 0 SE physical_pos=4;version_dropped=1;
4001 select * from t1;
4002 c1 c3
4003 r1c1 r1c3
4004 drop table t1;
4005 # Scenario 9
4006 CREATE TABLE t1 (C1 char(10), C2 char(10), C3 char(10)) ROW_FORMAT=COMPACT;
4007 INSERT INTO t1 values ("r1c1", "r1c2", "r1c3");
4008 alter table t1 drop column c1;
4009 select * from t1;
4010 C2 C3
4011 r1c2 r1c3
4012 alter table t1 drop column c3;
4013 select * from t1;
4014 C2
4015 r1c2
4016 drop table t1;
4017 # Scenario 10
4018 create table t1 (c1 char(10) KEY, c2 char(10), key sec_idx(c2));
4019 insert into t1 values ("r1c1", "r1c2");
4020 select * from t1;
4021 c1 c2
4022 r1c1 r1c2
4023 alter table t1 add column c3 char(10) default "def_c3";
4024 select * from t1;
4025 c1 c2 c3
4026 r1c1 r1c2 def_c3
4027 insert into t1 values ("r2c1", "r2c2", "r3c3");
4028 drop table t1;
4029 # Scenario 11
4030 CREATE TABLE t1(c2 char(100) , FULLTEXT INDEX `idx1` (c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
4031 ALTER TABLE t1 DROP INDEX idx1;
4032 DROP TABLE t1;
4033 # Scenario 12
4034 CREATE TABLE t1(c2 char(100)) ROW_FORMAT=COMPACT;
4035 ALTER TABLE t1 ADD FULLTEXT INDEX `ft_idx` (c2);
4036 Warnings:
4037 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
4038 DROP TABLE t1;
4039 # Scenario 13
4040 CREATE TABLE t1(a INT) ROW_FORMAT=COMPACT;
4041 INSERT INTO t1 VALUES(1);
4042 ALTER TABLE t1 add COLUMN (f INT generated always as (a+1) virtual, g INT );
4043 ALTER TABLE t1 add COLUMN (h INT generated always as (a+1) virtual), add INDEX idx (h), algorithm=inplace;
4044 DROP TABLE t1;
4045 # Scenario 14
4046 CREATE TABLE t1 (col1 int(11) DEFAULT NULL, col2 int(11) DEFAULT NULL, col3 int(11) DEFAULT NULL, col4 int(11) DEFAULT NULL, col5 int(11) GENERATED ALWAYS AS (col4 * col2) VIRTUAL, col6 int(11) GENERATED ALWAYS AS (col2 % col4) VIRTUAL, col7 int(11) GENERATED ALWAYS AS (col5 / col6) VIRTUAL, col8 int(11) GENERATED ALWAYS AS (col5 + col5) VIRTUAL, col9 text, extra int(11) DEFAULT NULL) ROW_FORMAT=COMPACT;
4047 Warnings:
4048 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4049 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4050 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4051 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4052 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4053 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4054 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4055 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4056 Warning 1681 Integer display width is deprecated and will be removed in a future release.
4057 ALTER TABLE t1 DROP COLUMN col7;
4058 ALTER TABLE t1 DROP COLUMN col6, DROP COLUMN col9;
4059 DROP TABLE t1;
4060 # Scenario 15
4061 create table t1(a text, b text, fulltext(a,b));
4062 insert into t1 values('text1', 'text2');
4063 insert into t1 values('test1', 'test2');
4064 alter table t1 add fulltext(b);
4065 drop table t1;
4066 # Scenario 16
4067 CREATE TABLE t1 (a serial key, b text) ROW_FORMAT=COMPACT;
4068 INSERT INTO t1(b) VALUES(repeat("a short string - ",5));
4069 INSERT INTO t1(b) VALUES(repeat("a long string - ",50));
4070 INSERT INTO t1(b) SELECT b FROM t1;
4071 ALTER TABLE t1 ADD COLUMN (c int), algorithm=INSTANT;
4072 ALTER TABLE t1 ADD INDEX c (c), algorithm=INSTANT;
4073 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
4074 ALTER TABLE t1 ADD INDEX c (c), algorithm=INPLACE;
4075 DROP TABLE t1;
4076 # Scenario 17
4077 CREATE TABLE t1 (c1 char(20), c2 char(20), c3 char(20), c4 char(20)) ROW_FORMAT=COMPACT;
4078 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
4079 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
4080 ALTER TABLE test.t1 ADD c6 char(20), DROP COLUMN c3;
4081 DROP TABLE t1;
4082 # Scenario 18
4083 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) ROW_FORMAT=COMPACT;
4084 ALTER TABLE t1 DISCARD TABLESPACE;
4085 ALTER TABLE t1 ADD FULLTEXT INDEX (ct), ALGORITHM=INPLACE;
4086 Warnings:
4087 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
4088 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
4089 ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1, ALGORITHM=INPLACE;
4090 Warnings:
4091 Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
4092 DROP TABLE t1;
4093 # Scenario 19
4094 CREATE TABLE t1 (a INT, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
4095 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 FIRST;
4096 ALTER TABLE t1 CHANGE aa e INT;
4097 INSERT INTO t1 VALUES (1,1,1,1,1);
4098 ALTER TABLE t1 ADD COLUMN a INT DEFAULT 1 FIRST, DROP COLUMN a, CHANGE b b INT;
4099 ALTER TABLE t1 ADD COLUMN aa INT DEFAULT 1 AFTER a, DROP COLUMN b, CHANGE c c INT;
4100 ALTER TABLE t1 CHANGE aa b INT;
4101 DROP TABLE t1;
4102 # Scenario 20
4103 CREATE TABLE t1 (a varchar(512) NOT NULL, b varchar(512) NOT NULL, FULLTEXT KEY fts_idx (a)) ROW_FORMAT=COMPACT;
4104 ALTER TABLE t1 DROP KEY fts_idx;
4105 ALTER TABLE t1 ADD COLUMN b_hash char(64) AS(b) VIRTUAL NOT NULL;
4106 DROP TABLE t1;
4107 # Scenario 21
4108 CREATE PROCEDURE test.fill_table (IN start INT) BEGIN SET @idx =start; WHILE (@idx > 0) DO INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa"); SET @idx = @idx - 1; END WHILE; END|
4109 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=COMPACT;
4110 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
4111 call fill_table(400);
4112 DROP PROCEDURE test.fill_table;
4113 DROP TABLE t1;
4114 # Scenario 22
4115 CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ROW_FORMAT=COMPACT;
4116 ALTER TABLE t1 ADD COLUMN v VARCHAR(255) DEFAULT "default_value", ALGORITHM=INSTANT;
4117 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
4118 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
4119 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
4120 INSERT INTO test.t1 (v) VALUES("aaaaaaaaaaaaa");
4121 SELECT * FROM t1;
4122 id v
4123 1 aaaaaaaaaaaaa
4124 2 aaaaaaaaaaaaa
4125 3 aaaaaaaaaaaaa
4126 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
4127 DROP TABLE t1;
4128 # Scenario 23
4129 create table t1 (c1 char(10), c2 char(10));
4130 # Metadata from INFORMATION_SCHEMA.TABLES
4131 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4132 test/t1 5 0 0 2 2 2
4133 # Metadata from INFORMATION_SCHEMA.COLUMNS
4134 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
4135 c1 0 13 16711934 0 0 0
4136 c2 1 13 16711934 0 0 0
4137 # DD Metadata of table
4138 NAME SE_PRIVATE_DATA
4139 t1 NULL
4140 # DD Metadata of columns in table
4141 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
4142 c1 1 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
4143 c2 2 MYSQL_TYPE_STRING 0 Visible table_id=TABLE_ID;
4144 DB_ROW_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
4145 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
4146 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
4147 insert into t1 values ("r1c1", "r1c2");
4148 select * from t1;
4149 c1 c2
4150 r1c1 r1c2
4151 alter table t1 add column c3 char(10) default "def_c3" after c1;
4152 # Metadata from INFORMATION_SCHEMA.TABLES
4153 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4154 test/t1 6 0 1 2 3 3
4155 # Metadata from INFORMATION_SCHEMA.COLUMNS
4156 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
4157 c1 0 13 16711934 0 0 0
4158 c3 1 13 16711934 1 1 0
4159 c2 2 13 16711934 0 0 0
4160 # DD Metadata of table
4161 NAME SE_PRIVATE_DATA
4162 t1 NULL
4163 # DD Metadata of columns in table
4164 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
4165 c1 1 MYSQL_TYPE_STRING 0 Visible physical_pos=3;table_id=TABLE_ID;
4166 c3 2 MYSQL_TYPE_STRING 0 Visible default=6465665f633320202020;physical_pos=5;table_id=TABLE_ID;version_added=1;
4167 c2 3 MYSQL_TYPE_STRING 0 Visible physical_pos=4;table_id=TABLE_ID;
4168 DB_ROW_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
4169 DB_TRX_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
4170 DB_ROLL_PTR 6 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
4171 insert into t1 values ("r2c1", "r2c3", "r2c2");
4172 select * from t1;
4173 c1 c3 c2
4174 r1c1 def_c3 r1c2
4175 r2c1 r2c3 r2c2
4176 alter table t1 add column c3 char(10) default "newnewnew", drop column c3;
4177 select * from t1;
4178 c1 c2 c3
4179 r1c1 r1c2 newnewnew
4180 r2c1 r2c2 newnewnew
4181 DROP TABLE t1;
4182 # Scenario 24
4183 CREATE TABLE t1 (c1 char(10)) ROW_FORMAT=COMPACT;
4184 ALTER TABLE t1 ADD COLUMN c2 INT;
4185 ALTER TABLE t1 DROP COLUMN c2;
4186 INSERT INTO t1 (c1) VALUES("aaaa");
4187 select * from t1;
4188 c1
4189 aaaa
4190 check table t1;
4191 Table Op Msg_type Msg_text
4192 test.t1 check status OK
4193 DROP TABLE t1;
4194 # Scenario 25
4195 CREATE TABLE t1 (c1 int, c2 char(10)) ROW_FORMAT=COMPACT PARTITION BY HASH (c1) PARTITIONS 2;
4196 alter table t1 drop column c2;
4197 DROP TABLE t1;
4198 # Scenario 26
4199 CREATE TABLE t1 (c1 char(10) KEY, c2 char(10)) ROW_FORMAT=COMPACT;
4200 INSERT INTO t1 values ("row1_c1", "row1_c2");
4201 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "default_c3", ALGORITHM=INSTANT;
4202 INSERT INTO t1 values ("row2_c1", "row2_c2", "row2_c3");
4203 ALTER TABLE t1 ADD COLUMN c4 char(20) DEFAULT NULL AFTER c1, ALGORITHM=INSTANT;
4204 INSERT INTO t1 values ("row3_c1", "row3_c4", "row3_c2", "row3_c3");
4205 ALTER TABLE t1 force;
4206 SELECT * FROM t1;
4207 c1 c4 c2 c3
4208 row1_c1 NULL row1_c2 default_c3
4209 row2_c1 NULL row2_c2 row2_c3
4210 row3_c1 row3_c4 row3_c2 row3_c3
4211 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
4212 ALTER TABLE t1 ADD COLUMN c5 INT after c2, ALGORITHM=INSTANT;
4213 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
4214 DROP TABLE t1;
4215 # Scenario 27
4216 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT;
4217 ALTER TABLE t1 ADD COLUMN c INT NOT NULL;
4218 ALTER TABLE t1 ADD COLUMN d VARCHAR(100);
4219 INSERT INTO t1 VALUES(0, 5, 20, 'Hello world');
4220 DROP TABLE t1;
4221 # Scenario 28
4222 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT;
4223 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
4224 SELECT * from t1;
4225 a b
4226 1 1
4227 2 2
4228 3 3
4229 4 4
4230 5 5
4231 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 100, ADD COLUMN d INT GENERATED ALWAYS AS ((c * 2 + b)) VIRTUAL, ADD COLUMN e VARCHAR(100) DEFAULT 'Hello world';
4232 SELECT * from t1;
4233 a b c d e
4234 1 1 100 201 Hello world
4235 2 2 100 202 Hello world
4236 3 3 100 203 Hello world
4237 4 4 100 204 Hello world
4238 5 5 100 205 Hello world
4239 UPDATE t1 SET c = 200 WHERE a > 3;
4240 SELECT * from t1;
4241 a b c d e
4242 1 1 100 201 Hello world
4243 2 2 100 202 Hello world
4244 3 3 100 203 Hello world
4245 4 4 200 404 Hello world
4246 5 5 200 405 Hello world
4247 DROP TABLE t1;
4248 # Scenario 29
4249 CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ROW_FORMAT=COMPACT;;
4250 INSERT INTO t1 VALUES(0, 1);
4251 SELECT * from t1;
4252 c1 c2
4253 1 1
4254 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
4255 SELECT * from t1;
4256 c1 c2 c3
4257 1 1 NULL
4258 ALTER TABLE t1 ADD COLUMN c4 CHAR(100), ALGORITHM=INSTANT;
4259 SELECT * from t1;
4260 c1 c2 c3 c4
4261 1 1 NULL NULL
4262 UPDATE t1 SET c3 = 2;
4263 SELECT * from t1;
4264 c1 c2 c3 c4
4265 1 1 2 NULL
4266 DROP TABLE t1;
4267 # Scenario 30
4268 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;;
4269 INSERT INTO t1 VALUES("r1c1", "r1c2");
4270 SELECT * from t1;
4271 c1 c2
4272 r1c1 r1c2
4273 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
4274 SELECT * from t1;
4275 c1 c2 c3
4276 r1c1 r1c2 NULL
4277 ALTER TABLE t1 ADD COLUMN c4 char(100), ALGORITHM=INSTANT;
4278 SELECT * from t1;
4279 c1 c2 c3 c4
4280 r1c1 r1c2 NULL NULL
4281 UPDATE t1 SET c3 = 2;
4282 SELECT * from t1;
4283 c1 c2 c3 c4
4284 r1c1 r1c2 2 NULL
4285 DROP TABLE t1;
4286 # Scenario 31
4287 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;
4288 INSERT INTO t1 VALUES("r1c1", "r1c2");
4289 ALTER TABLE t1 ADD COLUMN c3 char(10) default "def_c3";
4290 SELECT * from t1;
4291 c1 c2 c3
4292 r1c1 r1c2 def_c3
4293 UPDATE t1 SET c3 = "new_c3";
4294 SELECT * from t1;
4295 c1 c2 c3
4296 r1c1 r1c2 new_c3
4297 UPDATE t1 SET c3 = "new2_c3";
4298 SELECT * from t1;
4299 c1 c2 c3
4300 r1c1 r1c2 new2_c3
4301 DROP TABLE t1;
4302 # Scenario 32
4303 CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a, b)) ROW_FORMAT=COMPACT;
4304 INSERT INTO t1 VALUES(0, 1), (1, 2), (2, 3), (3, 4);
4305 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
4306 CHECK TABLE t1;
4307 Table Op Msg_type Msg_text
4308 test.t1 check status OK
4309 SELECT * FROM t1;
4310 a b c
4311 0 1 5
4312 1 2 5
4313 2 3 5
4314 3 4 5
4315 UPDATE t1 SET c = b WHERE b <= 2;
4316 CHECK TABLE t1;
4317 Table Op Msg_type Msg_text
4318 test.t1 check status OK
4319 SELECT * FROM t1;
4320 a b c
4321 0 1 1
4322 1 2 2
4323 2 3 5
4324 3 4 5
4325 DROP TABLE t1;
4326 # Scenario 33
4327 CREATE TABLE t1(c1 longtext) ROW_FORMAT=COMPACT;
4328 INSERT INTO t1 VALUES (repeat('x', 8098));
4329 SELECT SUBSTRING(c1, 1000, 32) FROM t1;
4330 SUBSTRING(c1, 1000, 32)
4331 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
4332 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
4333 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
4334 SUBSTRING(c1, 1000, 32) c2
4335 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
4336 BEGIN;
4337 UPDATE t1 SET c2 = 0;
4338 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
4339 SUBSTRING(c1, 1000, 32) c2
4340 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0
4341 ROLLBACK;
4342 SELECT SUBSTRING(c1, 1000, 32), c2 FROM t1;
4343 SUBSTRING(c1, 1000, 32) c2
4344 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NULL
4345 DROP TABLE t1;
4346 # Scenario 34
4347 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;
4348 INSERT INTO t1 VALUES("r1c1", "r1c2");
4349 SELECT * FROM t1;
4350 c1 c2
4351 r1c1 r1c2
4352 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
4353 SELECT * FROM t1;
4354 c1 c2 c3
4355 r1c1 r1c2 c3_def
4356 SET GLOBAL innodb_log_checkpoint_now = ON;
4357 START TRANSACTION;
4358 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
4359 SELECT * FROM t1;
4360 c1 c2 c3
4361 r1c1 r1c2 c3_def
4362 r2c1 r2c2 r2c3
4363 SET SESSION DEBUG="+d,crash_commit_after";
4364 COMMIT;
4365 ERROR HY000: Lost connection to MySQL server during query
4366 # restart
4367 CHECK TABLE t1;
4368 Table Op Msg_type Msg_text
4369 test.t1 check status OK
4370 SELECT * FROM t1;
4371 c1 c2 c3
4372 r1c1 r1c2 c3_def
4373 r2c1 r2c2 r2c3
4374 INSERT INTO t1 VALUES("r3c1", "r3c2", "r3c3");
4375 START TRANSACTION;
4376 UPDATE t1 SET c2 = "temp";
4377 SELECT * FROM t1;
4378 c1 c2 c3
4379 r1c1 temp c3_def
4380 r2c1 temp r2c3
4381 r3c1 temp r3c3
4382 SET SESSION DEBUG="+d,crash_commit_after";
4383 COMMIT;
4384 ERROR HY000: Lost connection to MySQL server during query
4385 # restart
4386 CHECK TABLE t1;
4387 Table Op Msg_type Msg_text
4388 test.t1 check status OK
4389 SELECT * FROM t1;
4390 c1 c2 c3
4391 r1c1 temp c3_def
4392 r2c1 temp r2c3
4393 r3c1 temp r3c3
4394 DROP TABLE t1;
4395 # Scenario 35
4396 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT;
4397 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
4398 ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10, algorithm=INSTANT;
4399 CHECK TABLE t1;
4400 Table Op Msg_type Msg_text
4401 test.t1 check status OK
4402 START TRANSACTION;
4403 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
4404 SELECT * FROM t1;
4405 a b c1
4406 1 1 10
4407 2 2 10
4408 3 3 10
4409 4 4 10
4410 5 5 10
4411 6 6 20
4412 7 7 20
4413 SET SESSION DEBUG="+d,crash_commit_after";
4414 COMMIT;
4415 ERROR HY000: Lost connection to MySQL server during query
4416 # restart
4417 CHECK TABLE t1;
4418 Table Op Msg_type Msg_text
4419 test.t1 check status OK
4420 SELECT * FROM t1;
4421 a b c1
4422 1 1 10
4423 2 2 10
4424 3 3 10
4425 4 4 10
4426 5 5 10
4427 6 6 20
4428 7 7 20
4429 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
4430 START TRANSACTION;
4431 UPDATE t1 SET b = 10;
4432 SELECT * FROM t1;
4433 a b c1
4434 1 10 10
4435 2 10 10
4436 3 10 10
4437 4 10 10
4438 5 10 10
4439 6 10 20
4440 7 10 20
4441 8 10 20
4442 9 10 20
4443 SET SESSION DEBUG="+d,crash_commit_after";
4444 COMMIT;
4445 ERROR HY000: Lost connection to MySQL server during query
4446 # restart
4447 CHECK TABLE t1;
4448 Table Op Msg_type Msg_text
4449 test.t1 check status OK
4450 SELECT * FROM t1;
4451 a b c1
4452 1 10 10
4453 2 10 10
4454 3 10 10
4455 4 10 10
4456 5 10 10
4457 6 10 20
4458 7 10 20
4459 8 10 20
4460 9 10 20
4461 DROP TABLE t1;
4462 # Scenario 36
4463 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;
4464 INSERT INTO t1 VALUES("r1c1", "r1c2");
4465 SELECT * FROM t1;
4466 c1 c2
4467 r1c1 r1c2
4468 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
4469 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
4470 SELECT * FROM t1;
4471 c1 c2 c3
4472 r1c1 r1c2 c3_def
4473 r2c1 r2c2 r2c3
4474 START TRANSACTION;
4475 UPDATE t1 SET c2 = "temp";
4476 SELECT * FROM t1;
4477 c1 c2 c3
4478 r1c1 temp c3_def
4479 r2c1 temp r2c3
4480 SET SESSION DEBUG="+d,crash_commit_after";
4481 COMMIT;
4482 ERROR HY000: Lost connection to MySQL server during query
4483 # restart
4484 CHECK TABLE t1;
4485 Table Op Msg_type Msg_text
4486 test.t1 check status OK
4487 SELECT * FROM t1;
4488 c1 c2 c3
4489 r1c1 temp c3_def
4490 r2c1 temp r2c3
4491 DROP TABLE t1;
4492 # Scenario 37
4493 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;
4494 INSERT INTO t1 VALUES("r1c1", "r1c2");
4495 SELECT * FROM t1;
4496 c1 c2
4497 r1c1 r1c2
4498 ALTER TABLE t1 ADD COLUMN c3 char(10) DEFAULT "c3_def", ALGORITHM=INSTANT;
4499 INSERT INTO t1 VALUES("r2c1", "r2c2", "r2c3");
4500 SELECT * FROM t1;
4501 c1 c2 c3
4502 r1c1 r1c2 c3_def
4503 r2c1 r2c2 r2c3
4504 SET GLOBAL innodb_log_checkpoint_now = ON;
4505 START TRANSACTION;
4506 UPDATE t1 SET c3 = "temp";
4507 SELECT * FROM t1;
4508 c1 c2 c3
4509 r1c1 r1c2 temp
4510 r2c1 r2c2 temp
4511 SET SESSION DEBUG="+d,crash_commit_after";
4512 COMMIT;
4513 ERROR HY000: Lost connection to MySQL server during query
4514 # restart
4515 CHECK TABLE t1;
4516 Table Op Msg_type Msg_text
4517 test.t1 check status OK
4518 SELECT * FROM t1;
4519 c1 c2 c3
4520 r1c1 r1c2 temp
4521 r2c1 r2c2 temp
4522 DROP TABLE t1;
4523 # Scenario 38
4524 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=COMPACT PARTITION BY RANGE(col1 * 2) ( PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256) , PARTITION p2 VALUES LESS THAN (384) , PARTITION p3 VALUES LESS THAN MAXVALUE);;
4525 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
4526 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
4527 CHECK TABLE t1;
4528 Table Op Msg_type Msg_text
4529 test.t1 check status OK
4530 SELECT count(*) AS `Expect 4` FROM information_schema.innodb_tables WHERE instant_cols != 0;
4531 Expect 4
4532 0
4533 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
4534 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
4535 Expect 3
4536 0
4537 CHECK TABLE t1;
4538 Table Op Msg_type Msg_text
4539 test.t1 check status OK
4540 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
4541 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
4542 Expect 3
4543 0
4544 CHECK TABLE t1;
4545 Table Op Msg_type Msg_text
4546 test.t1 check status OK
4547 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
4548 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
4549 Expect 3
4550 0
4551 CHECK TABLE t1;
4552 Table Op Msg_type Msg_text
4553 test.t1 check status OK
4554 ALTER TABLE t1 ADD KEY idx3(col3);
4555 SELECT count(*) AS `Expect 3` FROM information_schema.innodb_tables WHERE instant_cols != 0;
4556 Expect 3
4557 0
4558 CHECK TABLE t1;
4559 Table Op Msg_type Msg_text
4560 test.t1 check status OK
4561 SELECT * FROM t1;
4562 col1 col2 col3 col4 col5 col6
4563 1 2 3 abcdefg def NULL
4564 100 200 300 qwerty def NULL
4565 200 300 400 asdfg def NULL
4566 DROP TABLE t1;
4567 # Scenario 39
4568 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
4569 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
4570 SELECT * FROM t1;
4571 c1 c2 c3
4572 1 r1c2 r1c3
4573 100 r2c2 r2c3
4574 200 r3c2 r3c3
4575 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4576 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4577 test/t1#p#p0 6 0 3 3 3
4578 test/t1#p#p1 6 0 3 3 3
4579 test/t1#p#p2 6 0 3 3 3
4580 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
4581 SELECT * FROM t1;
4582 c1 c2 c3 col4
4583 1 r1c2 r1c3 def_4
4584 100 r2c2 r2c3 def_4
4585 200 r3c2 r3c3 def_4
4586 CHECK TABLE t1;
4587 Table Op Msg_type Msg_text
4588 test.t1 check status OK
4589 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4590 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4591 test/t1#p#p0 7 1 3 4 4
4592 test/t1#p#p1 7 1 3 4 4
4593 test/t1#p#p2 7 1 3 4 4
4594 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
4595 SELECT * FROM t1;
4596 c1 c2 c3 col4
4597 1 r1c2 r1c3 def_4
4598 100 r2c2 r2c3 def_4
4599 200 r3c2 r3c3 def_4
4600 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4601 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4602 test/t1#p#p0_a 7 1 3 4 4
4603 test/t1#p#p0_b 7 1 3 4 4
4604 test/t1#p#p1 7 1 3 4 4
4605 test/t1#p#p2 7 1 3 4 4
4606 CHECK TABLE t1;
4607 Table Op Msg_type Msg_text
4608 test.t1 check status OK
4609 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
4610 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4611 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4612 test/t1#p#p0_a 7 1 3 4 4
4613 test/t1#p#p0_b 7 1 3 4 4
4614 test/t1#p#p1 7 1 3 4 4
4615 test/t1#p#p2 7 1 3 4 4
4616 CHECK TABLE t1;
4617 Table Op Msg_type Msg_text
4618 test.t1 check status OK
4619 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
4620 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
4621 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4622 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4623 test/t1#p#p0_a 7 1 3 4 4
4624 test/t1#p#p0_b 7 1 3 4 4
4625 test/t1#p#p1 7 1 3 4 4
4626 test/t1#p#p2 7 1 3 4 4
4627 CHECK TABLE t1;
4628 Table Op Msg_type Msg_text
4629 test.t1 check status OK
4630 ALTER TABLE t1 ADD KEY idx3(c3);
4631 SELECT NAME, N_COLS, TOTAL_ROW_VERSIONS, INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS FROM information_schema.innodb_tables WHERE name like "%t1%";
4632 NAME N_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
4633 test/t1#p#p0_a 7 1 3 4 4
4634 test/t1#p#p0_b 7 1 3 4 4
4635 test/t1#p#p1 7 1 3 4 4
4636 test/t1#p#p2 7 1 3 4 4
4637 CHECK TABLE t1;
4638 Table Op Msg_type Msg_text
4639 test.t1 check status OK
4640 SELECT * FROM t1;
4641 c1 c2 c3 col4
4642 1 r1c2 r1c3 def_4
4643 100 r2c2 r2c3 def_4
4644 200 r3c2 r3c3 def_4
4645 DROP TABLE t1;
4646 # Scenario 40
4647 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
4648 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
4649 SELECT * FROM t1;
4650 c1 c2 c3
4651 1 r1c2 r1c3
4652 100 r2c2 r2c3
4653 200 r3c2 r3c3
4654 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
4655 CHECK TABLE t1;
4656 Table Op Msg_type Msg_text
4657 test.t1 check status OK
4658 SELECT * FROM t1;
4659 c1 c2 c3 col4
4660 1 r1c2 r1c3 def_4
4661 100 r2c2 r2c3 def_4
4662 200 r3c2 r3c3 def_4
4663 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
4664 CHECK TABLE t1;
4665 Table Op Msg_type Msg_text
4666 test.t1 check status OK
4667 SELECT * FROM t1;
4668 c1 c2 c3 col4
4669 1 r1c2 r1c3 def_4
4670 100 r2c2 r2c3 def_4
4671 200 r3c2 r3c3 def_4
4672 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
4673 CHECK TABLE t1;
4674 Table Op Msg_type Msg_text
4675 test.t1 check status OK
4676 SELECT * FROM t1;
4677 c1 c2 c3 col4
4678 1 r1c2 r1c3 def_4
4679 100 r2c2 r2c3 def_4
4680 200 r3c2 r3c3 def_4
4681 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
4682 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
4683 CHECK TABLE t1;
4684 Table Op Msg_type Msg_text
4685 test.t1 check status OK
4686 SELECT * FROM t1;
4687 c1 c2 c3 col4
4688 1 r1c2 r1c3 def_4
4689 100 r2c2 r2c3 def_4
4690 200 r3c2 r3c3 def_4
4691 ALTER TABLE t1 ADD KEY idx3(c3);
4692 CHECK TABLE t1;
4693 Table Op Msg_type Msg_text
4694 test.t1 check status OK
4695 SELECT * FROM t1;
4696 c1 c2 c3 col4
4697 1 r1c2 r1c3 def_4
4698 100 r2c2 r2c3 def_4
4699 200 r3c2 r3c3 def_4
4700 DROP TABLE t1;
4701 # Scenario 41
4702 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=COMPACT PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (128), PARTITION p1 VALUES LESS THAN (256), PARTITION p2 VALUES LESS THAN (384), PARTITION p3 VALUES LESS THAN MAXVALUE);;
4703 INSERT INTO t1 VALUES(1, 2, 3, 'abcdefg'), (100, 200, 300, 'qwerty'), (200, 300, 400, 'asdfg');
4704 ALTER TABLE t1 ALGORITHM DEFAULT, ADD COLUMN col5 VARCHAR(500) default "def", ADD COLUMN col6 TEXT;
4705 CHECK TABLE t1;
4706 Table Op Msg_type Msg_text
4707 test.t1 check status OK
4708 SELECT * FROM t1;
4709 col1 col2 col3 col4 col5 col6
4710 1 2 3 abcdefg def NULL
4711 100 200 300 qwerty def NULL
4712 200 300 400 asdfg def NULL
4713 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (64), PARTITION p0_b VALUES LESS THAN (128));
4714 CHECK TABLE t1;
4715 Table Op Msg_type Msg_text
4716 test.t1 check status OK
4717 SELECT * FROM t1;
4718 col1 col2 col3 col4 col5 col6
4719 1 2 3 abcdefg def NULL
4720 100 200 300 qwerty def NULL
4721 200 300 400 asdfg def NULL
4722 ALTER TABLE t1 ALGORITHM DEFAULT, ADD KEY idx4(col4(10));
4723 CHECK TABLE t1;
4724 Table Op Msg_type Msg_text
4725 test.t1 check status OK
4726 SELECT * FROM t1;
4727 col1 col2 col3 col4 col5 col6
4728 1 2 3 abcdefg def NULL
4729 100 200 300 qwerty def NULL
4730 200 300 400 asdfg def NULL
4731 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
4732 CHECK TABLE t1;
4733 Table Op Msg_type Msg_text
4734 test.t1 check status OK
4735 SELECT * FROM t1;
4736 col1 col2 col3 col4 col5 col6
4737 1 2 3 abcdefg def NULL
4738 100 200 300 qwerty def NULL
4739 200 300 400 asdfg def NULL
4740 ALTER TABLE t1 ADD KEY idx3(col3);
4741 CHECK TABLE t1;
4742 Table Op Msg_type Msg_text
4743 test.t1 check status OK
4744 SELECT * FROM t1;
4745 col1 col2 col3 col4 col5 col6
4746 1 2 3 abcdefg def NULL
4747 100 200 300 qwerty def NULL
4748 200 300 400 asdfg def NULL
4749 DROP TABLE t1;
4750 # Scenario 42
4751 CREATE TABLE t1 (c1 INT, c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200) , PARTITION p2 VALUES LESS THAN MAXVALUE);;
4752 INSERT INTO t1 VALUES(1, "r1c2", "r1c3"), (100, "r2c2", "r2c3"), (200, "r3c2", "r3c3");
4753 SELECT * FROM t1;
4754 c1 c2 c3
4755 1 r1c2 r1c3
4756 100 r2c2 r2c3
4757 200 r3c2 r3c3
4758 ALTER TABLE t1 ALGORITHM INSTANT, ADD COLUMN col4 CHAR(10) DEFAULT "def_4";
4759 CHECK TABLE t1;
4760 Table Op Msg_type Msg_text
4761 test.t1 check status OK
4762 SELECT * FROM t1;
4763 c1 c2 c3 col4
4764 1 r1c2 r1c3 def_4
4765 100 r2c2 r2c3 def_4
4766 200 r3c2 r3c3 def_4
4767 ALTER TABLE t1 ALGORITHM INSTANT, DROP COLUMN c2;
4768 CHECK TABLE t1;
4769 Table Op Msg_type Msg_text
4770 test.t1 check status OK
4771 SELECT * FROM t1;
4772 c1 c3 col4
4773 1 r1c3 def_4
4774 100 r2c3 def_4
4775 200 r3c3 def_4
4776 ALTER TABLE t1 ALGORITHM INPLACE, REORGANIZE PARTITION p0 INTO (PARTITION p0_a VALUES LESS THAN (50), PARTITION p0_b VALUES LESS THAN (100));
4777 CHECK TABLE t1;
4778 Table Op Msg_type Msg_text
4779 test.t1 check status OK
4780 SELECT * FROM t1;
4781 c1 c3 col4
4782 1 r1c3 def_4
4783 100 r2c3 def_4
4784 200 r3c3 def_4
4785 ALTER TABLE t1 ALGORITHM INPLACE, ADD KEY idx4(col4);
4786 CHECK TABLE t1;
4787 Table Op Msg_type Msg_text
4788 test.t1 check status OK
4789 SELECT * FROM t1;
4790 c1 c3 col4
4791 1 r1c3 def_4
4792 100 r2c3 def_4
4793 200 r3c3 def_4
4794 ALTER TABLE t1 ALGORITHM DEFAULT, LOCK EXCLUSIVE, REORGANIZE PARTITION p0_a, p0_b INTO (PARTITION p0 VALUES LESS THAN (128) TABLESPACE innodb_file_per_table);
4795 ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
4796 CHECK TABLE t1;
4797 Table Op Msg_type Msg_text
4798 test.t1 check status OK
4799 SELECT * FROM t1;
4800 c1 c3 col4
4801 1 r1c3 def_4
4802 100 r2c3 def_4
4803 200 r3c3 def_4
4804 ALTER TABLE t1 ADD KEY idx3(c3);
4805 CHECK TABLE t1;
4806 Table Op Msg_type Msg_text
4807 test.t1 check status OK
4808 SELECT * FROM t1;
4809 c1 c3 col4
4810 1 r1c3 def_4
4811 100 r2c3 def_4
4812 200 r3c3 def_4
4813 DROP TABLE t1;
4814 # Scenario 43
4815 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT PARTITION BY HASH(a) PARTITIONS 3;;
4816 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8);
4817 SELECT * FROM t1;
4818 a b
4819 3 3
4820 6 6
4821 1 1
4822 4 4
4823 7 7
4824 2 2
4825 5 5
4826 8 8
4827 ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 5;
4828 CHECK TABLE t1;
4829 Table Op Msg_type Msg_text
4830 test.t1 check status OK
4831 SELECT * FROM t1;
4832 a b c
4833 3 3 5
4834 6 6 5
4835 1 1 5
4836 4 4 5
4837 7 7 5
4838 2 2 5
4839 5 5 5
4840 8 8 5
4841 ALTER TABLE t1 ADD PARTITION PARTITIONS 10;
4842 CHECK TABLE t1;
4843 Table Op Msg_type Msg_text
4844 test.t1 check status OK
4845 SELECT * FROM t1;
4846 a b c
4847 1 1 5
4848 2 2 5
4849 3 3 5
4850 4 4 5
4851 5 5 5
4852 6 6 5
4853 7 7 5
4854 8 8 5
4855 ALTER TABLE t1 ADD KEY(b);
4856 CHECK TABLE t1;
4857 Table Op Msg_type Msg_text
4858 test.t1 check status OK
4859 SELECT * FROM t1;
4860 a b c
4861 1 1 5
4862 2 2 5
4863 3 3 5
4864 4 4 5
4865 5 5 5
4866 6 6 5
4867 7 7 5
4868 8 8 5
4869 DROP TABLE t1;
4870 # Scenario 44
4871 CREATE TABLE t1 (a BLOB, b BLOB, c BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, h VARCHAR(10) DEFAULT NULL) ROW_FORMAT=COMPACT;
4872 INSERT INTO t1 VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk");
4873 CREATE INDEX idx ON t1(c(100));
4874 SELECT length(c) FROM t1;
4875 length(c)
4876 32000
4877 START TRANSACTION;
4878 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
4879 ROLLBACK;
4880 INSERT INTO t1 VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, 'mm');
4881 START TRANSACTION;
4882 UPDATE t1 SET a = REPEAT('m', 16000) WHERE a like "aaa%";
4883 ROLLBACK;
4884 DROP TABLE t1;
4885 # Scenario 45
4886 CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10), j INT, m INT GENERATED ALWAYS AS(b + j), n VARCHAR(10), p VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), INDEX idx1(c), INDEX idx2 (m), INDEX idx3(p)) ROW_FORMAT=COMPACT;
4887 INSERT INTO t1 VALUES(11, 22, DEFAULT, "AAA", 8, DEFAULT, "XXX", DEFAULT);
4888 INSERT INTO t1 VALUES(1, 2, DEFAULT, "uuu", 9, DEFAULT, "uu", DEFAULT);
4889 INSERT INTO t1 VALUES(3, 4, DEFAULT, "uooo", 1, DEFAULT, "umm", DEFAULT);
4890 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;
4891 ALTER TABLE t1 DROP COLUMN p, ADD COLUMN s VARCHAR(20) GENERATED ALWAYS AS(CONCAT(n, h)), algorithm=inplace;
4892 DROP TABLE t1;
4893 # Scenario 46
4894 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c INT) ROW_FORMAT=COMPACT;
4895 INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2), (3, 3, 3), (6, 6, 6);
4896 ALTER TABLE t1 ADD COLUMN d INT DEFAULT 10;
4897 SELECT * FROM t1;
4898 a b c d
4899 1 1 1 10
4900 2 2 2 10
4901 3 3 3 10
4902 6 6 6 10
4903 SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL altered WAIT_FOR dmls_done';
4904 ALTER TABLE t1 DROP COLUMN c, algorithm=inplace;;
4905 SET DEBUG_SYNC = 'now WAIT_FOR altered';
4906 INSERT INTO t1(a, b, c) VALUES(7, 7, 7);
4907 UPDATE t1 SET a = 10 WHERE a = 1;
4908 DELETE FROM t1 WHERE a = 2;
4909 UPDATE t1 SET c = 10 WHERE a = 3;
4910 UPDATE t1 SET d = 20 WHERE a = 5;
4911 UPDATE t1 SET a = 8, d = 20 WHERE a = 6;
4912 SET DEBUG_SYNC = 'now SIGNAL dmls_done';
4913 SELECT * FROM t1;
4914 a b d
4915 3 3 10
4916 7 7 10
4917 8 6 20
4918 10 1 10
4919 DROP TABLE t1;
4920 # Scenario 47
4921 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT) ROW_FORMAT=COMPACT PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (20));
4922 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
4923 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
4924 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
4925 c 2 6 1027 4 1 80000064 1 0 4
4926 c 2 6 1027 4 1 80000064 1 0 4
4927 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p21 VALUES LESS THAN(15), PARTITION p22 VALUES LESS THAN(20));
4928 SELECT NAME, POS, MTYPE, PRTYPE, LEN, HAS_DEFAULT, DEFAULT_VALUE, VERSION_ADDED, VERSION_DROPPED, PHYSICAL_POS FROM information_schema.innodb_columns WHERE has_default = 1;
4929 NAME POS MTYPE PRTYPE LEN HAS_DEFAULT DEFAULT_VALUE VERSION_ADDED VERSION_DROPPED PHYSICAL_POS
4930 c 2 6 1027 4 1 80000064 1 0 4
4931 c 2 6 1027 4 1 80000064 1 0 4
4932 c 2 6 1027 4 1 80000064 1 0 4
4933 DROP TABLE t1;
4934 # Scenario 48
4935 CREATE TABLE t1 (c1 integer PRIMARY KEY AUTO_INCREMENT, c2 integer NULL UNIQUE) ROW_FORMAT=COMPACT;
4936 ALTER TABLE t1 ADD COLUMN c3 int;
4937 ALTER TABLE t1 DROP COLUMN c3;
4938 ALTER TABLE t1 ADD COLUMN c4 int DEFAULT 1;
4939 ALTER TABLE t1 CHANGE COLUMN c4 c4_new int NULL DEFAULT 1;
4940 ALTER TABLE t1 CHANGE COLUMN c4_new c4_new int NULL DEFAULT 1;
4941 DROP TABLE t1;
4942 # Scenario 49
4943 CREATE TABLE t1 (c1 char(20) KEY, c2 enum('a', 'b', 'c')) ROW_FORMAT=COMPACT;
4944 INSERT INTO t1 values ("row1_c1", "a");
4945 SELECT * from t1;
4946 c1 c2
4947 row1_c1 a
4948 ALTER TABLE t1 ADD COLUMN c3 enum('x', 'y', 'z'), ALGORITHM=INSTANT;
4949 SELECT * from t1;
4950 c1 c2 c3
4951 row1_c1 a NULL
4952 INSERT INTO t1 values ("row2_c2", "b", "y");
4953 SELECT * from t1;
4954 c1 c2 c3
4955 row1_c1 a NULL
4956 row2_c2 b y
4957 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
4958 SELECT * from t1;
4959 c1 c3
4960 row1_c1 NULL
4961 row2_c2 y
4962 DROP TABLE t1;
4963 # Scenario 50
4964 CREATE TABLE t1 (c1 char(10), c2 char(10)) ROW_FORMAT=COMPACT;
4965 ALTER TABLE t1 DROP COLUMN c2;
4966 truncate table t1;
4967 truncate table t1;
4968 truncate table t1;
4969 DROP TABLE t1;
4970 # Scenario 51
4971 CREATE TABLE t1 (c1 int KEY, c2 int) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20), PARTITION p2 VALUES LESS THAN (30));
4972 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
4973 ALTER TABLE t1 DROP PARTITION p1;
4974 DROP TABLE t1;
4975 # Scenario 52
4976 CREATE TABLE t1(c1 int, c2 int, c3 int, c4 DOUBLE GENERATED ALWAYS AS (c1+c2) STORED, c5 DOUBLE GENERATED ALWAYS AS (c1-c2) VIRTUAL) ROW_FORMAT=COMPACT;;
4977 INSERT INTO t1(c1,c2,c3) VALUES (1,1,1);
4978 SELECT * FROM t1;
4979 c1 c2 c3 c4 c5
4980 1 1 1 2 0
4981 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
4982 ERROR HY000: Column 'c2' has a generated column dependency.
4983 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
4984 SELECT * FROM t1;
4985 c1 c2 c4 c5
4986 1 1 2 0
4987 ALTER TABLE t1 DROP COLUMN c4, ALGORITHM=INSTANT;
4988 SELECT * FROM t1;
4989 c1 c2 c5
4990 1 1 0
4991 ALTER TABLE t1 ADD COLUMN c6 DOUBLE GENERATED ALWAYS AS (2*c1+c2) VIRTUAL, ALGORITHM=INSTANT;
4992 SELECT * FROM t1;
4993 c1 c2 c5 c6
4994 1 1 0 3
4995 ALTER TABLE t1 ADD COLUMN c7 DOUBLE GENERATED ALWAYS AS (c1+2*c2) STORED, ALGORITHM=INSTANT;
4996 ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.
4997 SELECT * FROM t1;
4998 c1 c2 c5 c6
4999 1 1 0 3
5000 ALTER TABLE t1 ADD COLUMN c8 DOUBLE GENERATED ALWAYS AS (c1+2*c2) VIRTUAL FIRST, ALGORITHM=INSTANT;
5001 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
5002 SELECT * FROM t1;
5003 c1 c2 c5 c6
5004 1 1 0 3
5005 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
5006 SELECT * FROM t1;
5007 c1 c2 c3 c5 c6
5008 1 1 NULL 0 3
5009 ALTER TABLE t1 DROP column c3, add column c10 int as (c1+c2) virtual, ALGORITHM=INSTANT;
5010 SELECT * FROM t1;
5011 c1 c2 c5 c6 c10
5012 1 1 0 3 2
5013 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
5014 SELECT * FROM t1;
5015 c1 c2 c3 c5 c6 c10
5016 1 1 NULL 0 3 2
5017 ALTER TABLE t1 DROP column c3, drop column c6, ALGORITHM=INSTANT;
5018 SELECT * FROM t1;
5019 c1 c2 c5 c10
5020 1 1 0 2
5021 ALTER TABLE t1 add column c3 int after c2, ALGORITHM=INSTANT;
5022 SELECT * FROM t1;
5023 c1 c2 c3 c5 c10
5024 1 1 NULL 0 2
5025 ALTER TABLE t1 DROP column c3, add column c11 int as (c1+c2) virtual first, ALGORITHM=INSTANT;
5026 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
5027 SELECT * FROM t1;
5028 c1 c2 c3 c5 c10
5029 1 1 NULL 0 2
5030 DROP TABLE t1;
5031 # Scenario 53
5032 # Table with functional index.
5033 CREATE TABLE t1 (id int NOT NULL AUTO_INCREMENT KEY, c1 varchar(10) DEFAULT NULL, c2 varchar(10) DEFAULT NULL, INDEX idx((concat(c1, "c1")))) ROW_FORMAT=COMPACT;;
5034 INSERT INTO t1(c1, c2) values("abc", "def");
5035 SELECT * FROM t1;
5036 id c1 c2
5037 1 abc def
5038 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual after id, ALGORITHM=INSTANT;
5039 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
5040 ALTER TABLE t1 DROP COLUMN c2, ADD COLUMN c3 varchar(10) as (c1) virtual, ALGORITHM=INSTANT;
5041 ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY/INPLACE.
5042 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5043 SELECT * FROM t1;
5044 id c1
5045 1 abc
5046 DROP TABLE t1;
5047 # Scenarion 54
5048 CREATE TABLE t1 (c1 TEXT, c2 INT, PRIMARY KEY (c1(1))) ROW_FORMAT=COMPACT;;
5049 SELECT * FROM t1;
5050 c1 c2
5051 REPLACE INTO t1(c1) VALUES ('');
5052 REPLACE INTO t1(c1) VALUES ('');
5053 SELECT * From t1;
5054 c1 c2
5055 NULL
5056 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5057 REPLACE INTO t1(c1) VALUES ('');
5058 DROP TABLE t1;
5059 # Scenario 55
5060 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (20));
5061 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
5062 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5063 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INSTANT;
5064 ALTER TABLE t1 DROP COLUMN c3, ALGORITHM=INSTANT;
5065 ALTER TABLE t1 ADD PARTITION (PARTITION p5 VALUES LESS THAN (60));
5066 ALTER TABLE t1 ADD COLUMN c3 INT, ALGORITHM=INSTANT;
5067 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5068 ALTER TABLE t1 REORGANIZE PARTITION p5 INTO
5069 (
5070 PARTITION p51 VALUES LESS THAN (50),
5071 PARTITION p52 VALUES LESS THAN (60)
5072 );
5073 DROP TABLE t1;
5074 # Scenario 56
5075 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT, PRIMARY KEY(c1, c4(10))) ROW_FORMAT=COMPACT;;
5076 INSERT INTO t1 VALUES (1, 2, 3, "abcdefghijklmnop");
5077 SELECT * FROM t1;
5078 c1 c2 c3 c4
5079 1 2 3 abcdefghijklmnop
5080 ALTER TABLE t1 ADD COLUMN c5 INT, ALGORITHM=INSTANT;
5081 SELECT * FROM t1;
5082 c1 c2 c3 c4 c5
5083 1 2 3 abcdefghijklmnop NULL
5084 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5085 SELECT * FROM t1;
5086 c1 c3 c4 c5
5087 1 3 abcdefghijklmnop NULL
5088 DROP TABLE t1;
5089 # Scenario 57
5090 CREATE TABLE t1 (c1 CHAR(20), c2 CHAR(20), PRIMARY KEY PK(c1(4))) ROW_FORMAT=COMPACT;;
5091 INSERT INTO t1 VALUES ("r1c1", "r1c2");
5092 SELECT * FROM t1;
5093 c1 c2
5094 r1c1 r1c2
5095 ALTER TABLE t1 ADD COLUMN c3 char(20) DEFAULT "c3_def", ALGORITHM=INSTANT;
5096 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
5097 SELECT * FROM t1;
5098 c1 c2 c3
5099 r1c1 r1c2 c3_def
5100 r2c1 r2c2 r2c3
5101 DROP TABLE t1;
5102 # Scenario 58
5103 # Validating record in table with INSTANT ADD/DROP columns
5104 CREATE TABLE t1 (c1 CHAR(10), c2 CHAR(10)) ROW_FORMAT=COMPACT;
5105 INSERT INTO t1 VALUES ("r1c1", "r1c2");
5106 ALTER TABLE t1 ADD COLUMN c3 CHAR(10), ALGORITHM=INSTANT;
5107 INSERT INTO t1 VALUES ("r2c1", "r2c2", "r2c3");
5108 ALTER TABLE t1 DROP COLUMN c1, ALGORITHM=INSTANT;
5109 INSERT INTO t1 (c2) VALUES ("r3c2");
5110 ALTER TABLE t1 ADD COLUMN c4 CHAR(10), ALGORITHM=INSTANT;
5111 INSERT INTO t1 (c2) VALUES ("r4c2");
5112 SELECT * From t1;
5113 c2 c3 c4
5114 r1c2 NULL NULL
5115 r2c2 r2c3 NULL
5116 r3c2 NULL NULL
5117 r4c2 NULL NULL
5118 DROP TABLE t1;
5119 CREATE TABLE t1 (id INT KEY, c2 CHAR(10)) ROW_FORMAT=COMPACT PARTITION BY RANGE( id ) (PARTITION P0 VALUES LESS THAN (40), PARTITION P1 VALUES LESS THAN (50));
5120 INSERT INTO t1 VALUES(1,"r1c2");
5121 INSERT INTO t1 VALUES(2,"r2c2");
5122 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5123 ALTER TABLE t1 ADD COLUMN c2 CHAR(10), ALGORITHM=INSTANT;
5124 ALTER TABLE t1 REORGANIZE PARTITION P0, P1 INTO (PARTITION P1 VALUES LESS THAN (50));
5125 SELECT * FROM t1;
5126 id c2
5127 1 NULL
5128 2 NULL
5129 DROP TABLE t1;
5130 # Scenario 59
5131 # A scenario when #fields were not updated correctly in REDUNDANT record for not-inplace update.
5132 CREATE TABLE t1 (c1 VARCHAR(20), c2 CHAR(20)) ROW_FORMAT=COMPACT;
5133 INSERT INTO t1 VALUES ("r1c1", "r1c2");
5134 SELECT * FROM t1;
5135 c1 c2
5136 r1c1 r1c2
5137 ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
5138 UPDATE t1 SET c1="r1c11111111111";
5139 SELECT * FROM t1;
5140 c1
5141 r1c11111111111
5142 DROP TABLE t1;
5143 # Scenario 60
5144 # When a new partition is added in a table with instant columns and virtual column,
5145 # during inheriting INSTANT metadat for new partitions, virtual columns were not skipped.
5146 CREATE TABLE t1 (col1 INT, col2 INT, col3 INT, col4 TEXT) ROW_FORMAT=COMPACT PARTITION BY RANGE(col1 * 2) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300));
5147 ALTER TABLE t1 ADD COLUMN col5 INT, ADD COLUMN col6 INT GENERATED ALWAYS AS (col5 + 1) VIRTUAL, ALGORITHM=INSTANT;
5148 ALTER TABLE t1 DROP COLUMN col2, algorithm=INSTANT;
5149 ALTER TABLE t1 REORGANIZE PARTITION p2 INTO(PARTITION p21 VALUES LESS THAN (250), PARTITION p22 VALUES LESS THAN (300));
5150 DROP TABLE t1;
5151 # Scenario 61
5152 # When a table is truncated, it's instant metadata is reset. It shall
5153 # also reset instant metadata of columns.
5154 CREATE TABLE t1 (c1 VARCHAR(1008)) ROW_FORMAT=COMPACT;
5155 ALTER TABLE t1 ADD COLUMN c2 INT;
5156 TRUNCATE TABLE t1;
5157 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),1);
5158 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),2);
5159 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),3);
5160 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),4);
5161 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),5);
5162 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),6);
5163 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),7);
5164 INSERT INTO t1 (c1, c2) VALUES (CONCAT(REPEAT('z', 1008)),8);
5165 ALTER TABLE t1 ADD COLUMN c3 VARCHAR(500);
5166 UPDATE t1 SET c3 = CONCAT(REPEAT('c', 500));
5167 DROP TABLE t1;
5168 # Scenario 62
5169 # While updating lob columns on a rebuilt table which had INSTANT cols
5170 CREATE TABLE t1 (c1 CHAR(10)) ROW_FORMAT=COMPACT;
5171 INSERT INTO t1 VALUES ("r1c1");
5172 SELECT * FROM t1;
5173 c1
5174 r1c1
5175 ALTER TABLE t1 ADD COLUMN c2 INT;
5176 ALTER TABLE t1 DROP COLUMN c2;
5177 ALTER TABLE t1 ADD COLUMN c3 TEXT;
5178 UPDATE t1 SET c3 = CONCAT(REPEAT('z', 8204));
5179 ALTER TABLE t1 ADD PRIMARY KEY (c3(10)), ADD FULLTEXT KEY idx (c3);
5180 Warnings:
5181 Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
5182 SELECT * FROM t1;
5183 c1 c3
5184 r1c1 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz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zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
5185 DROP TABLE t1;
5186 # Scenario 63
5187 # Truncate of a partition/partition table
5188 CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT) ROW_FORMAT=COMPACT PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (20));
5189 # DD Metadata of columns in table
5190 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5191 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
5192 b 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5193 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
5194 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
5195 # DD Metadata of partitions in table
5196 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5197 p1 10 NULL
5198 p2 20 NULL
5199 # Metadata from INFORMATION_SCHEMA.TABLES
5200 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5201 test/t1#p#p1 5 0 0 2 2 2
5202 # Metadata from INFORMATION_SCHEMA.COLUMNS
5203 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5204 a 0 6 1283 0 0 0
5205 b 1 6 1027 0 0 0
5206 # Metadata from INFORMATION_SCHEMA.TABLES
5207 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5208 test/t1#p#p2 5 0 0 2 2 2
5209 # Metadata from INFORMATION_SCHEMA.COLUMNS
5210 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5211 a 0 6 1283 0 0 0
5212 b 1 6 1027 0 0 0
5213 INSERT INTO t1 values (5, 50), (15, 150);
5214 SELECT * FROM t1 PARTITION (p1);
5215 a b
5216 5 50
5217 SELECT * FROM t1 PARTITION (p2);
5218 a b
5219 15 150
5220 ALTER TABLE t1 ADD COLUMN c INT DEFAULT 100;
5221 # DD Metadata of columns in table
5222 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5223 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
5224 b 2 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
5225 c 3 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
5226 DB_TRX_ID 4 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
5227 DB_ROLL_PTR 5 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
5228 # DD Metadata of partitions in table
5229 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5230 p1 10 NULL
5231 p2 20 NULL
5232 # Metadata from INFORMATION_SCHEMA.TABLES
5233 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5234 test/t1#p#p1 6 0 1 2 3 3
5235 # Metadata from INFORMATION_SCHEMA.COLUMNS
5236 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5237 a 0 6 1283 0 0 0
5238 b 1 6 1027 0 0 0
5239 c 2 6 1027 1 1 0
5240 # Metadata from INFORMATION_SCHEMA.TABLES
5241 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5242 test/t1#p#p2 6 0 1 2 3 3
5243 # Metadata from INFORMATION_SCHEMA.COLUMNS
5244 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5245 a 0 6 1283 0 0 0
5246 b 1 6 1027 0 0 0
5247 c 2 6 1027 1 1 0
5248 ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN(30));
5249 INSERT INTO t1 (a, b) values (25, 250);
5250 SELECT * FROM t1 PARTITION (p1);
5251 a b c
5252 5 50 100
5253 SELECT * FROM t1 PARTITION (p2);
5254 a b c
5255 15 150 100
5256 SELECT * FROM t1 PARTITION (p3);
5257 a b c
5258 25 250 100
5259 alter table t1 drop column b, algorithm=instant;
5260 # DD Metadata of columns in table
5261 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5262 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
5263 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
5264 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
5265 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
5266 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;version_dropped=2;
5267 # DD Metadata of partitions in table
5268 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5269 p1 10 NULL
5270 p2 20 NULL
5271 p3 30 NULL
5272 # Metadata from INFORMATION_SCHEMA.TABLES
5273 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5274 test/t1#p#p1 5 0 2 2 2 3
5275 # Metadata from INFORMATION_SCHEMA.COLUMNS
5276 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5277 a 0 6 1283 0 0 0
5278 c 1 6 1027 1 1 0
5279 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5280 # Metadata from INFORMATION_SCHEMA.TABLES
5281 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5282 test/t1#p#p2 5 0 2 2 2 3
5283 # Metadata from INFORMATION_SCHEMA.COLUMNS
5284 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5285 a 0 6 1283 0 0 0
5286 c 1 6 1027 1 1 0
5287 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5288 # Metadata from INFORMATION_SCHEMA.TABLES
5289 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5290 test/t1#p#p3 5 0 2 2 2 3
5291 # Metadata from INFORMATION_SCHEMA.COLUMNS
5292 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5293 a 0 6 1283 0 0 0
5294 c 1 6 1027 1 1 0
5295 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5296 SELECT * FROM t1;
5297 a c
5298 5 100
5299 15 100
5300 25 100
5301 ALTER TABLE t1 TRUNCATE PARTITION p1;
5302 # DD Metadata of columns in table
5303 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5304 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
5305 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
5306 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
5307 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
5308 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
5309 # DD Metadata of partitions in table
5310 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5311 p1 10 NULL
5312 p2 20 NULL
5313 p3 30 NULL
5314 # Metadata from INFORMATION_SCHEMA.TABLES
5315 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5316 test/t1#p#p1 5 0 2 2 2 3
5317 # Metadata from INFORMATION_SCHEMA.COLUMNS
5318 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5319 a 0 6 1283 0 0 0
5320 c 1 6 1027 1 1 0
5321 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5322 # Metadata from INFORMATION_SCHEMA.TABLES
5323 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5324 test/t1#p#p2 5 0 2 2 2 3
5325 # Metadata from INFORMATION_SCHEMA.COLUMNS
5326 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5327 a 0 6 1283 0 0 0
5328 c 1 6 1027 1 1 0
5329 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5330 # Metadata from INFORMATION_SCHEMA.TABLES
5331 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5332 test/t1#p#p3 5 0 2 2 2 3
5333 # Metadata from INFORMATION_SCHEMA.COLUMNS
5334 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5335 a 0 6 1283 0 0 0
5336 c 1 6 1027 1 1 0
5337 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5338 SELECT * FROM t1;
5339 a c
5340 15 100
5341 25 100
5342 ALTER TABLE t1 TRUNCATE PARTITION p3;
5343 # DD Metadata of columns in table
5344 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5345 a 1 MYSQL_TYPE_LONG 1 Visible physical_pos=0;table_id=TABLE_ID;
5346 c 2 MYSQL_TYPE_LONG 0 Visible default=80000064;physical_pos=4;table_id=TABLE_ID;version_added=1;
5347 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
5348 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
5349 !hidden!_dropped_v2_p3_b 5 MYSQL_TYPE_LONG 0 SE physical_pos=3;table_id=TABLE_ID;version_dropped=2;
5350 # DD Metadata of partitions in table
5351 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5352 p1 10 NULL
5353 p2 20 NULL
5354 p3 30 NULL
5355 # Metadata from INFORMATION_SCHEMA.TABLES
5356 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5357 test/t1#p#p1 5 0 2 2 2 3
5358 # Metadata from INFORMATION_SCHEMA.COLUMNS
5359 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5360 a 0 6 1283 0 0 0
5361 c 1 6 1027 1 1 0
5362 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5363 # Metadata from INFORMATION_SCHEMA.TABLES
5364 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5365 test/t1#p#p2 5 0 2 2 2 3
5366 # Metadata from INFORMATION_SCHEMA.COLUMNS
5367 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5368 a 0 6 1283 0 0 0
5369 c 1 6 1027 1 1 0
5370 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5371 # Metadata from INFORMATION_SCHEMA.TABLES
5372 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5373 test/t1#p#p3 5 0 2 2 2 3
5374 # Metadata from INFORMATION_SCHEMA.COLUMNS
5375 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5376 a 0 6 1283 0 0 0
5377 c 1 6 1027 1 1 0
5378 !hidden!_dropped_v2_p3_b 5 6 1027 0 0 2
5379 SELECT * FROM t1;
5380 a c
5381 15 100
5382 TRUNCATE TABLE t1;
5383 # DD Metadata of columns in table
5384 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5385 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
5386 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5387 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
5388 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
5389 # DD Metadata of partitions in table
5390 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5391 p1 10 NULL
5392 p2 20 NULL
5393 p3 30 NULL
5394 # Metadata from INFORMATION_SCHEMA.TABLES
5395 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5396 test/t1#p#p1 5 0 0 2 2 2
5397 # Metadata from INFORMATION_SCHEMA.COLUMNS
5398 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5399 a 0 6 1283 0 0 0
5400 c 1 6 1027 0 0 0
5401 # Metadata from INFORMATION_SCHEMA.TABLES
5402 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5403 test/t1#p#p2 5 0 0 2 2 2
5404 # Metadata from INFORMATION_SCHEMA.COLUMNS
5405 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5406 a 0 6 1283 0 0 0
5407 c 1 6 1027 0 0 0
5408 # Metadata from INFORMATION_SCHEMA.TABLES
5409 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5410 test/t1#p#p3 5 0 0 2 2 2
5411 # Metadata from INFORMATION_SCHEMA.COLUMNS
5412 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5413 a 0 6 1283 0 0 0
5414 c 1 6 1027 0 0 0
5415 SELECT * FROM t1;
5416 a c
5417 TRUNCATE TABLE t1;
5418 ALTER TABLE t1 TRUNCATE PARTITION p1;
5419 ALTER TABLE t1 TRUNCATE PARTITION p3;
5420 # DD Metadata of columns in table
5421 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5422 a 1 MYSQL_TYPE_LONG 1 Visible table_id=TABLE_ID;
5423 c 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5424 DB_TRX_ID 3 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
5425 DB_ROLL_PTR 4 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
5426 # DD Metadata of partitions in table
5427 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5428 p1 10 NULL
5429 p2 20 NULL
5430 p3 30 NULL
5431 # Metadata from INFORMATION_SCHEMA.TABLES
5432 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5433 test/t1#p#p1 5 0 0 2 2 2
5434 # Metadata from INFORMATION_SCHEMA.COLUMNS
5435 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5436 a 0 6 1283 0 0 0
5437 c 1 6 1027 0 0 0
5438 # Metadata from INFORMATION_SCHEMA.TABLES
5439 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5440 test/t1#p#p2 5 0 0 2 2 2
5441 # Metadata from INFORMATION_SCHEMA.COLUMNS
5442 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5443 a 0 6 1283 0 0 0
5444 c 1 6 1027 0 0 0
5445 # Metadata from INFORMATION_SCHEMA.TABLES
5446 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5447 test/t1#p#p3 5 0 0 2 2 2
5448 # Metadata from INFORMATION_SCHEMA.COLUMNS
5449 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5450 a 0 6 1283 0 0 0
5451 c 1 6 1027 0 0 0
5452 SELECT * FROM t1;
5453 a c
5454 DROP TABLE t1;
5455 # Scenario 64
5456 # When nullbitmap size on physical record changes after INSTANT ADD columns.
5457 CREATE TABLE t1 (c0 char(9) KEY, c1 char (10), c2 char(20), c3 char(30), c4 char(40), c5 char(50), c6 char(60), c7 char(70), c8 char(80)) ROW_FORMAT=COMPACT;
5458 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
5459 Insert into t1 values(
5460 REPEAT("a", 8),
5461 REPEAT("1", 9),
5462 REPEAT("2", 19),
5463 REPEAT("3", 29),
5464 REPEAT("4", 39),
5465 REPEAT("5", 49),
5466 REPEAT("6", 59),
5467 REPEAT("7", 69),
5468 REPEAT("8", 79));
5469 Insert into t1 values(
5470 REPEAT("b", 8),
5471 REPEAT("1", 9),
5472 REPEAT("2", 19),
5473 REPEAT("3", 29),
5474 REPEAT("4", 39),
5475 REPEAT("5", 49),
5476 REPEAT("6", 59),
5477 REPEAT("7", 69),
5478 REPEAT("8", 79));
5479 Alter table t1 add column c9 char(90);
5480 Insert into t1 values(
5481 REPEAT("c", 8),
5482 REPEAT("1", 9),
5483 REPEAT("2", 19),
5484 REPEAT("3", 29),
5485 REPEAT("4", 39),
5486 REPEAT("5", 49),
5487 REPEAT("6", 59),
5488 REPEAT("7", 69),
5489 REPEAT("8", 79),
5490 REPEAT("9", 89));
5491 SET GLOBAL innodb_limit_optimistic_insert_debug=0;
5492 DROP table t1;
5493 # Scenario 65
5494 # Truncate all partition shall reset INSTANT Metadata
5495 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT) ROW_FORMAT=COMPACT PARTITION BY RANGE(c1) (PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (300), PARTITION p3 VALUES LESS THAN MAXVALUE);
5496 INSERT INTO t1 VALUES (90, 1, 1, "1"), (190, 1, 1, "2"), (290, 1, 1, "3"), (390, 1, 1, "3");
5497 Alter table t1 add column c5 int, algorithm=INSTANT;
5498 Alter table t1 drop column c3, algorithm=INSTANT;
5499 # DD Metadata of columns in table
5500 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5501 c1 1 MYSQL_TYPE_LONG 0 Visible physical_pos=3;table_id=TABLE_ID;
5502 c2 2 MYSQL_TYPE_LONG 0 Visible physical_pos=4;table_id=TABLE_ID;
5503 c4 3 MYSQL_TYPE_BLOB 0 Visible physical_pos=6;table_id=TABLE_ID;
5504 c5 4 MYSQL_TYPE_LONG 0 Visible default_null=1;physical_pos=7;table_id=TABLE_ID;version_added=1;
5505 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE physical_pos=0;table_id=TABLE_ID;
5506 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE physical_pos=1;table_id=TABLE_ID;
5507 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE physical_pos=2;table_id=TABLE_ID;
5508 !hidden!_dropped_v2_p5_c3 8 MYSQL_TYPE_LONG 0 SE physical_pos=5;version_dropped=2;
5509 # DD Metadata of partitions in table
5510 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5511 p0 100 NULL
5512 p1 200 NULL
5513 p2 300 NULL
5514 p3 MAXVALUE NULL
5515 # Metadata from INFORMATION_SCHEMA.TABLES
5516 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5517 test/t1#p#p0 7 0 2 4 4 5
5518 # Metadata from INFORMATION_SCHEMA.COLUMNS
5519 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5520 c1 0 6 1027 0 0 0
5521 c2 1 6 1027 0 0 0
5522 c4 2 5 16711932 0 0 0
5523 c5 3 6 1027 1 1 0
5524 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
5525 # Metadata from INFORMATION_SCHEMA.TABLES
5526 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5527 test/t1#p#p1 7 0 2 4 4 5
5528 # Metadata from INFORMATION_SCHEMA.COLUMNS
5529 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5530 c1 0 6 1027 0 0 0
5531 c2 1 6 1027 0 0 0
5532 c4 2 5 16711932 0 0 0
5533 c5 3 6 1027 1 1 0
5534 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
5535 # Metadata from INFORMATION_SCHEMA.TABLES
5536 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5537 test/t1#p#p2 7 0 2 4 4 5
5538 # Metadata from INFORMATION_SCHEMA.COLUMNS
5539 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5540 c1 0 6 1027 0 0 0
5541 c2 1 6 1027 0 0 0
5542 c4 2 5 16711932 0 0 0
5543 c5 3 6 1027 1 1 0
5544 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
5545 # Metadata from INFORMATION_SCHEMA.TABLES
5546 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5547 test/t1#p#p3 7 0 2 4 4 5
5548 # Metadata from INFORMATION_SCHEMA.COLUMNS
5549 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5550 c1 0 6 1027 0 0 0
5551 c2 1 6 1027 0 0 0
5552 c4 2 5 16711932 0 0 0
5553 c5 3 6 1027 1 1 0
5554 !hidden!_dropped_v2_p5_c3 7 6 1027 0 0 2
5555 ALTER TABLE t1 TRUNCATE partition p0, p1, p2, p3;
5556 # DD Metadata of columns in table
5557 NAME ORDINAL_POSITION TYPE HAS_NO_DEFAULT HIDDEN SE_PRIVATE_DATA
5558 c1 1 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5559 c2 2 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5560 c4 3 MYSQL_TYPE_BLOB 0 Visible table_id=TABLE_ID;
5561 c5 4 MYSQL_TYPE_LONG 0 Visible table_id=TABLE_ID;
5562 DB_ROW_ID 5 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
5563 DB_TRX_ID 6 MYSQL_TYPE_INT24 0 SE table_id=TABLE_ID;
5564 DB_ROLL_PTR 7 MYSQL_TYPE_LONGLONG 0 SE table_id=TABLE_ID;
5565 # DD Metadata of partitions in table
5566 NAME DESCRIPTION_UTF8 SE_PRIVATE_DATA
5567 p0 100 NULL
5568 p1 200 NULL
5569 p2 300 NULL
5570 p3 MAXVALUE NULL
5571 # Metadata from INFORMATION_SCHEMA.TABLES
5572 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5573 test/t1#p#p0 7 0 0 4 4 4
5574 # Metadata from INFORMATION_SCHEMA.COLUMNS
5575 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5576 c1 0 6 1027 0 0 0
5577 c2 1 6 1027 0 0 0
5578 c4 2 5 16711932 0 0 0
5579 c5 3 6 1027 0 0 0
5580 # Metadata from INFORMATION_SCHEMA.TABLES
5581 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5582 test/t1#p#p1 7 0 0 4 4 4
5583 # Metadata from INFORMATION_SCHEMA.COLUMNS
5584 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5585 c1 0 6 1027 0 0 0
5586 c2 1 6 1027 0 0 0
5587 c4 2 5 16711932 0 0 0
5588 c5 3 6 1027 0 0 0
5589 # Metadata from INFORMATION_SCHEMA.TABLES
5590 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5591 test/t1#p#p2 7 0 0 4 4 4
5592 # Metadata from INFORMATION_SCHEMA.COLUMNS
5593 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5594 c1 0 6 1027 0 0 0
5595 c2 1 6 1027 0 0 0
5596 c4 2 5 16711932 0 0 0
5597 c5 3 6 1027 0 0 0
5598 # Metadata from INFORMATION_SCHEMA.TABLES
5599 NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS INITIAL_COLUMN_COUNTS CURRENT_COLUMN_COUNTS TOTAL_COLUMN_COUNTS
5600 test/t1#p#p3 7 0 0 4 4 4
5601 # Metadata from INFORMATION_SCHEMA.COLUMNS
5602 NAME POS MTYPE PRTYPE HAS_DEFAULT VERSION_ADDED VERSION_DROPPED
5603 c1 0 6 1027 0 0 0
5604 c2 1 6 1027 0 0 0
5605 c4 2 5 16711932 0 0 0
5606 c5 3 6 1027 0 0 0
5607 DROP TABLE t1;
5608 # Scenario 66
5609 # Purge crash
5610 create table t1 (c0 INT KEY, c1 varchar(10), c2 varchar(10)) ROW_FORMAT=COMPACT;
5611 alter table t1 add column c4 char(10), algorithm=instant;
5612 alter table t1 add index idx (c4);
5613 insert into t1 values (1, "r1c1", "r1c2", "c4");
5614 SET GLOBAL innodb_purge_stop_now=ON;
5615 Update t1 set c2="r122222", c4="c44";
5616 alter table t1 drop column c2, algorithm=instant;
5617 SET GLOBAL innodb_purge_run_now=ON;
5618 DROP TABLE t1;
5619 # Scenario 66
5620 # Inplace update is failing
5621 # INSTANT ADD and INPLACE UPDATE
5622 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT;
5623 Insert into t1 values ("r1c1", "r1c2", "r1c3");
5624 Select * from t1;
5625 c1 c2 c3
5626 r1c1 r1c2 r1c3
5627 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
5628 Select * from t1;
5629 c1 c4 c2 c3
5630 r1c1 NULL r1c2 r1c3
5631 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
5632 Select * from t1;
5633 c1 c4 c2 c3
5634 r1c1 NULL r1c2 r1c3
5635 r2c1 r2c4 r2c2 r2c3
5636 # Disable flush to make sure REDO is applied after restart
5637 Update t1 set c2="r112" where c2="r1c2";
5638 Update t1 set c2="r212" where c2="r2c2";
5639 Select * from t1;
5640 c1 c4 c2 c3
5641 r1c1 NULL r112 r1c3
5642 r2c1 r2c4 r212 r2c3
5643 # Kill the running server
5644 # Kill the server
5645 # Start the server
5646 Select * from t1;
5647 c1 c4 c2 c3
5648 r1c1 NULL r112 r1c3
5649 r2c1 r2c4 r212 r2c3
5650 DROP TABLE t1;
5651 # INSTANT DROP and INPLACE UPDATE
5652 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT;
5653 Insert into t1 values ("r1c1", "r1c2", "r1c3");
5654 Select * from t1;
5655 c1 c2 c3
5656 r1c1 r1c2 r1c3
5657 Alter table t1 drop column c1, algorithm=instant;
5658 Insert into t1 values ("r2c2", "r2c3");
5659 Select * from t1;
5660 c2 c3
5661 r1c2 r1c3
5662 r2c2 r2c3
5663 SET GLOBAL innodb_log_checkpoint_now = ON;
5664 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
5665 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
5666 SET GLOBAL innodb_master_thread_disabled_debug = 1;
5667 Update t1 set c2="r112" where c2="r1c2";
5668 Update t1 set c2="r212" where c2="r2c2";
5669 Select * from t1;
5670 c2 c3
5671 r112 r1c3
5672 r212 r2c3
5673 # Kill the running server
5674 # Kill the server
5675 # Start the server
5676 Select * from t1;
5677 c2 c3
5678 r112 r1c3
5679 r212 r2c3
5680 DROP TABLE t1;
5681 # INSTANT ADD and DROP and INPLACE UPDATE
5682 CREATE TABLE t1 (c1 char(10), c2 char(10), c3 char(10)) ROW_FORMAT=COMPACT;
5683 Insert into t1 values ("r1c1", "r1c2", "r1c3");
5684 Select * from t1;
5685 c1 c2 c3
5686 r1c1 r1c2 r1c3
5687 Alter table t1 add column c4 char(10) after c1, ALGORITHM=INSTANT;
5688 Select * from t1;
5689 c1 c4 c2 c3
5690 r1c1 NULL r1c2 r1c3
5691 Insert into t1 values ("r2c1", "r2c4", "r2c2", "r2c3");
5692 Select * from t1;
5693 c1 c4 c2 c3
5694 r1c1 NULL r1c2 r1c3
5695 r2c1 r2c4 r2c2 r2c3
5696 Alter table t1 drop column c1, algorithm=instant;
5697 Select * from t1;
5698 c4 c2 c3
5699 NULL r1c2 r1c3
5700 r2c4 r2c2 r2c3
5701 Insert into t1 values ("r3c4", "r3c2", "r3c3");
5702 Select * from t1;
5703 c4 c2 c3
5704 NULL r1c2 r1c3
5705 r2c4 r2c2 r2c3
5706 r3c4 r3c2 r3c3
5707 SET GLOBAL innodb_log_checkpoint_now = ON;
5708 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
5709 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
5710 SET GLOBAL innodb_master_thread_disabled_debug = 1;
5711 Update t1 set c2="r112" where c2="r1c2";
5712 Update t1 set c2="r212" where c2="r2c2";
5713 Update t1 set c2="r312" where c2="r3c2";
5714 Select * from t1;
5715 c4 c2 c3
5716 NULL r112 r1c3
5717 r2c4 r212 r2c3
5718 r3c4 r312 r3c3
5719 # Kill the running server
5720 # Kill the server
5721 # Start the server
5722 Select * from t1;
5723 c4 c2 c3
5724 NULL r112 r1c3
5725 r2c4 r212 r2c3
5726 r3c4 r312 r3c3
5727 DROP TABLE t1;
5728 ###########
5729 # CLEANUP #
5730 ###########