summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/t/import_bugs.test
blob: d22b4b67272d514ee2aa0b0560628003135f40a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
--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 # 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