Debian Codegraph @

mysql-test/suite/innodb/include/default_row_format_alter.inc

raw
1 --echo
2 --echo ####################################
3 --echo # Check if table rebuilding alter isn't affect if table is created
4 --echo # with explicit row_format
5 eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=INNODB;
6 INSERT INTO t1 VALUES (1, 'abc');
7
8 --source suite/innodb/include/default_row_format_show.inc
9
10 SET GLOBAL innodb_default_row_format=DYNAMIC;
11 ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
12
13 --echo # Here we expect COMPACT because it was explicitly specified at CREATE
14 --source suite/innodb/include/default_row_format_show.inc
15 DROP TABLE t1;
16
17 --echo
18 --echo ####################################
19 --echo # Check if table rebuilding alter is affected when there is no
20 --echo # row_format specified at CREATE TABLE.
21 SET GLOBAL innodb_default_row_format = COMPACT;
22 eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
23 INSERT INTO t1 VALUES (1, 'abc');
24
25 --source suite/innodb/include/default_row_format_show.inc
26
27 SET GLOBAL innodb_default_row_format = DYNAMIC;
28 ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
29
30 --echo # Here we expect DYNAMIC because there is no explicit ROW_FORMAT and the
31 --echo # default_row_format is changed to DYNAMIC just before ALTER
32 --source suite/innodb/include/default_row_format_show.inc
33 DROP TABLE t1;
34
35 --echo
36 --echo ####################################
37 --echo # Check the row_format effect on ALTER, ALGORITHM=COPY
38 SET GLOBAL innodb_default_row_format = REDUNDANT;
39 eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
40 INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
41
42 --source suite/innodb/include/default_row_format_show.inc
43
44 SET GLOBAL innoDB_default_row_format = COMPACT;
45 ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
46
47 --echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table isn't
48 --echo # created with explicit row_format, so we expect ROW_FORMAT=COMPACT
49 --source suite/innodb/include/default_row_format_show.inc
50 DROP TABLE t1;
51
52 --echo
53 --echo ###################################
54 --echo # Check the row_format effect on ALTER, ALGORITH=COPY on
55 --echo # create table with explicit row_format
56 eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=INNODB;
57 INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
58
59 --source suite/innodb/include/default_row_format_show.inc
60
61 SET GLOBAL innoDB_default_row_format = COMPACT;
62 ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
63
64 --echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table is
65 --echo # created with explicit row_format, so we expect original
66 --echo # ROW_FORMAT=REDUNDANT
67 --source suite/innodb/include/default_row_format_show.inc
68 DROP TABLE t1;
69
70 --echo
71 --echo ##################################
72 --echo # Check row_format on ALTER ALGORITHM=INPLACE
73 SET GLOBAL innodb_default_row_format=COMPACT;
74
75 eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT, KEY k1(b(10))) ENGINE=INNODB;
76 INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
77
78 --source suite/innodb/include/default_row_format_show.inc
79
80 SET GLOBAL innodb_default_row_format=DYNAMIC;
81 ALTER TABLE t1 DROP INDEX k1;
82
83 --echo # Because it is in-place operation, there is no rebuild, so the
84 --echo # original format has to be retained.
85 --source suite/innodb/include/default_row_format_show.inc
86 DROP TABLE t1;