File: discarded_partition.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (489 lines) | stat: -rw-r--r-- 17,382 bytes parent folder | download
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# Tool for testing operations on discarded partitions. Caller need to set
# $discarded_partition_option to one of:
# 1. PREPARE - creates 6 tables with different partition layouts and
#    DISCARD/IMPORT TABLESPACE history
# 2. SELECT_TEST - performs SELECT queries on created tables
# 3. REBUILD_PARTITION_TEST - performs ALTER TABLE ... REBUILD PARTITION
# 4. SECONDARY_INDEX_TEST - creates and then drops secondary index
# 5. DROP_TEST - performs drop test on created tables and does cleanup. TODO describe more
# 6. PREPARE_FROM_8020 - similar to PREPARE, but loads data from prepared
#    8.0.20 version of MySQL. Used for upgrade test
# 7. CLEANUP_FROM_8020 - must be called after all tests are done, when prepared from 8.0
#
#  Feel free to add new tests

if($discarded_partition_option == 'PREPARE')
{
  let $MYSQLD_DATADIR = `SELECT @@datadir`;

  CREATE DATABASE partitions;

  CREATE TABLE partitions.export1(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4;
  FLUSH TABLE partitions.export1 FOR EXPORT;
  --copy_file $MYSQLD_DATADIR/partitions/export1#p#p0.cfg $MYSQLD_DATADIR/export1#p#p0.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export1#p#p0.ibd $MYSQLD_DATADIR/export1#p#p0.ibd_bak

  --copy_file $MYSQLD_DATADIR/partitions/export1#p#p1.cfg $MYSQLD_DATADIR/export1#p#p1.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export1#p#p1.ibd $MYSQLD_DATADIR/export1#p#p1.ibd_bak
  UNLOCK TABLES;

  #
  # partitions.t1 is table with just single partition discarded
  #
  CREATE TABLE partitions.t1(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4;
  ALTER TABLE partitions.t1 DISCARD PARTITION p0 TABLESPACE;

  #
  # partitions.t2 is a table, with two partitions discarded and then, both imported
  #
  CREATE TABLE partitions.t2(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4;
  ALTER TABLE partitions.t2 DISCARD PARTITION p0, p1 TABLESPACE;
  --copy_file $MYSQLD_DATADIR/export1#p#p0.cfg_bak $MYSQLD_DATADIR/partitions/t2#p#p0.cfg
  --copy_file $MYSQLD_DATADIR/export1#p#p0.ibd_bak $MYSQLD_DATADIR/partitions/t2#p#p0.ibd

  --copy_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak $MYSQLD_DATADIR/partitions/t2#p#p1.cfg
  --copy_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak $MYSQLD_DATADIR/partitions/t2#p#p1.ibd
  ALTER TABLE partitions.t2 IMPORT PARTITION p0 TABLESPACE;
  ALTER TABLE partitions.t2 IMPORT PARTITION p1 TABLESPACE;

  #
  # partitions.t3 is a table, with two partitions discarded and single partition imported
  #
  CREATE TABLE partitions.t3(c1 INT,c2 INT) PARTITION BY KEY(c1) PARTITIONS 4;
  ALTER TABLE partitions.t3 DISCARD PARTITION p0, p1 TABLESPACE;
  --copy_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak $MYSQLD_DATADIR/partitions/t3#p#p1.cfg
  --copy_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak $MYSQLD_DATADIR/partitions/t3#p#p1.ibd
  ALTER TABLE partitions.t3 IMPORT PARTITION p1 TABLESPACE;


  #
  # Table used to export partitions which are used for imports later in the test
  #
  CREATE TABLE partitions.export2 (c1 INT, c2 INT)
    PARTITION BY RANGE( c2)
    SUBPARTITION BY HASH( c2 )
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (10),
        PARTITION p1 VALUES LESS THAN (20),
        PARTITION p2 VALUES LESS THAN (30),
        PARTITION p3 VALUES LESS THAN MAXVALUE
  );

  FLUSH TABLE partitions.export2 FOR EXPORT;
  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp0.cfg $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp0.ibd $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak

  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp1.cfg $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p0#sp#p0sp1.ibd $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak

  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p1#sp#p1sp0.cfg $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p1#sp#p1sp0.ibd $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak

  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p2#sp#p2sp0.cfg $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak
  --copy_file $MYSQLD_DATADIR/partitions/export2#p#p2#sp#p2sp0.ibd $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak

  UNLOCK TABLES;

  #
  # partitions.t4 is a table with:
  # 1. Partition p0, with two discarded subpartitions
  # 2. Partition p1, with single discarded subpartition
  # 3. Partition p2, with two subpartitions
  # 4. Partition p3, with two subpartitions
  #

  CREATE TABLE partitions.t4 (c1 INT, c2 INT)
    PARTITION BY RANGE( c2 )
    SUBPARTITION BY HASH( c2 )
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (10),
        PARTITION p1 VALUES LESS THAN (20),
        PARTITION p2 VALUES LESS THAN (30),
        PARTITION p3 VALUES LESS THAN MAXVALUE
    );

  ALTER TABLE partitions.t4 DISCARD PARTITION p0sp0 TABLESPACE;
  ALTER TABLE partitions.t4 DISCARD PARTITION p0sp1 TABLESPACE;
  ALTER TABLE partitions.t4 DISCARD PARTITION p1sp0 TABLESPACE;


  #
  # partitions.t5 is a table with:
  # 1. Partition p0, with two discarded subpartitions, two of which are later imported
  # 2. Partition p1, with two discarded subpartitions, one of which is later imported
  # 3. Partition p2, with single discarded subpartition which later is imported
  # 4. Partition p3, with no discarded subpartitions
  #
  CREATE TABLE partitions.t5 (c1 INT, c2 INT)
    PARTITION BY RANGE( c2 )
    SUBPARTITION BY HASH( c2 )
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (10),
        PARTITION p1 VALUES LESS THAN (20),
        PARTITION p2 VALUES LESS THAN (30),
        PARTITION p3 VALUES LESS THAN MAXVALUE
    );

  ALTER TABLE partitions.t5 DISCARD PARTITION p0sp0 TABLESPACE;
  ALTER TABLE partitions.t5 DISCARD PARTITION p0sp1 TABLESPACE;
  ALTER TABLE partitions.t5 DISCARD PARTITION p1sp0 TABLESPACE;
  ALTER TABLE partitions.t5 DISCARD PARTITION p1sp1 TABLESPACE;
  ALTER TABLE partitions.t5 DISCARD PARTITION p2sp0 TABLESPACE;

  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp0.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp0.ibd

  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp1.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p0#sp#p0sp1.ibd

  --copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p1#sp#p1sp0.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p1#sp#p1sp0.ibd

  --copy_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak $MYSQLD_DATADIR/partitions/t5#p#p2#sp#p2sp0.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak $MYSQLD_DATADIR/partitions/t5#p#p2#sp#p2sp0.ibd

  ALTER TABLE partitions.t5 IMPORT PARTITION p0sp0 TABLESPACE;
  ALTER TABLE partitions.t5 IMPORT PARTITION p0sp1 TABLESPACE;
  ALTER TABLE partitions.t5 IMPORT PARTITION p1sp0 TABLESPACE;
  ALTER TABLE partitions.t5 IMPORT PARTITION p2sp0 TABLESPACE;

  #
  # partitions.t6 is a table with:
  # 1. Partition p0 which is discarded with a single query
  # 2. Partition p1 which has single subpartition discarded
  # 3. Partitions p2 and p3 with no discarded subpartitions
  #
  CREATE TABLE partitions.t6 (c1 INT, c2 INT)
    PARTITION BY RANGE( c2 )
    SUBPARTITION BY HASH( c2 )
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (10),
        PARTITION p1 VALUES LESS THAN (20),
        PARTITION p2 VALUES LESS THAN (30),
        PARTITION p3 VALUES LESS THAN MAXVALUE
    );

  ALTER TABLE partitions.t6 DISCARD PARTITION p0 TABLESPACE;
  ALTER TABLE partitions.t6 DISCARD PARTITION p1sp1 TABLESPACE;

  #
  # partitions.t7 is a table with:
  # 1. Partition p0 which is discarded with a single query, which are later imported
  # 2. Partition p1 which has single subpartition discarded which is later imported
  # 3. Partitions p2 and p3 with no discarded subpartitions
  #
  CREATE TABLE partitions.t7 (c1 INT, c2 INT)
    PARTITION BY RANGE( c2 )
    SUBPARTITION BY HASH( c2 )
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (10),
        PARTITION p1 VALUES LESS THAN (20),
        PARTITION p2 VALUES LESS THAN (30),
        PARTITION p3 VALUES LESS THAN MAXVALUE
    );

  ALTER TABLE partitions.t7 DISCARD PARTITION p0 TABLESPACE;
  ALTER TABLE partitions.t7 DISCARD PARTITION p1sp0 TABLESPACE;

  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp0.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp0.ibd

  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp1.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p0#sp#p0sp1.ibd

  --copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak $MYSQLD_DATADIR/partitions/t7#p#p1#sp#p1sp0.cfg
  --copy_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak $MYSQLD_DATADIR/partitions/t7#p#p1#sp#p1sp0.ibd

  ALTER TABLE partitions.t7 IMPORT PARTITION p0sp0 TABLESPACE;
  ALTER TABLE partitions.t7 IMPORT PARTITION p0sp1 TABLESPACE;
  ALTER TABLE partitions.t7 IMPORT PARTITION p1sp0 TABLESPACE;



  --remove_file $MYSQLD_DATADIR/export1#p#p0.cfg_bak
  --remove_file $MYSQLD_DATADIR/export1#p#p0.ibd_bak

  --remove_file $MYSQLD_DATADIR/export1#p#p1.cfg_bak
  --remove_file $MYSQLD_DATADIR/export1#p#p1.ibd_bak

  --remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.cfg_bak
  --remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp0.ibd_bak

  --remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.cfg_bak
  --remove_file $MYSQLD_DATADIR/export2#p#p0#sp#p0sp1.ibd_bak

  --remove_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.cfg_bak
  --remove_file $MYSQLD_DATADIR/export2#p#p1#sp#p1sp0.ibd_bak

  --remove_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.cfg_bak
  --remove_file $MYSQLD_DATADIR/export2#p#p2#sp#p2sp0.ibd_bak

}

if($discarded_partition_option == 'SELECT_TEST')
{

  #
  # partitions.t1
  #

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t1;

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t1 PARTITION (p0);
  SELECT * FROM partitions.t1 PARTITION (p1);
  SELECT * FROM partitions.t1 PARTITION (p2);
  SELECT * FROM partitions.t1 PARTITION (p3);

  #
  # partitions.t2
  #

  SELECT * FROM partitions.t2;

  SELECT * FROM partitions.t2 PARTITION (p0);
  SELECT * FROM partitions.t2 PARTITION (p1);
  SELECT * FROM partitions.t2 PARTITION (p2);
  SELECT * FROM partitions.t2 PARTITION (p3);

  #
  # partitions.t3
  #

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t3;

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t3 PARTITION (p0);
  SELECT * FROM partitions.t3 PARTITION (p1);
  SELECT * FROM partitions.t3 PARTITION (p2);
  SELECT * FROM partitions.t3 PARTITION (p3);

  #
  # partitions.t4
  #

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4;

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4 PARTITION (p0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4 PARTITION (p0sp0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4 PARTITION (p0sp1);

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4 PARTITION (p1);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t4 PARTITION (p1sp0);
  SELECT * FROM partitions.t4 PARTITION (p1sp1);

  SELECT * FROM partitions.t4 PARTITION (p2);
  SELECT * FROM partitions.t4 PARTITION (p2sp0);
  SELECT * FROM partitions.t4 PARTITION (p2sp1);

  #
  # partitions.t5
  #

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t5;

  SELECT * FROM partitions.t5 PARTITION (p0);
  SELECT * FROM partitions.t5 PARTITION (p0sp0);
  SELECT * FROM partitions.t5 PARTITION (p0sp1);

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t5 PARTITION (p1);
  SELECT * FROM partitions.t5 PARTITION (p1sp0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t5 PARTITION (p1sp1);

  SELECT * FROM partitions.t5 PARTITION (p2);
  SELECT * FROM partitions.t5 PARTITION (p2sp0);
  SELECT * FROM partitions.t5 PARTITION (p2sp1);

  #
  # partitions.t6
  #

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6;

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6 PARTITION (p0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6 PARTITION (p0sp0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6 PARTITION (p0sp1);

  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6 PARTITION (p1);
  SELECT * FROM partitions.t6 PARTITION (p1sp0);
  --error ER_TABLESPACE_DISCARDED
  SELECT * FROM partitions.t6 PARTITION (p1sp1);

  SELECT * FROM partitions.t6 PARTITION (p2);
  SELECT * FROM partitions.t6 PARTITION (p2sp0);
  SELECT * FROM partitions.t6 PARTITION (p2sp1);

  #
  # partitions.t7
  #

  SELECT * FROM partitions.t7;

  SELECT * FROM partitions.t7 PARTITION (p0);
  SELECT * FROM partitions.t7 PARTITION (p0sp0);
  SELECT * FROM partitions.t7 PARTITION (p0sp1);

  SELECT * FROM partitions.t7 PARTITION (p1);
  SELECT * FROM partitions.t7 PARTITION (p1sp0);
  SELECT * FROM partitions.t7 PARTITION (p1sp1);

  SELECT * FROM partitions.t7 PARTITION (p2);
  SELECT * FROM partitions.t7 PARTITION (p2sp0);
  SELECT * FROM partitions.t7 PARTITION (p2sp1);
}

if($discarded_partition_option == 'REBUILD_PARTITION_TEST')
{
  # Currently we turned off rebuilding partitions which are discarded, because
  # it results in some locks left (if we quit mysqld without droping Tables)
  #
  #  Once that's fixed, uncomment rebuilding of discarded partitions

  #
  #  partitions.t1
  #

  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t1 REBUILD PARTITION p0;
  ALTER TABLE partitions.t1 REBUILD PARTITION p1;
  ALTER TABLE partitions.t1 REBUILD PARTITION p2;
  ALTER TABLE partitions.t1 REBUILD PARTITION p3;

  #
  #  partitions.t2
  #

  ALTER TABLE partitions.t2 REBUILD PARTITION p0;
  ALTER TABLE partitions.t2 REBUILD PARTITION p1;
  ALTER TABLE partitions.t2 REBUILD PARTITION p2;
  ALTER TABLE partitions.t2 REBUILD PARTITION p3;

  #
  #  partitions.t3
  #

  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t3 REBUILD PARTITION p0;
  ALTER TABLE partitions.t3 REBUILD PARTITION p1;
  ALTER TABLE partitions.t3 REBUILD PARTITION p2;
  ALTER TABLE partitions.t3 REBUILD PARTITION p3;

  #
  #  partitions.t4
  #

  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t4 REBUILD PARTITION p0;
  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t4 REBUILD PARTITION p1;
  ALTER TABLE partitions.t4 REBUILD PARTITION p2;


  #
  #  partitions.t5
  #

  ALTER TABLE partitions.t5 REBUILD PARTITION p0;
  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t5 REBUILD PARTITION p1;
  ALTER TABLE partitions.t5 REBUILD PARTITION p2;


  #
  #  partitions.t6
  #

  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t6 REBUILD PARTITION p0;
  --error ER_TABLESPACE_DISCARDED
  ALTER TABLE partitions.t6 REBUILD PARTITION p1;
  ALTER TABLE partitions.t6 REBUILD PARTITION p2;


  #
  #  partitions.t7
  #

  ALTER TABLE partitions.t7 REBUILD PARTITION p0;
  ALTER TABLE partitions.t7 REBUILD PARTITION p1;
  ALTER TABLE partitions.t7 REBUILD PARTITION p2;
}

if($discarded_partition_option == 'SECONDARY_INDEX_TEST')
{
  CREATE INDEX secondary ON partitions.t1 (c2);
  CREATE INDEX secondary ON partitions.t2 (c2);
  CREATE INDEX secondary ON partitions.t3 (c2);
  CREATE INDEX secondary ON partitions.t4 (c2);
  CREATE INDEX secondary ON partitions.t5 (c2);
  CREATE INDEX secondary ON partitions.t6 (c2);
  CREATE INDEX secondary ON partitions.t7 (c2);

  DROP INDEX secondary ON partitions.t1;
  DROP INDEX secondary ON partitions.t2;
  DROP INDEX secondary ON partitions.t3;
  DROP INDEX secondary ON partitions.t4;
  DROP INDEX secondary ON partitions.t5;
  DROP INDEX secondary ON partitions.t6;
  DROP INDEX secondary ON partitions.t7;
}

if($discarded_partition_option == 'DROP_TEST')
{
  # Dropping table with discarded partition should succeed and clean up all files for given Tables
  # TODO describe more
  DROP TABLE partitions.t1;
  DROP TABLE partitions.t2;
  DROP TABLE partitions.t3;
  DROP TABLE partitions.t4;
  DROP TABLE partitions.t5;
  DROP TABLE partitions.t6;
  DROP TABLE partitions.t7;

  DROP DATABASE partitions;
}

if($discarded_partition_option == 'PREPARE_FROM_8020')
{
  --source include/shutdown_mysqld.inc

  --copy_file $MYSQLTEST_VARDIR/std_data/upgrade/discarded_partition_data_8020.zip $MYSQL_TMP_DIR/discarded_partition_data_8020.zip
  --file_exists $MYSQL_TMP_DIR/discarded_partition_data_8020.zip
  --exec unzip -qo $MYSQL_TMP_DIR/discarded_partition_data_8020.zip -d $MYSQL_TMP_DIR

  let $BUGDATADIR = $MYSQL_TMP_DIR/data_upgrade;

  --replace_result $BUGDATADIR BUGDATADIR
  --let $restart_parameters = restart: --datadir=$BUGDATADIR
  --let $WAIT_COUNTER=3000 #TODO why?

  --source include/start_mysqld.inc
}

if($discarded_partition_option == 'CLEANUP_FROM_8020')
{
  --source include/shutdown_mysqld.inc

  --file_exists $MYSQL_TMP_DIR/discarded_partition_data_8020.zip
  --force-rmdir $MYSQL_TMP_DIR/data_upgrade
  --remove_file $MYSQL_TMP_DIR/discarded_partition_data_8020.zip

  let $restart_parameters =;
  --source include/start_mysqld.inc
}