Debian Codegraph @

mysql-test/suite/innodb/t/import_bugs.test

raw
1 --source include/have_innodb.inc
2 --source include/have_sequence.inc
3
4 call mtr.add_suppression("Index for table 'imp_t1' is corrupt; try to repair it");
5
6 SET @save_innodb_checksum_algorithm=@@GLOBAL.innodb_checksum_algorithm;
7 SET GLOBAL innodb_checksum_algorithm=full_crc32;
8
9 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
10 CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
11 ALTER TABLE imp_t1 DISCARD TABLESPACE ;
12 FLUSH TABLES t1 FOR EXPORT;
13 let $datadir=`select @@datadir`;
14 --copy_file $datadir/test/t1.ibd $datadir/test/imp_t1.ibd
15 UNLOCK TABLES;
16 --error ER_TABLE_SCHEMA_MISMATCH
17 ALTER TABLE imp_t1 IMPORT TABLESPACE;
18 --error ER_TABLE_EXISTS_ERROR
19 CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
20 DROP TABLE imp_t1;
21 CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
22 DROP TABLE imp_t1, t1;
23
24 SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm;
25
26 --echo #
27 --echo # MDEV-33400 Adaptive hash index corruption after DISCARD TABLESPACE
28 --echo #
29
30 SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index;
31 SET GLOBAL innodb_adaptive_hash_index=ON;
32
33 CREATE TABLE t (a INT PRIMARY KEY) ENGINE=INNODB;
34 INSERT INTO t SELECT * FROM seq_1_to_131;
35 ALTER TABLE t ADD hid INT DEFAULT 2;
36 INSERT INTO t VALUES (251,1);
37 ALTER TABLE t DISCARD TABLESPACE;
38 CHECK TABLE mysql.innodb_table_stats;
39 DROP TABLE t;
40 SET GLOBAL innodb_adaptive_hash_index=@save_adaptive;
41
42 --echo # End of 10.4 tests
43
44 --echo #
45 --echo # MDEV-18288: Transportable Tablespaces leave AUTO_INCREMENT in mismatched
46 --echo # state, causing INSERT errors in newly imported tables when .cfg is not used.
47 --echo #
48
49 CREATE TABLE t1(
50 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
51 PRIMARY KEY (id)
52 ) ENGINE=INNODB;
53
54 CREATE TABLE t2 LIKE t1;
55
56 ALTER TABLE t2 DISCARD TABLESPACE;
57
58 INSERT INTO t1() VALUES();
59 INSERT INTO t1() VALUES();
60
61 FLUSH TABLES test.t1 FOR EXPORT;
62
63 --echo # Copy data file
64 --copy_file $datadir/test/t1.ibd $datadir/test/t2.ibd
65
66 --echo # Skip CFG file copy
67 #--copy_file $datadir/test/t1.cfg $datadir/test/t2.cfg
68 --remove_file $datadir/test/t1.cfg
69
70 UNLOCK TABLES;
71 DROP TABLE t1;
72
73 --replace_regex /opening '.*\/test\//opening '.\/test\//
74 ALTER TABLE t2 IMPORT TABLESPACE;
75
76 SELECT * FROM t2 ORDER BY id;
77
78 INSERT INTO t2() VALUES();
79 INSERT INTO t2() VALUES();
80 INSERT INTO t2() VALUES();
81
82 SELECT * FROM t2 ORDER BY id;
83 DROP TABLE t2;
84
85 --echo #
86 --echo # MDEV-34181 Instant table aborts after discard tablespace
87 --echo #
88 CREATE TABLE t1(c3 INT, c2 INT, c1 INT KEY)ENGINE=InnoDB;
89 INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2);
90 CREATE TABLE t2 (c1 INT KEY) ENGINE=InnoDB;
91 INSERT INTO t2 VALUES(1);
92 ALTER TABLE t2 ADD c2 INT;
93 FLUSH TABLES t1 FOR EXPORT;
94 let $datadir=`select @@datadir`;
95 --copy_file $datadir/test/t1.ibd $datadir/test/imp_t1.ibd
96 UNLOCK TABLES;
97 ALTER TABLE t2 DISCARD TABLESPACE;
98 ALTER TABLE t2 ADD c3 INT FIRST;
99 --move_file $datadir/test/imp_t1.ibd $datadir/test/t2.ibd
100
101 --replace_regex /opening '.*\/test\//opening '.\/test\//
102 ALTER TABLE t2 IMPORT TABLESPACE;
103 SHOW CREATE TABLE t2;
104 DROP TABLE t2, t1;
105 --echo # End of 10.5 tests
106
107 --echo #
108 --echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)'
109 --echo # failed in dberr_t row_discard_tablespace_for_mysql
110 --echo # (dict_table_t*, trx_t*)
111 CREATE TABLE t1 (c INT KEY) ENGINE=INNODB;
112 CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB;
113 --error ER_ROW_IS_REFERENCED_2
114 ALTER TABLE t1 DISCARD TABLESPACE;
115 DROP TABLE t2, t1;
116
117 --echo # End of 10.6 tests