| 1 |
--source include/have_debug.inc |
| 2 |
--source include/no_valgrind_without_big.inc |
| 3 |
--source include/not_windows.inc |
| 4 |
|
| 5 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 6 |
|
| 7 |
--echo # |
| 8 |
--echo # Bug #29627690 NOT ABLE TO IMPORT PARTITIONED TABLESPACE OLDER THAN 8.0.14 |
| 9 |
--echo # After wl#13352, we no longer try to induce 8.0.14 behaviour by debug |
| 10 |
--echo # variable. innodb.partition_upgrade* tests checks import from 8.0.14. |
| 11 |
--echo # Keeping this test to run on current version. |
| 12 |
|
| 13 |
select @@lower_case_table_names; |
| 14 |
|
| 15 |
--echo # Test 1: With Hash partitions |
| 16 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 17 |
PARTITION BY HASH (c1) PARTITIONS 3; |
| 18 |
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6); |
| 19 |
SELECT c1 FROM t1 ORDER BY c1; |
| 20 |
FLUSH TABLES t1 FOR EXPORT; |
| 21 |
perl; |
| 22 |
require 'include/innodb-util.inc'; |
| 23 |
ib_backup_tablespaces("test", "t1#p#p0", "t1#p#p1", "t1#p#p2"); |
| 24 |
EOF |
| 25 |
|
| 26 |
UNLOCK TABLES; |
| 27 |
DROP TABLE t1; |
| 28 |
|
| 29 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 30 |
PARTITION BY HASH (c1) PARTITIONS 3; |
| 31 |
|
| 32 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 33 |
|
| 34 |
perl; |
| 35 |
require 'include/innodb-util.inc'; |
| 36 |
ib_restore_tablespaces("test", "t1#p#p0", "t1#p#p1" , "t1#p#p2"); |
| 37 |
EOF |
| 38 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 39 |
SELECT * FROM t1 ORDER BY c1; |
| 40 |
DROP TABLE t1; |
| 41 |
|
| 42 |
|
| 43 |
--echo # Test 2 With range partitions/subpartitions with mixed cases partiton names |
| 44 |
|
| 45 |
create table t1 (f1 int ,f2 int) partition by range (f1) |
| 46 |
subpartition by key (f2) |
| 47 |
( |
| 48 |
partition ABCdef values less than (10) ( |
| 49 |
subpartition SUB_ABCdef0, |
| 50 |
subpartition SUB_abcdef1 |
| 51 |
), |
| 52 |
partition ABC values less than (50) ( |
| 53 |
subpartition SUB_ABC0, |
| 54 |
subpartition SUB_abc1 |
| 55 |
) , |
| 56 |
partition def values less than (100) ( |
| 57 |
subpartition sub_def0, |
| 58 |
subpartition SUB_DEF1 |
| 59 |
)); |
| 60 |
insert into t1 values (90,10) ,(40,78) ,(5,76); |
| 61 |
SELECT * from t1 order by f1; |
| 62 |
FLUSH TABLES t1 FOR EXPORT; |
| 63 |
|
| 64 |
perl; |
| 65 |
require 'include/innodb-util.inc'; |
| 66 |
ib_backup_tablespaces("test", "t1#p#abcdef#sp#sub_abcdef0", "t1#p#abcdef#sp#sub_abcdef1" |
| 67 |
, "t1#p#abc#sp#sub_abc0", "t1#p#abc#sp#sub_abc1", |
| 68 |
, "t1#p#def#sp#sub_def0", "t1#p#def#sp#sub_def1"); |
| 69 |
EOF |
| 70 |
unlock tables; |
| 71 |
drop table t1; |
| 72 |
|
| 73 |
create table t1 (f1 int ,f2 int) partition by range (f1) |
| 74 |
subpartition by key (f2) |
| 75 |
( |
| 76 |
partition ABCdef values less than (10) ( |
| 77 |
subpartition SUB_ABCdef0, |
| 78 |
subpartition SUB_abcdef1 |
| 79 |
), |
| 80 |
partition ABC values less than (50) ( |
| 81 |
subpartition SUB_ABC0, |
| 82 |
subpartition SUB_abc1 |
| 83 |
) , |
| 84 |
partition def values less than (100) ( |
| 85 |
subpartition sub_def0, |
| 86 |
subpartition SUB_DEF1 |
| 87 |
)); |
| 88 |
|
| 89 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 90 |
perl; |
| 91 |
require 'include/innodb-util.inc'; |
| 92 |
ib_restore_tablespaces("test", "t1#p#abcdef#sp#sub_abcdef0", "t1#p#abcdef#sp#sub_abcdef1" |
| 93 |
, "t1#p#abc#sp#sub_abc0", "t1#p#abc#sp#sub_abc1", |
| 94 |
, "t1#p#def#sp#sub_def0", "t1#p#def#sp#sub_def1"); |
| 95 |
EOF |
| 96 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 97 |
SELECT * FROM t1 ORDER BY f1; |
| 98 |
DROP TABLE t1; |
| 99 |
|
| 100 |
|
| 101 |
--echo # Test 3 : With encryption |
| 102 |
|
| 103 |
# restart with keying |
| 104 |
let $restart_parameters = restart: --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT; |
| 105 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH $KEYRING_PLUGIN keyring_file.so |
| 106 |
--replace_regex /\.dll/.so/ |
| 107 |
--source include/restart_mysqld.inc |
| 108 |
|
| 109 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB ENCRYPTION='Y' |
| 110 |
PARTITION BY RANGE (c1) ( PARTITION ABC VALUES LESS THAN (10)); |
| 111 |
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6); |
| 112 |
SELECT c1 FROM t1 ORDER BY c1; |
| 113 |
FLUSH TABLES t1 FOR EXPORT; |
| 114 |
|
| 115 |
perl; |
| 116 |
require 'include/innodb-util.inc'; |
| 117 |
ib_backup_tablespaces("test", "t1#p#abc"); |
| 118 |
ib_backup_cfp_file("test", "t1#p#abc"); |
| 119 |
EOF |
| 120 |
|
| 121 |
UNLOCK TABLES; |
| 122 |
DROP TABLE t1; |
| 123 |
|
| 124 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB ENCRYPTION='Y' |
| 125 |
PARTITION BY RANGE (c1) ( PARTITION ABC VALUES LESS THAN (10)); |
| 126 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 127 |
|
| 128 |
perl; |
| 129 |
require 'include/innodb-util.inc'; |
| 130 |
ib_restore_tablespaces("test", "t1#p#abc"); |
| 131 |
ib_restore_cfp_file("test", "t1#p#abc"); |
| 132 |
EOF |
| 133 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 134 |
SELECT * FROM t1 ORDER BY c1; |
| 135 |
DROP TABLE t1; |
| 136 |
|
| 137 |
--echo # Restarting server without keyring to restore server state |
| 138 |
let $restart_parameters = restart: ; |
| 139 |
--source include/restart_mysqld.inc |
| 140 |
|
| 141 |
--echo Test 4 : Missing cfg file |
| 142 |
|
| 143 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 144 |
PARTITION BY RANGE (c1) ( PARTITION ABCD VALUES LESS THAN (10)); |
| 145 |
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(8); |
| 146 |
SELECT c1 FROM t1 ORDER BY c1; |
| 147 |
FLUSH TABLES t1 FOR EXPORT; |
| 148 |
|
| 149 |
perl; |
| 150 |
require 'include/innodb-util.inc'; |
| 151 |
ib_backup_ibd_file("test", "t1#p#abcd"); |
| 152 |
EOF |
| 153 |
|
| 154 |
UNLOCK TABLES; |
| 155 |
DROP TABLE t1; |
| 156 |
|
| 157 |
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 158 |
PARTITION BY RANGE (c1) ( PARTITION ABCD VALUES LESS THAN (10)); |
| 159 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 160 |
|
| 161 |
perl; |
| 162 |
require 'include/innodb-util.inc'; |
| 163 |
ib_restore_ibd_files("test", "t1#p#abcd"); |
| 164 |
EOF |
| 165 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 166 |
SELECT * FROM t1 ORDER BY c1; |
| 167 |
DROP TABLE t1; |
| 168 |
|
| 169 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.ibd |
| 170 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfg |
| 171 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfp |
| 172 |
|
| 173 |
--echo Test 5:- |
| 174 |
--echo # 1. Create table in 8.0.13 version |
| 175 |
--echo # 2. Upgrade the table to 8.0.15 version |
| 176 |
--echo # 3. Add another partition (PART_two) |
| 177 |
--echo # 4. Do flush table and generate cfg files |
| 178 |
--echo # 5. These ibd and cfg files are present in 8.0.15_cfg.zip |
| 179 |
--echo # 6. Do import from the cfg file and ibd from 8.0.15_cfg.zip. |
| 180 |
|
| 181 |
CREATE DATABASE db1; |
| 182 |
use db1; |
| 183 |
CREATE TABLE t1 ( |
| 184 |
f1 int |
| 185 |
) ENGINE=InnoDB |
| 186 |
PARTITION BY RANGE (f1) |
| 187 |
(PARTITION PART_one VALUES LESS THAN (10), |
| 188 |
PARTITION PART_two VALUES LESS THAN (20)); |
| 189 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 190 |
|
| 191 |
--let $MYSQLD_DATADIR=`SELECT @@datadir` |
| 192 |
--copy_file $MYSQLTEST_VARDIR/std_data/8.0.15_cfg.zip $MYSQL_TMP_DIR/8.0.15_cfg.zip |
| 193 |
--exec unzip -qo $MYSQL_TMP_DIR/8.0.15_cfg.zip -d $MYSQLD_DATADIR/db1 |
| 194 |
--remove_file $MYSQL_TMP_DIR/8.0.15_cfg.zip |
| 195 |
|
| 196 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 197 |
SELECT * from t1 ORDER BY f1; |
| 198 |
ALTER TABLE t1 FORCE; |
| 199 |
SELECT * from t1 ORDER BY f1; |
| 200 |
DROP TABLE t1; |
| 201 |
--remove_files_wildcard $MYSQLD_DATADIR/db1 t1*.cfg |
| 202 |
|
| 203 |
|
| 204 |
--echo Test 6:- |
| 205 |
--echo # 1. Create table in 8.0.13 version |
| 206 |
--echo # 2. Upgrade the table to 8.0.15 version |
| 207 |
--echo # 3. Add another partition (PART_two) |
| 208 |
--echo # 4. Upgrade to 8.0.17 versiosn |
| 209 |
--echo # 5. Add another partition (PART_three) |
| 210 |
--echo # 6. Do flush table and generate cfg files |
| 211 |
--echo # 7. These ibd and cfg files are present in 8.0.17_cfg.zip |
| 212 |
--echo # 6. Do import from the cfg file and ibd from 8.0.17_cfg.zip |
| 213 |
|
| 214 |
use db1; |
| 215 |
CREATE TABLE t1 ( |
| 216 |
f1 int |
| 217 |
) ENGINE=InnoDB |
| 218 |
PARTITION BY RANGE (f1) |
| 219 |
(PARTITION PART_one VALUES LESS THAN (10), |
| 220 |
PARTITION PART_two VALUES LESS THAN (20), |
| 221 |
PARTITION PART_three VALUES LESS THAN (30)); |
| 222 |
|
| 223 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 224 |
|
| 225 |
--let $MYSQLD_DATADIR=`SELECT @@datadir` |
| 226 |
--copy_file $MYSQLTEST_VARDIR/std_data/8.0.17_cfg.zip $MYSQL_TMP_DIR/8.0.17_cfg.zip |
| 227 |
--exec unzip -qo $MYSQL_TMP_DIR/8.0.17_cfg.zip -d $MYSQLD_DATADIR/db1 |
| 228 |
--remove_file $MYSQL_TMP_DIR/8.0.17_cfg.zip |
| 229 |
|
| 230 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 231 |
SELECT * from t1 ORDER BY f1; |
| 232 |
ALTER TABLE t1 FORCE; |
| 233 |
SELECT * from t1 ORDER BY f1; |
| 234 |
|
| 235 |
DROP TABLE t1; |
| 236 |
--remove_files_wildcard $MYSQLD_DATADIR/db1 t1*.cfg |
| 237 |
--remove_files_wildcard $MYSQLD_DATADIR/db1 *.zip |
| 238 |
--remove_file $MYSQL_TMP_DIR/mysecret_keyring |
| 239 |
|
| 240 |
DROP DATABASE db1; |
| 241 |
|