|
| 1 | +# |
| 2 | +# Bug #29627690 NOT ABLE TO IMPORT PARTITIONED TABLESPACE OLDER THAN 8.0.14 |
| 3 | +# |
| 4 | +select @lower_case_table_names; |
| 5 | +@lower_case_table_names |
| 6 | +NULL |
| 7 | +# Test 1: With Hash partitions |
| 8 | +SET SESSION debug="+d,induce_lowercase_part_names"; |
| 9 | +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 10 | +PARTITION BY HASH (c1) PARTITIONS 3; |
| 11 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6); |
| 12 | +SELECT c1 FROM t1 ORDER BY c1; |
| 13 | +c1 |
| 14 | +1 |
| 15 | +2 |
| 16 | +3 |
| 17 | +4 |
| 18 | +5 |
| 19 | +6 |
| 20 | +FLUSH TABLES t1 FOR EXPORT; |
| 21 | +SET debug="-d,induce_lowercase_part_names"; |
| 22 | +backup: t1#p#p0 |
| 23 | +backup: t1#p#p1 |
| 24 | +backup: t1#p#p2 |
| 25 | +UNLOCK TABLES; |
| 26 | +DROP TABLE t1; |
| 27 | +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 28 | +PARTITION BY HASH (c1) PARTITIONS 3; |
| 29 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 30 | +restore: t1#p#p0 .ibd and .cfg files |
| 31 | +restore: t1#p#p1 .ibd and .cfg files |
| 32 | +restore: t1#p#p2 .ibd and .cfg files |
| 33 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 34 | +SELECT * FROM t1 ORDER BY c1; |
| 35 | +c1 |
| 36 | +1 |
| 37 | +2 |
| 38 | +3 |
| 39 | +4 |
| 40 | +5 |
| 41 | +6 |
| 42 | +DROP TABLE t1; |
| 43 | +# Test 2 With range partitions/subpartitions with mixed cases partiton names |
| 44 | +SET SESSION debug="+d,induce_lowercase_part_names"; |
| 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 | +f1 f2 |
| 63 | +5 76 |
| 64 | +40 78 |
| 65 | +90 10 |
| 66 | +FLUSH TABLES t1 FOR EXPORT; |
| 67 | +SET debug="-d,induce_lowercase_part_names"; |
| 68 | +backup: t1#p#abcdef#sp#sub_abcdef0 |
| 69 | +backup: t1#p#abcdef#sp#sub_abcdef1 |
| 70 | +backup: t1#p#abc#sp#sub_abc0 |
| 71 | +backup: t1#p#abc#sp#sub_abc1 |
| 72 | +backup: t1#p#def#sp#sub_def0 |
| 73 | +backup: t1#p#def#sp#sub_def1 |
| 74 | +unlock tables; |
| 75 | +drop table t1; |
| 76 | +create table t1 (f1 int ,f2 int) partition by range (f1) |
| 77 | +subpartition by key (f2) |
| 78 | +( |
| 79 | +partition ABCdef values less than (10) ( |
| 80 | +subpartition SUB_ABCdef0, |
| 81 | +subpartition SUB_abcdef1 |
| 82 | +), |
| 83 | +partition ABC values less than (50) ( |
| 84 | +subpartition SUB_ABC0, |
| 85 | +subpartition SUB_abc1 |
| 86 | +) , |
| 87 | +partition def values less than (100) ( |
| 88 | +subpartition sub_def0, |
| 89 | +subpartition SUB_DEF1 |
| 90 | +)); |
| 91 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 92 | +restore: t1#p#abcdef#sp#sub_abcdef0 .ibd and .cfg files |
| 93 | +restore: t1#p#abcdef#sp#sub_abcdef1 .ibd and .cfg files |
| 94 | +restore: t1#p#abc#sp#sub_abc0 .ibd and .cfg files |
| 95 | +restore: t1#p#abc#sp#sub_abc1 .ibd and .cfg files |
| 96 | +restore: t1#p#def#sp#sub_def0 .ibd and .cfg files |
| 97 | +restore: t1#p#def#sp#sub_def1 .ibd and .cfg files |
| 98 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 99 | +SELECT * FROM t1 ORDER BY f1; |
| 100 | +f1 f2 |
| 101 | +5 76 |
| 102 | +40 78 |
| 103 | +90 10 |
| 104 | +DROP TABLE t1; |
| 105 | +# Test 3 : With encryption |
| 106 | +# restart: --early-plugin-load=keyring_file=keyring_file.so --loose-keyring_file_data=MYSQL_TMP_DIR/mysecret_keyring --plugin-dir=KEYRING_PLUGIN_PATH |
| 107 | +SET SESSION debug="+d,induce_lowercase_part_names"; |
| 108 | +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB ENCRYPTION='Y' |
| 109 | +PARTITION BY RANGE (c1) ( PARTITION ABC VALUES LESS THAN (10)); |
| 110 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6); |
| 111 | +SELECT c1 FROM t1 ORDER BY c1; |
| 112 | +c1 |
| 113 | +1 |
| 114 | +2 |
| 115 | +3 |
| 116 | +4 |
| 117 | +5 |
| 118 | +6 |
| 119 | +FLUSH TABLES t1 FOR EXPORT; |
| 120 | +SET debug="-d,induce_lowercase_part_names"; |
| 121 | +backup: t1#p#abc |
| 122 | +UNLOCK TABLES; |
| 123 | +DROP TABLE t1; |
| 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 | +restore: t1#p#abc .ibd and .cfg files |
| 128 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 129 | +SELECT * FROM t1 ORDER BY c1; |
| 130 | +c1 |
| 131 | +1 |
| 132 | +2 |
| 133 | +3 |
| 134 | +4 |
| 135 | +5 |
| 136 | +6 |
| 137 | +DROP TABLE t1; |
| 138 | +# Restarting server without keyring to restore server state |
| 139 | +# restart: |
| 140 | +Test 4 : Missing cfg file |
| 141 | +SET SESSION debug="+d,induce_lowercase_part_names"; |
| 142 | +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB |
| 143 | +PARTITION BY RANGE (c1) ( PARTITION ABCD VALUES LESS THAN (10)); |
| 144 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(8); |
| 145 | +SELECT c1 FROM t1 ORDER BY c1; |
| 146 | +c1 |
| 147 | +1 |
| 148 | +2 |
| 149 | +3 |
| 150 | +4 |
| 151 | +5 |
| 152 | +8 |
| 153 | +FLUSH TABLES t1 FOR EXPORT; |
| 154 | +SET debug="-d,induce_lowercase_part_names"; |
| 155 | +UNLOCK TABLES; |
| 156 | +DROP TABLE t1; |
| 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 | +restore: t1#p#abcd .ibd file |
| 161 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 162 | +Warnings: |
| 163 | +Warning 1810 InnoDB: IO Read error: (2, No such file or directory) Error opening './test/t1#P#ABCD.cfg', will attempt to import without schema verification |
| 164 | +SELECT * FROM t1 ORDER BY c1; |
| 165 | +c1 |
| 166 | +1 |
| 167 | +2 |
| 168 | +3 |
| 169 | +4 |
| 170 | +5 |
| 171 | +8 |
| 172 | +DROP TABLE t1; |
| 173 | +Test 5:- |
| 174 | +# 1. Create table in 8.0.13 version |
| 175 | +# 2. Upgrade the table to 8.0.15 version |
| 176 | +# 3. Add another partition (PART_two) |
| 177 | +# 4. Do flush table and generate cfg files |
| 178 | +# 5. These ibd and cfg files are present in 8.0.15_cfg.zip |
| 179 | +# 6. Do import from the cfg file and ibd from 8.0.15_cfg.zip. |
| 180 | +CREATE DATABASE db1; |
| 181 | +use db1; |
| 182 | +CREATE TABLE t1 ( |
| 183 | +f1 int |
| 184 | +) ENGINE=InnoDB |
| 185 | +PARTITION BY RANGE (f1) |
| 186 | +(PARTITION PART_one VALUES LESS THAN (10), |
| 187 | +PARTITION PART_two VALUES LESS THAN (20)); |
| 188 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 189 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 190 | +SELECT * from t1 ORDER BY f1; |
| 191 | +f1 |
| 192 | +9 |
| 193 | +19 |
| 194 | +ALTER TABLE t1 FORCE; |
| 195 | +SELECT * from t1 ORDER BY f1; |
| 196 | +f1 |
| 197 | +9 |
| 198 | +19 |
| 199 | +DROP TABLE t1; |
| 200 | +Test 6:- |
| 201 | +# 1. Create table in 8.0.13 version |
| 202 | +# 2. Upgrade the table to 8.0.15 version |
| 203 | +# 3. Add another partition (PART_two) |
| 204 | +# 4. Upgrade to 8.0.17 versiosn |
| 205 | +# 5. Add another partition (PART_three) |
| 206 | +# 6. Do flush table and generate cfg files |
| 207 | +# 7. These ibd and cfg files are present in 8.0.17_cfg.zip |
| 208 | +# 6. Do import from the cfg file and ibd from 8.0.17_cfg.zip |
| 209 | +use db1; |
| 210 | +CREATE TABLE t1 ( |
| 211 | +f1 int |
| 212 | +) ENGINE=InnoDB |
| 213 | +PARTITION BY RANGE (f1) |
| 214 | +(PARTITION PART_one VALUES LESS THAN (10), |
| 215 | +PARTITION PART_two VALUES LESS THAN (20), |
| 216 | +PARTITION PART_three VALUES LESS THAN (30)); |
| 217 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 218 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 219 | +SELECT * from t1 ORDER BY f1; |
| 220 | +f1 |
| 221 | +9 |
| 222 | +19 |
| 223 | +29 |
| 224 | +ALTER TABLE t1 FORCE; |
| 225 | +SELECT * from t1 ORDER BY f1; |
| 226 | +f1 |
| 227 | +9 |
| 228 | +19 |
| 229 | +29 |
| 230 | +DROP TABLE t1; |
| 231 | +DROP DATABASE db1; |
0 commit comments