--source include/have_innodb.inc --source include/have_sequence.inc call mtr.add_suppression("Index for table 'imp_t1' is corrupt; try to repair it"); SET @save_innodb_checksum_algorithm=@@GLOBAL.innodb_checksum_algorithm; SET GLOBAL innodb_checksum_algorithm=full_crc32; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; ALTER TABLE imp_t1 DISCARD TABLESPACE ; FLUSH TABLES t1 FOR EXPORT; let $datadir=`select @@datadir`; --copy_file $datadir/test/t1.ibd $datadir/test/imp_t1.ibd UNLOCK TABLES; --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE imp_t1 IMPORT TABLESPACE; --error ER_TABLE_EXISTS_ERROR CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; DROP TABLE imp_t1; CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; DROP TABLE imp_t1, t1; SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm; --echo # --echo # MDEV-33400 Adaptive hash index corruption after DISCARD TABLESPACE --echo # SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; SET GLOBAL innodb_adaptive_hash_index=ON; CREATE TABLE t (a INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t SELECT * FROM seq_1_to_131; ALTER TABLE t ADD hid INT DEFAULT 2; INSERT INTO t VALUES (251,1); ALTER TABLE t DISCARD TABLESPACE; CHECK TABLE mysql.innodb_table_stats; DROP TABLE t; SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; --echo # End of 10.4 tests --echo # --echo # MDEV-18288: Transportable Tablespaces leave AUTO_INCREMENT in mismatched --echo # state, causing INSERT errors in newly imported tables when .cfg is not used. --echo # CREATE TABLE t1( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=INNODB; CREATE TABLE t2 LIKE t1; ALTER TABLE t2 DISCARD TABLESPACE; INSERT INTO t1() VALUES(); INSERT INTO t1() VALUES(); FLUSH TABLES test.t1 FOR EXPORT; --echo # Copy data file --copy_file $datadir/test/t1.ibd $datadir/test/t2.ibd --echo # Skip CFG file copy #--copy_file $datadir/test/t1.cfg $datadir/test/t2.cfg --remove_file $datadir/test/t1.cfg UNLOCK TABLES; DROP TABLE t1; --replace_regex /opening '.*\/test\//opening '.\/test\// ALTER TABLE t2 IMPORT TABLESPACE; SELECT * FROM t2 ORDER BY id; INSERT INTO t2() VALUES(); INSERT INTO t2() VALUES(); INSERT INTO t2() VALUES(); SELECT * FROM t2 ORDER BY id; DROP TABLE t2; --echo # --echo # MDEV-34181 Instant table aborts after discard tablespace --echo # CREATE TABLE t1(c3 INT, c2 INT, c1 INT KEY)ENGINE=InnoDB; INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2); CREATE TABLE t2 (c1 INT KEY) ENGINE=InnoDB; INSERT INTO t2 VALUES(1); ALTER TABLE t2 ADD c2 INT; FLUSH TABLES t1 FOR EXPORT; let $datadir=`select @@datadir`; --copy_file $datadir/test/t1.ibd $datadir/test/imp_t1.ibd UNLOCK TABLES; ALTER TABLE t2 DISCARD TABLESPACE; ALTER TABLE t2 ADD c3 INT FIRST; --copy_file $datadir/test/imp_t1.ibd $datadir/test/t2.ibd --replace_regex /opening '.*\/test\//opening '.\/test\// ALTER TABLE t2 IMPORT TABLESPACE; SHOW CREATE TABLE t2; DROP TABLE t2, t1; --echo # End of 10.5 tests --echo # --echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' --echo # failed in dberr_t row_discard_tablespace_for_mysql --echo # (dict_table_t*, trx_t*) CREATE TABLE t1 (c INT KEY) ENGINE=INNODB; CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB; --error ER_ROW_IS_REFERENCED_2 ALTER TABLE t1 DISCARD TABLESPACE; DROP TABLE t2, t1; --echo # End of 10.6 tests