--echo # --echo # Bug#30128418: IMPORT TABLESPACE MUST CHECK DESCENDING INDEX DEFINITION --echo # --source include/have_debug.inc # Test the implementation of InnoDB export CFG version 4 (IB_EXPORT_CFG_VERSION_V4). # It shows what happens when a sort order of a key on a secondary index # may or may not differ from the file being imported and what happens when the # imported CFG file is using an old version which does not know about sort order. --let $MYSQLD_DATADIR=`select @@datadir` --let $DB = `SELECT DATABASE()` --echo ### --echo ### EXPORT #1: Backup Ascending key IBD and v3 CFG --echo ### --echo # Create a table with a normal ascending secondary key and export it. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b)); INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (2, 2); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; SHOW CREATE TABLE t1; --echo # Export the table using IB_EXPORT_CFG_VERSION_V3, --echo # which does not export the DESC flag. SET GLOBAL DEBUG='+d,ib_export_use_cfg_version_3'; FLUSH TABLES t1 FOR EXPORT; SET GLOBAL DEBUG='-d,ib_export_use_cfg_version_3'; --echo # Back-up the IBD and the v3 CFG file --copy_file $MYSQLD_DATADIR/$DB/t1.ibd $MYSQLD_DATADIR/$DB/t1.ibd.ascend --copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v3 --echo # Unlock the table, which deletes the CFG file. UNLOCK TABLES; --echo ### --echo ### EXPORT #2: Backup v4 CFG for Ascending key IBD --echo ### --echo # Export the table using IB_EXPORT_CFG_VERSION_V4, --echo # which will export the DESC flag on the secondary index. FLUSH TABLES t1 FOR EXPORT; --echo # Back-up the v4 CFG file --copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v4 UNLOCK TABLES; DROP TABLE t1; --echo ### --echo ### EXPORT #3: Backup Descending key IBD and v3 CFG --echo ### --echo # Create a table with a descending secondary key and export it. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b DESC)); INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (2, 2); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; SHOW CREATE TABLE t1; --echo # Export the table using IB_EXPORT_CFG_VERSION_V3, --echo # which does not export the DESC flag. SET GLOBAL DEBUG='+d,ib_export_use_cfg_version_3'; FLUSH TABLES t1 FOR EXPORT; SET GLOBAL DEBUG='-d,ib_export_use_cfg_version_3'; --echo # Back-up the IBD and the v3 CFG file --copy_file $MYSQLD_DATADIR/$DB/t1.ibd $MYSQLD_DATADIR/$DB/t1.ibd.descend --copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg.descend.v3 --echo # Unlock the table, which deletes the CFG file. UNLOCK TABLES; --echo ### --echo ### EXPORT #4: Backup v4 CFG for Descending key IBD --echo ### --echo # Export the table using IB_EXPORT_CFG_VERSION_V4, --echo # which will export the DESC flag on the secondary index. FLUSH TABLES t1 FOR EXPORT; --echo # Back-up the v4 CFG with the descending key. --copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg.descend.v4 --echo # Unlock the table, which deletes the cfg file. UNLOCK TABLES; --echo ### --echo ### EXPORT #5: Backup with a future version 99 CFG --echo ### --echo # Export the table using a future version IB_EXPORT_CFG_VERSION_V99, SET GLOBAL DEBUG='+d,ib_export_use_cfg_version_99'; FLUSH TABLES t1 FOR EXPORT; SET GLOBAL DEBUG='-d,ib_export_use_cfg_version_99'; --echo # Back-up the v99 CFG with the descending key. --copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg.descend.v99 --echo # Unlock the table, which deletes the cfg file. UNLOCK TABLES; --echo ### --echo ### IMPORT TEST #1: Ascending key IBD and v3 CFG to Discarded Ascending Key IBD --echo ### --echo # Recreate the table without the DESC attribute on the secondary key. DROP TABLE t1; CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the ascending key IBD and the v3 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.ascend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v3 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Import the table. Since both the discarded IBD and the imported --echo # IBD match, the import succeeds. ALTER TABLE t1 IMPORT TABLESPACE; --echo # Show that column b is sorted correctly. --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (4, 4); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; DROP TABLE t1; --echo ### --echo ### IMPORT TEST #2: Ascending key IBD and v4 CFG to Discarded Ascending Key IBD --echo ### --echo # Recreate the table without the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the ascending key IBD and the v4 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.ascend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v4 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Import the table. Since both the discarded IBD and the imported --echo # IBD match, the import succeeds. ALTER TABLE t1 IMPORT TABLESPACE; --echo # Show that column b is sorted correctly. --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (4, 4); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; DROP TABLE t1; --echo ### --echo ### IMPORT TEST #3: Ascending key IBD and v3 CFG to Discarded Descending Key IBD --echo ### --echo # Recreate the table with the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b DESC)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the ascending key IBD and the v3 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.ascend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v3 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Attempt to import the table. Since the DESC flag is not available in the --echo # CFG file, we assume it is ascending, which is different from the exported --echo # table. The error message will complain about Index b field b. --echo # The import will abort and delete the cfg file. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t1 IMPORT TABLESPACE; DROP TABLE t1; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd --echo ### --echo ### IMPORT TEST #4 Ascending key IBD and v4 CFG to Discarded Descending Key IBD --echo ### --echo # Recreate the table with the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b DESC)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the ascending key IBD and the v4 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.ascend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v4 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Attempt to import the table. Since the DESC flag if the discarded table --echo # is different from the exported table, the error message will complain about --echo # Index b field b. The import will abort and delete the cfg file. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t1 IMPORT TABLESPACE; DROP TABLE t1; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd --echo ### --echo ### IMPORT TEST #5: Descending key IBD and v3 CFG to Discarded Ascending Key IBD --echo ### --echo # Recreate the table without the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the descending key IBD and the v3 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.descend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v3 $MYSQLD_DATADIR/$DB/t1.cfg --disable_query_log call mtr.add_suppression("\\[InnoDB\\] Records in wrong order on space [0-9]*"); call mtr.add_suppression("\\[InnoDB\\] Apparent corruption in space [0-9]*"); call mtr.add_suppression("\\[InnoDB\\] In page [0-9]* of index `b` of table"); --enable_query_log --echo # Attempt to import the table. Since the DESC flag is not available in the --echo # CFG file, we assume it is ascending, which matches the exported table. --echo # So the import succeeds, but the sort order of the keys in the imported --echo # file is descending and all new keys will be ascending. ALTER TABLE t1 IMPORT TABLESPACE; --echo # Show that the index is corrupt SHOW WARNINGS; CHECK TABLE t1 EXTENDED; --echo # Fix the corruption OPTIMIZE TABLE t1; --echo # Show that the index is no longer corrupt CHECK TABLE t1 EXTENDED; --echo # Show that column b is sorted consistently. --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; --skip_if_hypergraph # Does not use the index leading to the error. SELECT * FROM t1 order by b; INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (4, 4); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; --skip_if_hypergraph # Does not use the index leading to the error. SELECT * FROM t1 order by b; DROP TABLE t1; --echo ### --echo ### IMPORT TEST #6: Descending key IBD and v4 CFG to Discarded Ascending Key IBD --echo ### --echo # Recreate the table without the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the descending key IBD and the v4 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.descend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v4 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Attempt to import the table. Since the DESC flag if the discarded table --echo # is different from the exported table, the error message will complain about --echo # column b in index b. The import will abort and delete the cfg file. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t1 IMPORT TABLESPACE; DROP TABLE t1; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd --echo ### --echo ### IMPORT TEST #7: Descending key IBD and v3 CFG to Discarded Descending Key IBD --echo ### --echo # Recreate the table with the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b DESC)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the descending key IBD and the v3 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.descend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v3 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Attempt to import the table. Since the DESC flag is not available in the --echo # CFG file, we wrongly assume it is ascending. Since this is different from --echo # the exported table, the error message will complain about column b in index b. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t1 IMPORT TABLESPACE; DROP TABLE t1; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd --echo ### --echo ### IMPORT TEST #8: Descending key IBD and v4 CFG to Discarded Descending Key IBD --echo ### --echo # Recreate the table with the DESC attribute on the secondary key. CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY (b DESC)); SHOW CREATE TABLE t1; --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the descending key IBD and the v4 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.descend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v4 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Import the table successfuly. ALTER TABLE t1 IMPORT TABLESPACE; --echo # Show that column b is descending. --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (4, 4); --sorted_result SELECT * FROM t1; SELECT * FROM t1 order by a; SELECT * FROM t1 order by b; --echo ### --echo ### IMPORT TEST #9: Any unknown version will be rejected with a clear error message. --echo ### --echo # Discard the table which deletes the IBD file. ALTER TABLE t1 DISCARD TABLESPACE; --echo # Restore the descending key IBD and the v99 version of the CFG. --copy_file $MYSQLD_DATADIR/$DB/t1.ibd.descend $MYSQLD_DATADIR/$DB/t1.ibd --copy_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v99 $MYSQLD_DATADIR/$DB/t1.cfg --echo # Attempt to import the table. --error ER_IMP_INCOMPATIBLE_CFG_VERSION ALTER TABLE t1 IMPORT TABLESPACE; SHOW WARNINGS; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd --remove_file $MYSQLD_DATADIR/$DB/t1.cfg --echo # Cleanup DROP TABLE t1; --remove_file $MYSQLD_DATADIR/$DB/t1.ibd.ascend --remove_file $MYSQLD_DATADIR/$DB/t1.ibd.descend --remove_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v3 --remove_file $MYSQLD_DATADIR/$DB/t1.cfg.ascend.v4 --remove_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v3 --remove_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v4 --remove_file $MYSQLD_DATADIR/$DB/t1.cfg.descend.v99 --echo # --echo # Bug#30191523 : FLUSH TABLE T FOR EXPORT OR ALTER TABLE T2 IMPORT --echo # TABLESPACE BROKEN IN 8.0.17. --echo # --echo # ---------------------- Test 1 ---------------------------------- --echo # Source table has INSTANT columns but target table doesn't --echo # ---------------------------------------------------------------- --echo # Create source table t1 and add a column INSTANTly CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY); ALTER TABLE t1 ADD COLUMN v1 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t1 ADD COLUMN v2 VARCHAR(255), ALGORITHM=INSTANT; --echo # Insert some data into t1 --disable_query_log let $i=1000; while ($i) { INSERT INTO t1(v1, v2) VALUES ("aaaaaaaaaaaaa", "bbbbbbbbbbbbbb"); dec $i; } --enable_query_log SELECT * from t1 limit 10; SELECT COUNT(*) from t1; SELECT NAME, N_COLS, INSTANT_COLS FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME="test/t1"; SELECT NAME, POS, HAS_DEFAULT from information_Schema.innodb_columns WHERE NAME='v1' OR NAME='v2'; --echo # Flush the table and store CFG/IBD files to temp FLUSH TABLE t1 FOR EXPORT; --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/t1.cfg_back --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/t1.ibd_back UNLOCK TABLES; --echo # Create table t2 without INSTANTly added columns CREATE TABLE t2 LIKE t1; ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should succeed. Target table metadata should have been updated. ALTER TABLE t2 IMPORT TABLESPACE; SELECT * from t2 limit 10; SELECT COUNT(*) from t2; SELECT NAME, N_COLS, INSTANT_COLS FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME="test/t1" OR NAME="test/t2"; SELECT NAME, POS, HAS_DEFAULT from information_Schema.innodb_columns WHERE NAME='v1' OR NAME='v2'; DROP TABLE t2; --echo # Create table t2 with one column added INSTANTly CREATE TABLE t2(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, v1 VARCHAR(255)); ALTER TABLE t2 ADD COLUMN v2 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should fail as INSTANT METADATA doesn't match. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; --remove_file $MYSQLD_DATADIR/test/t2.cfg --remove_file $MYSQLD_DATADIR/test/t2.ibd --echo # Create table t2 with two column added INSTANTly CREATE TABLE t2(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY); ALTER TABLE t2 ADD COLUMN v1 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 ADD COLUMN v2 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should succeed. ALTER TABLE t2 IMPORT TABLESPACE; SELECT * from t2 limit 10; SELECT COUNT(*) from t2; SELECT NAME, N_COLS, INSTANT_COLS FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME="test/t1" OR NAME="test/t2"; SELECT NAME, POS, HAS_DEFAULT from information_Schema.innodb_columns WHERE NAME='v1' OR NAME='v2'; DROP TABLE t2; DROP TABLE t1; --remove_file $MYSQLD_DATADIR/t1.cfg_back --remove_file $MYSQLD_DATADIR/t1.ibd_back --echo # ---------------------- Test 2 ---------------------------------- --echo # Source table doesn't have INSTANT columns but target table does --echo # ---------------------------------------------------------------- --echo # Create source table t1 and add a column INSTANTly CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, v1 VARCHAR(255), v2 VARCHAR(255)); --echo # Insert some data into t1 --disable_query_log let $i=1000; while ($i) { INSERT INTO t1(v1, v2) VALUES ("aaaaaaaaaaaaa", "bbbbbbbbbbbbbb"); dec $i; } --enable_query_log SELECT * from t1 limit 10; SELECT COUNT(*) from t1; SELECT NAME, N_COLS, INSTANT_COLS FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME="test/t1"; SELECT NAME, POS, HAS_DEFAULT from information_Schema.innodb_columns WHERE NAME='v1' OR NAME='v2'; --echo # Flush the table and store CFG/IBD files to temp FLUSH TABLE t1 FOR EXPORT; --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/t1.cfg_back --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/t1.ibd_back UNLOCK TABLES; --echo # Create table t2 with no INSTANTly added columns CREATE TABLE t2(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, v1 VARCHAR(255), v2 VARCHAR(255)); ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should succeed. ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; --echo # Create table t2 with 1 INSTANTly added columns CREATE TABLE t2(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, v1 VARCHAR(255)); ALTER TABLE t2 ADD COLUMN v2 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should fail. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; --remove_file $MYSQLD_DATADIR/test/t2.cfg --remove_file $MYSQLD_DATADIR/test/t2.ibd --echo # Create table t2 with 2 INSTANTly added columns CREATE TABLE t2(id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY); ALTER TABLE t2 ADD COLUMN v1 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 ADD COLUMN v2 VARCHAR(255), ALGORITHM=INSTANT; ALTER TABLE t2 DISCARD TABLESPACE; --echo # Copy CFG/IBD file from temp --copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/test/t2.cfg --copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/test/t2.ibd --echo # IMPORT should fail. --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; --remove_file $MYSQLD_DATADIR/test/t2.cfg --remove_file $MYSQLD_DATADIR/test/t2.ibd --echo # Cleanup DROP TABLE t1; --remove_file $MYSQLD_DATADIR/t1.cfg_back --remove_file $MYSQLD_DATADIR/t1.ibd_back