Debian Codegraph @

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

raw
1 call mtr.add_suppression("Operating system error number .* in a file operation.");
2 call mtr.add_suppression("The error means the system cannot find the path specified.");
3 call mtr.add_suppression("File ./test/t1.ibd was not found");
4 set default_storage_engine=innodb;
5 #
6 # MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
7 #
8 create table t2 (x int, z int default 41);
9 alter table t2 discard tablespace;
10 create table t1 (x int);
11 insert into t1 values (1);
12 alter table t1 add z int default 42, algorithm instant;
13 select * from t1;
14 x z
15 1 42
16 flush tables t1 for export;
17 unlock tables;
18 # The metadata has to be updated to instant ADD COLUMN.
19 alter table t2 import tablespace;
20 select * from t2;
21 x z
22 1 42
23 insert into t2 set x=2;
24 select * from t2;
25 x z
26 1 42
27 2 41
28 alter table t1 discard tablespace;
29 flush tables t2 for export;
30 unlock tables;
31 # Both the metadata and the data file used instant ADD COLUMN.
32 alter table t1 import tablespace;
33 select * from t1;
34 x z
35 1 42
36 2 41
37 drop table t2;
38 create table t2 select * from t1;
39 alter table t1 discard tablespace;
40 flush tables t2 for export;
41 unlock tables;
42 # The instant ADD COLUMN has to be removed from the metadata.
43 alter table t1 import tablespace;
44 select * from t1;
45 x z
46 1 42
47 2 41
48 # Remove metadata for instant DROP COLUMN, then import
49 alter table t1 drop x, add column x int first, algorithm instant;
50 select * from t1;
51 x z
52 NULL 42
53 NULL 41
54 alter table t1 discard tablespace;
55 alter table t1 import tablespace;
56 select * from t1;
57 x z
58 1 42
59 2 41
60 # Import a data file that contains instant DROP COLUMN metadata
61 alter table t2 drop x;
62 alter table t1 drop x, force;
63 alter table t1 discard tablespace;
64 flush tables t2 for export;
65 unlock tables;
66 alter table t1 import tablespace;
67 # restart
68 select * from t1;
69 z
70 42
71 41
72 drop table t2;
73 drop table t1;
74 CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT) ENGINE=INNODB;
75 CREATE TABLE t2 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT, i2 INT) ENGINE=INNODB;
76 ALTER TABLE t2 DROP COLUMN i2, ALGORITHM=INSTANT;
77 ALTER TABLE t2 DISCARD TABLESPACE;
78 FLUSH TABLE t1 FOR EXPORT;
79 UNLOCK TABLES;
80 ALTER TABLE t2 IMPORT TABLESPACE;
81 DROP TABLE t2, t1;
82 CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT) ENGINE=INNODB;
83 INSERT INTO t1 VALUES (1, 1, 1);
84 ALTER TABLE t1 MODIFY COLUMN i2 INT AFTER i1, ALGORITHM=INSTANT;
85 CREATE TABLE t2 LIKE t1;
86 ALTER TABLE t2 DISCARD TABLESPACE;
87 FLUSH TABLE t1 FOR EXPORT;
88 UNLOCK TABLES;
89 ALTER TABLE t2 IMPORT TABLESPACE;
90 SELECT * FROM t2;
91 id i1 i2
92 1 1 1
93 DROP TABLE t2, t1;
94 CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT) ENGINE=INNODB;
95 INSERT INTO t1 VALUES (1, 1, 1);
96 ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT;
97 CREATE TABLE t2 LIKE t1;
98 ALTER TABLE t2 DISCARD TABLESPACE;
99 FLUSH TABLE t1 FOR EXPORT;
100 UNLOCK TABLES;
101 ALTER TABLE t2 IMPORT TABLESPACE;
102 SELECT * FROM t2;
103 id i1
104 1 1
105 DROP TABLE t2, t1;
106 CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT)
107 ENGINE=INNODB PAGE_COMPRESSED=1;
108 INSERT INTO t1 VALUES (1, 1, 1);
109 ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT;
110 CREATE TABLE t2 LIKE t1;
111 ALTER TABLE t2 DISCARD TABLESPACE;
112 FLUSH TABLE t1 FOR EXPORT;
113 UNLOCK TABLES;
114 ALTER TABLE t2 IMPORT TABLESPACE;
115 DROP TABLE t2, t1;
116 CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i2 INT, i1 INT) ENGINE=INNODB;
117 INSERT INTO t1 (i2) SELECT 4 FROM seq_1_to_1024;
118 ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT;
119 CREATE TABLE t2 LIKE t1;
120 ALTER TABLE t2 DISCARD TABLESPACE;
121 FLUSH TABLE t1 FOR EXPORT;
122 UNLOCK TABLES;
123 ALTER TABLE t2 IMPORT TABLESPACE;
124 DROP TABLE t2, t1;
125 CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
126 CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
127 ALTER TABLE test.t1 add COLUMN i3 INT AFTER i1;
128 ALTER TABLE t2 DISCARD TABLESPACE;
129 FLUSH TABLES t1 FOR EXPORT;
130 UNLOCK TABLES;
131 ALTER TABLE t2 IMPORT TABLESPACE;
132 ERROR HY000: Index for table 't2' is corrupt; try to repair it
133 DROP TABLE t1, t2;
134 #
135 # MDEV-28919 Assertion `(((core_null) + 7) >> 3) ==
136 # oindex.n_core_null_bytes || !not_redundant()' failed
137 #
138 call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded");
139 CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL,
140 c INTEGER)engine=innodb;
141 ALTER TABLE t DISCARD TABLESPACE;
142 FLUSH TABLES;
143 ALTER TABLE t DROP COLUMN b, algorithm=instant;
144 Warnings:
145 Warning 1814 Tablespace has been discarded for table `t`
146 ALTER TABLE t DROP COLUMN c, algorithm=instant;
147 Warnings:
148 Warning 1814 Tablespace has been discarded for table `t`
149 CREATE TABLE t1(a INTEGER)ENGINE=InnoDB;
150 INSERT INTO t1 VALUES(1);
151 FLUSH TABLE t1 FOR EXPORT;
152 unlock tables;
153 ALTER TABLE t IMPORT tablespace;
154 check table t;
155 Table Op Msg_type Msg_text
156 test.t check status OK
157 select * from t;
158 a
159 1
160 DROP TABLE t, t1;