File: import_bugs.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (117 lines) | stat: -rw-r--r-- 3,467 bytes parent folder | download | duplicates (4)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
--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