| 1 |
--echo # |
| 2 |
--echo # Bug #30190227 CRASH IMPORTING TABLESPACE WITH DIFFERENT DATA DIRECTORY |
| 3 |
--echo # BUT NOT .CFG FILE |
| 4 |
--echo # |
| 5 |
--echo # Test-case-1 |
| 6 |
# Source tablespace is created with DATA DIRECTORY clause, |
| 7 |
# whereas destination table is defined without DATA DIRECTORY clause. |
| 8 |
|
| 9 |
--let $MYSQLD_DATADIR=`select @@datadir` |
| 10 |
--let $DB = `SELECT DATABASE()` |
| 11 |
--let $data_directory = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir' |
| 12 |
|
| 13 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 14 |
eval CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY) $data_directory; |
| 15 |
INSERT INTO t1 VALUES (1), (2), (3); |
| 16 |
FLUSH TABLES t1 FOR EXPORT; |
| 17 |
|
| 18 |
--copy_file '$MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd' $MYSQL_TMP_DIR/t1.ibd |
| 19 |
|
| 20 |
UNLOCK TABLES; |
| 21 |
DROP TABLE t1; |
| 22 |
CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY); |
| 23 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 24 |
|
| 25 |
--move_file $MYSQL_TMP_DIR/t1.ibd $MYSQLD_DATADIR/$DB/t1.ibd |
| 26 |
--error ER_TABLE_SCHEMA_MISMATCH |
| 27 |
|
| 28 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 29 |
DROP TABLE t1; |
| 30 |
--remove_file $MYSQLD_DATADIR/$DB/t1.ibd |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Test-case-2 |
| 34 |
# Source tablespace is created without DATA DIRECTORY clause, |
| 35 |
# whereas destination table is defined with DATA DIRECTORY clause. |
| 36 |
|
| 37 |
CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY); |
| 38 |
INSERT INTO t1 VALUES (1), (2), (3); |
| 39 |
FLUSH TABLES t1 FOR EXPORT; |
| 40 |
|
| 41 |
--copy_file '$MYSQLD_DATADIR/$DB/t1.ibd' $MYSQL_TMP_DIR/t1.ibd |
| 42 |
|
| 43 |
UNLOCK TABLES; |
| 44 |
DROP TABLE t1; |
| 45 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 46 |
eval CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY) $data_directory; |
| 47 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 48 |
|
| 49 |
--move_file $MYSQL_TMP_DIR/t1.ibd $MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd |
| 50 |
|
| 51 |
--error ER_TABLE_SCHEMA_MISMATCH |
| 52 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 53 |
DROP TABLE t1; |
| 54 |
--remove_file $MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd |
| 55 |
|
| 56 |
|
| 57 |
--echo # |
| 58 |
--echo # Bug #30190199 ERROR WHEN IMPORTING TABLESPACE WITH DIFFERENT DATA |
| 59 |
--echo # DIRECTORY LACKS DETAILS |
| 60 |
--echo # |
| 61 |
--echo # Test-case-3 |
| 62 |
# Same as test-case-1 but .cfg file is available during |
| 63 |
# import tablespace. |
| 64 |
|
| 65 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 66 |
eval CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY) $data_directory; |
| 67 |
INSERT INTO t1 VALUES (1), (2), (3); |
| 68 |
FLUSH TABLES t1 FOR EXPORT; |
| 69 |
|
| 70 |
--copy_file '$MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd' $MYSQL_TMP_DIR/t1.ibd |
| 71 |
--copy_file '$MYSQL_TMP_DIR/alt_dir/$DB/t1.cfg' $MYSQL_TMP_DIR/t1.cfg |
| 72 |
|
| 73 |
UNLOCK TABLES; |
| 74 |
DROP TABLE t1; |
| 75 |
CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY); |
| 76 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 77 |
|
| 78 |
--move_file $MYSQL_TMP_DIR/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg |
| 79 |
--move_file $MYSQL_TMP_DIR/t1.ibd $MYSQLD_DATADIR/$DB/t1.ibd |
| 80 |
|
| 81 |
--error ER_TABLE_SCHEMA_MISMATCH |
| 82 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 83 |
DROP TABLE t1; |
| 84 |
--remove_file $MYSQLD_DATADIR/$DB/t1.ibd |
| 85 |
--remove_file $MYSQLD_DATADIR/$DB/t1.cfg |
| 86 |
|
| 87 |
--echo # |
| 88 |
--echo # Test-case-4 |
| 89 |
# Same as test-case-2 but .cfg file is available during |
| 90 |
# import tablespace. |
| 91 |
|
| 92 |
CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY); |
| 93 |
INSERT INTO t1 VALUES (1), (2), (3); |
| 94 |
FLUSH TABLES t1 FOR EXPORT; |
| 95 |
|
| 96 |
--copy_file '$MYSQLD_DATADIR/$DB/t1.ibd' $MYSQL_TMP_DIR/t1.ibd |
| 97 |
--copy_file '$MYSQLD_DATADIR/$DB/t1.cfg' $MYSQL_TMP_DIR/t1.cfg |
| 98 |
|
| 99 |
UNLOCK TABLES; |
| 100 |
DROP TABLE t1; |
| 101 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 102 |
eval CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY) $data_directory; |
| 103 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 104 |
|
| 105 |
--move_file $MYSQL_TMP_DIR/t1.ibd $MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd |
| 106 |
--move_file $MYSQL_TMP_DIR/t1.cfg $MYSQL_TMP_DIR/alt_dir/$DB/t1.cfg |
| 107 |
|
| 108 |
--error ER_TABLE_SCHEMA_MISMATCH |
| 109 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 110 |
DROP TABLE t1; |
| 111 |
--remove_file $MYSQL_TMP_DIR/alt_dir/$DB/t1.ibd |
| 112 |
--remove_file $MYSQL_TMP_DIR/alt_dir/$DB/t1.cfg |
| 113 |
|
| 114 |
--echo # |
| 115 |
--echo # Cleanup |
| 116 |
--echo # |
| 117 |
|
| 118 |
--rmdir $MYSQL_TMP_DIR/alt_dir/test |
| 119 |
--rmdir $MYSQL_TMP_DIR/alt_dir |