| 1 |
# Tool for testing operations on discarded partitions. Caller need to set |
| 2 |
# $discarded_partition_option to one of: |
| 3 |
# 1. PREPARE - creates 6 tables with different partition layouts and |
| 4 |
# DISCARD/IMPORT TABLESPACE history |
| 5 |
# 2. SELECT_TEST - performs SELECT queries on created tables |
| 6 |
# 3. REBUILD_PARTITION_TEST - performs ALTER TABLE ... REBUILD PARTITION |
| 7 |
# 4. SECONDARY_INDEX_TEST - creates and then drops secondary index |
| 8 |
# 5. DROP_TEST - performs drop test on created tables and does cleanup. TODO describe more |
| 9 |
# 6. PREPARE_FROM_8020 - similar to PREPARE, but loads data from prepared |
| 10 |
# 8.0.20 version of MySQL. Used for upgrade test |
| 11 |
# 7. CLEANUP_FROM_8020 - must be called after all tests are done, when prepared from 8.0 |
| 12 |
# |
| 13 |
# Feel free to add new tests |
| 14 |
|
| 15 |
if($discarded_partition_option == 'PREPARE') |
| 16 |
{ |
| 17 |
let $MYSQLD_DATADIR = `SELECT @@datadir`; |
| 18 |
|
| 19 |
CREATE DATABASE partitions; |
| 20 |
|
| 21 |
CREATE TABLE partitions.export1(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4; |
| 22 |
FLUSH TABLE partitions.export1 FOR EXPORT; |
| 23 |
--copy_file $MYSQLD_DATADIR/partitions/export1#p#p0.cfg $MYSQLD_DATADIR/export1#p#p0.cfg_bak |
| 24 |
--copy_file $MYSQLD_DATADIR/partitions/export1#p#p0.ibd $MYSQLD_DATADIR/export1#p#p0.ibd_bak |
| 25 |
|
| 26 |
--copy_file $MYSQLD_DATADIR/partitions/export1#p#p1.cfg $MYSQLD_DATADIR/export1#p#p1.cfg_bak |
| 27 |
--copy_file $MYSQLD_DATADIR/partitions/export1#p#p1.ibd $MYSQLD_DATADIR/export1#p#p1.ibd_bak |
| 28 |
UNLOCK TABLES; |
| 29 |
|
| 30 |
# |
| 31 |
# partitions.t1 is table with just single partition discarded |
| 32 |
# |
| 33 |
CREATE TABLE partitions.t1(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4; |
| 34 |
ALTER TABLE partitions.t1 DISCARD PARTITION p0 TABLESPACE; |
| 35 |
|
| 36 |
# |
| 37 |
# partitions.t2 is a table, with two partitions discarded and then, both imported |
| 38 |
# |
| 39 |
CREATE TABLE partitions.t2(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4; |
| 40 |
ALTER TABLE partitions.t2 DISCARD PARTITION p0, p1 TABLESPACE; |
| 41 |
--copy_file $MYSQLD_DATADIR/export1#p#p0.cfg_bak $MYSQLD_DATADIR/partitions/t2#p#p0.cfg |
| 42 |
--copy_file $MYSQLD_DATADIR/export1#p#p0.ibd_bak $MYSQLD_DATADIR/partitions/t2#p#p0.ibd |
| 43 |
|
| 44 |
--copy_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak $MYSQLD_DATADIR/partitions/t2#p#p1.cfg |
| 45 |
--copy_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak $MYSQLD_DATADIR/partitions/t2#p#p1.ibd |
| 46 |
ALTER TABLE partitions.t2 IMPORT PARTITION p0 TABLESPACE; |
| 47 |
ALTER TABLE partitions.t2 IMPORT PARTITION p1 TABLESPACE; |
| 48 |
|
| 49 |
# |
| 50 |
# partitions.t3 is a table, with two partitions discarded and single partition imported |
| 51 |
# |
| 52 |
CREATE TABLE partitions.t3(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4; |
| 53 |
ALTER TABLE partitions.t3 DISCARD PARTITION p0, p1 TABLESPACE; |
| 54 |
--copy_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak $MYSQLD_DATADIR/partitions/t3#p#p1.cfg |
| 55 |
--copy_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak $MYSQLD_DATADIR/partitions/t3#p#p1.ibd |
| 56 |
ALTER TABLE partitions.t3 IMPORT PARTITION p1 TABLESPACE; |
| 57 |
|
| 58 |
|
| 59 |
# |
| 60 |
# Table used to export partitions which are used for imports later in the test |
| 61 |
# |
| 62 |
CREATE TABLE partitions.export2 (c1 INT, c2 INT) |
| 63 |
PARTITION BY RANGE( c2) |
| 64 |
SUBPARTITION BY HASH( c2 ) |
| 65 |
SUBPARTITIONS 2 ( |
| 66 |
PARTITION p0 VALUES LESS THAN (10), |
| 67 |
PARTITION p1 VALUES LESS THAN (20), |
| 68 |
PARTITION p2 VALUES LESS THAN (30), |
| 69 |
PARTITION p3 VALUES LESS THAN MAXVALUE |
| 70 |
); |
| 71 |
|
| 72 |
FLUSH TABLE partitions.export2 FOR EXPORT; |
| 73 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp0.cfg $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak |
| 74 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp0.ibd $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak |
| 75 |
|
| 76 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp1.cfg $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak |
| 77 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp1.ibd $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak |
| 78 |
|
| 79 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p1#sp#p1sp0.cfg $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak |
| 80 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p1#sp#p1sp0.ibd $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak |
| 81 |
|
| 82 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p2#sp#p2sp0.cfg $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak |
| 83 |
--copy_file $MYSQLD_DATADIR/partitions/export2#p#p2#sp#p2sp0.ibd $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak |
| 84 |
|
| 85 |
UNLOCK TABLES; |
| 86 |
|
| 87 |
# |
| 88 |
# partitions.t4 is a table with: |
| 89 |
# 1. Partition p0, with two discarded subpartitions |
| 90 |
# 2. Partition p1, with single discarded subpartition |
| 91 |
# 3. Partition p2, with two subpartitions |
| 92 |
# 4. Partition p3, with two subpartitions |
| 93 |
# |
| 94 |
|
| 95 |
CREATE TABLE partitions.t4 (c1 INT, c2 INT) |
| 96 |
PARTITION BY RANGE( c2 ) |
| 97 |
SUBPARTITION BY HASH( c2 ) |
| 98 |
SUBPARTITIONS 2 ( |
| 99 |
PARTITION p0 VALUES LESS THAN (10), |
| 100 |
PARTITION p1 VALUES LESS THAN (20), |
| 101 |
PARTITION p2 VALUES LESS THAN (30), |
| 102 |
PARTITION p3 VALUES LESS THAN MAXVALUE |
| 103 |
); |
| 104 |
|
| 105 |
ALTER TABLE partitions.t4 DISCARD PARTITION p0sp0 TABLESPACE; |
| 106 |
ALTER TABLE partitions.t4 DISCARD PARTITION p0sp1 TABLESPACE; |
| 107 |
ALTER TABLE partitions.t4 DISCARD PARTITION p1sp0 TABLESPACE; |
| 108 |
|
| 109 |
|
| 110 |
# |
| 111 |
# partitions.t5 is a table with: |
| 112 |
# 1. Partition p0, with two discarded subpartitions, two of which are later imported |
| 113 |
# 2. Partition p1, with two discarded subpartitions, one of which is later imported |
| 114 |
# 3. Partition p2, with single discarded subpartition which later is imported |
| 115 |
# 4. Partition p3, with no discarded subpartitions |
| 116 |
# |
| 117 |
CREATE TABLE partitions.t5 (c1 INT, c2 INT) |
| 118 |
PARTITION BY RANGE( c2 ) |
| 119 |
SUBPARTITION BY HASH( c2 ) |
| 120 |
SUBPARTITIONS 2 ( |
| 121 |
PARTITION p0 VALUES LESS THAN (10), |
| 122 |
PARTITION p1 VALUES LESS THAN (20), |
| 123 |
PARTITION p2 VALUES LESS THAN (30), |
| 124 |
PARTITION p3 VALUES LESS THAN MAXVALUE |
| 125 |
); |
| 126 |
|
| 127 |
ALTER TABLE partitions.t5 DISCARD PARTITION p0sp0 TABLESPACE; |
| 128 |
ALTER TABLE partitions.t5 DISCARD PARTITION p0sp1 TABLESPACE; |
| 129 |
ALTER TABLE partitions.t5 DISCARD PARTITION p1sp0 TABLESPACE; |
| 130 |
ALTER TABLE partitions.t5 DISCARD PARTITION p1sp1 TABLESPACE; |
| 131 |
ALTER TABLE partitions.t5 DISCARD PARTITION p2sp0 TABLESPACE; |
| 132 |
|
| 133 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp0.cfg |
| 134 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp0.ibd |
| 135 |
|
| 136 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp1.cfg |
| 137 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp1.ibd |
| 138 |
|
| 139 |
--copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p1#sp#p1sp0.cfg |
| 140 |
--copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p1#sp#p1sp0.ibd |
| 141 |
|
| 142 |
--copy_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p2#sp#p2sp0.cfg |
| 143 |
--copy_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p2#sp#p2sp0.ibd |
| 144 |
|
| 145 |
ALTER TABLE partitions.t5 IMPORT PARTITION p0sp0 TABLESPACE; |
| 146 |
ALTER TABLE partitions.t5 IMPORT PARTITION p0sp1 TABLESPACE; |
| 147 |
ALTER TABLE partitions.t5 IMPORT PARTITION p1sp0 TABLESPACE; |
| 148 |
ALTER TABLE partitions.t5 IMPORT PARTITION p2sp0 TABLESPACE; |
| 149 |
|
| 150 |
# |
| 151 |
# partitions.t6 is a table with: |
| 152 |
# 1. Partition p0 which is discarded with a single query |
| 153 |
# 2. Partition p1 which has single subpartition discarded |
| 154 |
# 3. Partitions p2 and p3 with no discarded subpartitions |
| 155 |
# |
| 156 |
CREATE TABLE partitions.t6 (c1 INT, c2 INT) |
| 157 |
PARTITION BY RANGE( c2 ) |
| 158 |
SUBPARTITION BY HASH( c2 ) |
| 159 |
SUBPARTITIONS 2 ( |
| 160 |
PARTITION p0 VALUES LESS THAN (10), |
| 161 |
PARTITION p1 VALUES LESS THAN (20), |
| 162 |
PARTITION p2 VALUES LESS THAN (30), |
| 163 |
PARTITION p3 VALUES LESS THAN MAXVALUE |
| 164 |
); |
| 165 |
|
| 166 |
ALTER TABLE partitions.t6 DISCARD PARTITION p0 TABLESPACE; |
| 167 |
ALTER TABLE partitions.t6 DISCARD PARTITION p1sp1 TABLESPACE; |
| 168 |
|
| 169 |
# |
| 170 |
# partitions.t7 is a table with: |
| 171 |
# 1. Partition p0 which is discarded with a single query, which are later imported |
| 172 |
# 2. Partition p1 which has single subpartition discarded which is later imported |
| 173 |
# 3. Partitions p2 and p3 with no discarded subpartitions |
| 174 |
# |
| 175 |
CREATE TABLE partitions.t7 (c1 INT, c2 INT) |
| 176 |
PARTITION BY RANGE( c2 ) |
| 177 |
SUBPARTITION BY HASH( c2 ) |
| 178 |
SUBPARTITIONS 2 ( |
| 179 |
PARTITION p0 VALUES LESS THAN (10), |
| 180 |
PARTITION p1 VALUES LESS THAN (20), |
| 181 |
PARTITION p2 VALUES LESS THAN (30), |
| 182 |
PARTITION p3 VALUES LESS THAN MAXVALUE |
| 183 |
); |
| 184 |
|
| 185 |
ALTER TABLE partitions.t7 DISCARD PARTITION p0 TABLESPACE; |
| 186 |
ALTER TABLE partitions.t7 DISCARD PARTITION p1sp0 TABLESPACE; |
| 187 |
|
| 188 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp0.cfg |
| 189 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp0.ibd |
| 190 |
|
| 191 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp1.cfg |
| 192 |
--copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp1.ibd |
| 193 |
|
| 194 |
--copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p1#sp#p1sp0.cfg |
| 195 |
--copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p1#sp#p1sp0.ibd |
| 196 |
|
| 197 |
ALTER TABLE partitions.t7 IMPORT PARTITION p0sp0 TABLESPACE; |
| 198 |
ALTER TABLE partitions.t7 IMPORT PARTITION p0sp1 TABLESPACE; |
| 199 |
ALTER TABLE partitions.t7 IMPORT PARTITION p1sp0 TABLESPACE; |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
--remove_file $MYSQLD_DATADIR/export1#p#p0.cfg_bak |
| 204 |
--remove_file $MYSQLD_DATADIR/export1#p#p0.ibd_bak |
| 205 |
|
| 206 |
--remove_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak |
| 207 |
--remove_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak |
| 208 |
|
| 209 |
--remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak |
| 210 |
--remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak |
| 211 |
|
| 212 |
--remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak |
| 213 |
--remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak |
| 214 |
|
| 215 |
--remove_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak |
| 216 |
--remove_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak |
| 217 |
|
| 218 |
--remove_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak |
| 219 |
--remove_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak |
| 220 |
|
| 221 |
} |
| 222 |
|
| 223 |
if($discarded_partition_option == 'SELECT_TEST') |
| 224 |
{ |
| 225 |
|
| 226 |
# |
| 227 |
# partitions.t1 |
| 228 |
# |
| 229 |
|
| 230 |
--error ER_TABLESPACE_DISCARDED |
| 231 |
SELECT * FROM partitions.t1; |
| 232 |
|
| 233 |
--error ER_TABLESPACE_DISCARDED |
| 234 |
SELECT * FROM partitions.t1 PARTITION (p0); |
| 235 |
SELECT * FROM partitions.t1 PARTITION (p1); |
| 236 |
SELECT * FROM partitions.t1 PARTITION (p2); |
| 237 |
SELECT * FROM partitions.t1 PARTITION (p3); |
| 238 |
|
| 239 |
# |
| 240 |
# partitions.t2 |
| 241 |
# |
| 242 |
|
| 243 |
SELECT * FROM partitions.t2; |
| 244 |
|
| 245 |
SELECT * FROM partitions.t2 PARTITION (p0); |
| 246 |
SELECT * FROM partitions.t2 PARTITION (p1); |
| 247 |
SELECT * FROM partitions.t2 PARTITION (p2); |
| 248 |
SELECT * FROM partitions.t2 PARTITION (p3); |
| 249 |
|
| 250 |
# |
| 251 |
# partitions.t3 |
| 252 |
# |
| 253 |
|
| 254 |
--error ER_TABLESPACE_DISCARDED |
| 255 |
SELECT * FROM partitions.t3; |
| 256 |
|
| 257 |
--error ER_TABLESPACE_DISCARDED |
| 258 |
SELECT * FROM partitions.t3 PARTITION (p0); |
| 259 |
SELECT * FROM partitions.t3 PARTITION (p1); |
| 260 |
SELECT * FROM partitions.t3 PARTITION (p2); |
| 261 |
SELECT * FROM partitions.t3 PARTITION (p3); |
| 262 |
|
| 263 |
# |
| 264 |
# partitions.t4 |
| 265 |
# |
| 266 |
|
| 267 |
--error ER_TABLESPACE_DISCARDED |
| 268 |
SELECT * FROM partitions.t4; |
| 269 |
|
| 270 |
--error ER_TABLESPACE_DISCARDED |
| 271 |
SELECT * FROM partitions.t4 PARTITION (p0); |
| 272 |
--error ER_TABLESPACE_DISCARDED |
| 273 |
SELECT * FROM partitions.t4 PARTITION (p0sp0); |
| 274 |
--error ER_TABLESPACE_DISCARDED |
| 275 |
SELECT * FROM partitions.t4 PARTITION (p0sp1); |
| 276 |
|
| 277 |
--error ER_TABLESPACE_DISCARDED |
| 278 |
SELECT * FROM partitions.t4 PARTITION (p1); |
| 279 |
--error ER_TABLESPACE_DISCARDED |
| 280 |
SELECT * FROM partitions.t4 PARTITION (p1sp0); |
| 281 |
SELECT * FROM partitions.t4 PARTITION (p1sp1); |
| 282 |
|
| 283 |
SELECT * FROM partitions.t4 PARTITION (p2); |
| 284 |
SELECT * FROM partitions.t4 PARTITION (p2sp0); |
| 285 |
SELECT * FROM partitions.t4 PARTITION (p2sp1); |
| 286 |
|
| 287 |
# |
| 288 |
# partitions.t5 |
| 289 |
# |
| 290 |
|
| 291 |
--error ER_TABLESPACE_DISCARDED |
| 292 |
SELECT * FROM partitions.t5; |
| 293 |
|
| 294 |
SELECT * FROM partitions.t5 PARTITION (p0); |
| 295 |
SELECT * FROM partitions.t5 PARTITION (p0sp0); |
| 296 |
SELECT * FROM partitions.t5 PARTITION (p0sp1); |
| 297 |
|
| 298 |
--error ER_TABLESPACE_DISCARDED |
| 299 |
SELECT * FROM partitions.t5 PARTITION (p1); |
| 300 |
SELECT * FROM partitions.t5 PARTITION (p1sp0); |
| 301 |
--error ER_TABLESPACE_DISCARDED |
| 302 |
SELECT * FROM partitions.t5 PARTITION (p1sp1); |
| 303 |
|
| 304 |
SELECT * FROM partitions.t5 PARTITION (p2); |
| 305 |
SELECT * FROM partitions.t5 PARTITION (p2sp0); |
| 306 |
SELECT * FROM partitions.t5 PARTITION (p2sp1); |
| 307 |
|
| 308 |
# |
| 309 |
# partitions.t6 |
| 310 |
# |
| 311 |
|
| 312 |
--error ER_TABLESPACE_DISCARDED |
| 313 |
SELECT * FROM partitions.t6; |
| 314 |
|
| 315 |
--error ER_TABLESPACE_DISCARDED |
| 316 |
SELECT * FROM partitions.t6 PARTITION (p0); |
| 317 |
--error ER_TABLESPACE_DISCARDED |
| 318 |
SELECT * FROM partitions.t6 PARTITION (p0sp0); |
| 319 |
--error ER_TABLESPACE_DISCARDED |
| 320 |
SELECT * FROM partitions.t6 PARTITION (p0sp1); |
| 321 |
|
| 322 |
--error ER_TABLESPACE_DISCARDED |
| 323 |
SELECT * FROM partitions.t6 PARTITION (p1); |
| 324 |
SELECT * FROM partitions.t6 PARTITION (p1sp0); |
| 325 |
--error ER_TABLESPACE_DISCARDED |
| 326 |
SELECT * FROM partitions.t6 PARTITION (p1sp1); |
| 327 |
|
| 328 |
SELECT * FROM partitions.t6 PARTITION (p2); |
| 329 |
SELECT * FROM partitions.t6 PARTITION (p2sp0); |
| 330 |
SELECT * FROM partitions.t6 PARTITION (p2sp1); |
| 331 |
|
| 332 |
# |
| 333 |
# partitions.t7 |
| 334 |
# |
| 335 |
|
| 336 |
SELECT * FROM partitions.t7; |
| 337 |
|
| 338 |
SELECT * FROM partitions.t7 PARTITION (p0); |
| 339 |
SELECT * FROM partitions.t7 PARTITION (p0sp0); |
| 340 |
SELECT * FROM partitions.t7 PARTITION (p0sp1); |
| 341 |
|
| 342 |
SELECT * FROM partitions.t7 PARTITION (p1); |
| 343 |
SELECT * FROM partitions.t7 PARTITION (p1sp0); |
| 344 |
SELECT * FROM partitions.t7 PARTITION (p1sp1); |
| 345 |
|
| 346 |
SELECT * FROM partitions.t7 PARTITION (p2); |
| 347 |
SELECT * FROM partitions.t7 PARTITION (p2sp0); |
| 348 |
SELECT * FROM partitions.t7 PARTITION (p2sp1); |
| 349 |
} |
| 350 |
|
| 351 |
if($discarded_partition_option == 'REBUILD_PARTITION_TEST') |
| 352 |
{ |
| 353 |
# Currently we turned off rebuilding partitions which are discarded, because |
| 354 |
# it results in some locks left (if we quit mysqld without droping Tables) |
| 355 |
# |
| 356 |
# Once that's fixed, uncomment rebuilding of discarded partitions |
| 357 |
|
| 358 |
# |
| 359 |
# partitions.t1 |
| 360 |
# |
| 361 |
|
| 362 |
--error ER_TABLESPACE_DISCARDED |
| 363 |
ALTER TABLE partitions.t1 REBUILD PARTITION p0; |
| 364 |
ALTER TABLE partitions.t1 REBUILD PARTITION p1; |
| 365 |
ALTER TABLE partitions.t1 REBUILD PARTITION p2; |
| 366 |
ALTER TABLE partitions.t1 REBUILD PARTITION p3; |
| 367 |
|
| 368 |
# |
| 369 |
# partitions.t2 |
| 370 |
# |
| 371 |
|
| 372 |
ALTER TABLE partitions.t2 REBUILD PARTITION p0; |
| 373 |
ALTER TABLE partitions.t2 REBUILD PARTITION p1; |
| 374 |
ALTER TABLE partitions.t2 REBUILD PARTITION p2; |
| 375 |
ALTER TABLE partitions.t2 REBUILD PARTITION p3; |
| 376 |
|
| 377 |
# |
| 378 |
# partitions.t3 |
| 379 |
# |
| 380 |
|
| 381 |
--error ER_TABLESPACE_DISCARDED |
| 382 |
ALTER TABLE partitions.t3 REBUILD PARTITION p0; |
| 383 |
ALTER TABLE partitions.t3 REBUILD PARTITION p1; |
| 384 |
ALTER TABLE partitions.t3 REBUILD PARTITION p2; |
| 385 |
ALTER TABLE partitions.t3 REBUILD PARTITION p3; |
| 386 |
|
| 387 |
# |
| 388 |
# partitions.t4 |
| 389 |
# |
| 390 |
|
| 391 |
--error ER_TABLESPACE_DISCARDED |
| 392 |
ALTER TABLE partitions.t4 REBUILD PARTITION p0; |
| 393 |
--error ER_TABLESPACE_DISCARDED |
| 394 |
ALTER TABLE partitions.t4 REBUILD PARTITION p1; |
| 395 |
ALTER TABLE partitions.t4 REBUILD PARTITION p2; |
| 396 |
|
| 397 |
|
| 398 |
# |
| 399 |
# partitions.t5 |
| 400 |
# |
| 401 |
|
| 402 |
ALTER TABLE partitions.t5 REBUILD PARTITION p0; |
| 403 |
--error ER_TABLESPACE_DISCARDED |
| 404 |
ALTER TABLE partitions.t5 REBUILD PARTITION p1; |
| 405 |
ALTER TABLE partitions.t5 REBUILD PARTITION p2; |
| 406 |
|
| 407 |
|
| 408 |
# |
| 409 |
# partitions.t6 |
| 410 |
# |
| 411 |
|
| 412 |
--error ER_TABLESPACE_DISCARDED |
| 413 |
ALTER TABLE partitions.t6 REBUILD PARTITION p0; |
| 414 |
--error ER_TABLESPACE_DISCARDED |
| 415 |
ALTER TABLE partitions.t6 REBUILD PARTITION p1; |
| 416 |
ALTER TABLE partitions.t6 REBUILD PARTITION p2; |
| 417 |
|
| 418 |
|
| 419 |
# |
| 420 |
# partitions.t7 |
| 421 |
# |
| 422 |
|
| 423 |
ALTER TABLE partitions.t7 REBUILD PARTITION p0; |
| 424 |
ALTER TABLE partitions.t7 REBUILD PARTITION p1; |
| 425 |
ALTER TABLE partitions.t7 REBUILD PARTITION p2; |
| 426 |
} |
| 427 |
|
| 428 |
if($discarded_partition_option == 'SECONDARY_INDEX_TEST') |
| 429 |
{ |
| 430 |
CREATE INDEX secondary ON partitions.t1 (c2); |
| 431 |
CREATE INDEX secondary ON partitions.t2 (c2); |
| 432 |
CREATE INDEX secondary ON partitions.t3 (c2); |
| 433 |
CREATE INDEX secondary ON partitions.t4 (c2); |
| 434 |
CREATE INDEX secondary ON partitions.t5 (c2); |
| 435 |
CREATE INDEX secondary ON partitions.t6 (c2); |
| 436 |
CREATE INDEX secondary ON partitions.t7 (c2); |
| 437 |
|
| 438 |
DROP INDEX secondary ON partitions.t1; |
| 439 |
DROP INDEX secondary ON partitions.t2; |
| 440 |
DROP INDEX secondary ON partitions.t3; |
| 441 |
DROP INDEX secondary ON partitions.t4; |
| 442 |
DROP INDEX secondary ON partitions.t5; |
| 443 |
DROP INDEX secondary ON partitions.t6; |
| 444 |
DROP INDEX secondary ON partitions.t7; |
| 445 |
} |
| 446 |
|
| 447 |
if($discarded_partition_option == 'DROP_TEST') |
| 448 |
{ |
| 449 |
# Dropping table with discarded partition should succeed and clean up all files for given Tables |
| 450 |
# TODO describe more |
| 451 |
DROP TABLE partitions.t1; |
| 452 |
DROP TABLE partitions.t2; |
| 453 |
DROP TABLE partitions.t3; |
| 454 |
DROP TABLE partitions.t4; |
| 455 |
DROP TABLE partitions.t5; |
| 456 |
DROP TABLE partitions.t6; |
| 457 |
DROP TABLE partitions.t7; |
| 458 |
|
| 459 |
DROP DATABASE partitions; |
| 460 |
} |
| 461 |
|
| 462 |
if($discarded_partition_option == 'PREPARE_FROM_8020') |
| 463 |
{ |
| 464 |
--source include/shutdown_mysqld.inc |
| 465 |
|
| 466 |
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/discarded_partition_data_8020.zip $MYSQL_TMP_DIR/discarded_partition_data_8020.zip |
| 467 |
--file_exists $MYSQL_TMP_DIR/discarded_partition_data_8020.zip |
| 468 |
--exec unzip -qo $MYSQL_TMP_DIR/discarded_partition_data_8020.zip -d $MYSQL_TMP_DIR |
| 469 |
|
| 470 |
let $BUGDATADIR = $MYSQL_TMP_DIR/data_upgrade; |
| 471 |
|
| 472 |
--replace_result $BUGDATADIR BUGDATADIR |
| 473 |
--let $restart_parameters = restart: --datadir=$BUGDATADIR |
| 474 |
--let $WAIT_COUNTER=3000 #TODO why? |
| 475 |
|
| 476 |
--source include/start_mysqld.inc |
| 477 |
} |
| 478 |
|
| 479 |
if($discarded_partition_option == 'CLEANUP_FROM_8020') |
| 480 |
{ |
| 481 |
--source include/shutdown_mysqld.inc |
| 482 |
|
| 483 |
--file_exists $MYSQL_TMP_DIR/discarded_partition_data_8020.zip |
| 484 |
--force-rmdir $MYSQL_TMP_DIR/data_upgrade |
| 485 |
--remove_file $MYSQL_TMP_DIR/discarded_partition_data_8020.zip |
| 486 |
|
| 487 |
let $restart_parameters =; |
| 488 |
--source include/start_mysqld.inc |
| 489 |
} |