| 1 |
# |
| 2 |
# REPAIR TABLE for partitioned tables and REPAIR PARTITION |
| 3 |
# |
| 4 |
|
| 5 |
--source include/have_partition.inc |
| 6 |
--source ../have_engine.inc |
| 7 |
|
| 8 |
call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired"); |
| 9 |
|
| 10 |
--disable_warnings |
| 11 |
DROP TABLE IF EXISTS t1, t2; |
| 12 |
--enable_warnings |
| 13 |
|
| 14 |
let $partition_options = PARTITION BY HASH(a) PARTITIONS 2; |
| 15 |
--source ../create_table.inc |
| 16 |
if ($mysql_errname) |
| 17 |
{ |
| 18 |
--let $my_last_stmt = $create_statement |
| 19 |
--let $functionality = Partitions |
| 20 |
--source ../unexpected_result.inc |
| 21 |
} |
| 22 |
if (!$mysql_errname) |
| 23 |
{ |
| 24 |
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g'); |
| 25 |
|
| 26 |
let $table_name = t2; |
| 27 |
let $partition_options = PARTITION BY RANGE(a) ( |
| 28 |
PARTITION p0 VALUES LESS THAN (100), |
| 29 |
PARTITION p1 VALUES LESS THAN MAXVALUE |
| 30 |
); |
| 31 |
--source ../create_table.inc |
| 32 |
|
| 33 |
INSERT INTO t2 (a,b) SELECT a, b FROM t1; |
| 34 |
|
| 35 |
let $alter_definition = REPAIR PARTITION p0; |
| 36 |
--source ../alter_table.inc |
| 37 |
|
| 38 |
INSERT INTO t1 (a,b) VALUES (3,'c'); |
| 39 |
|
| 40 |
let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; |
| 41 |
--source ../alter_table.inc |
| 42 |
if ($mysql_errname) |
| 43 |
{ |
| 44 |
--let $my_last_stmt = $alter_statement |
| 45 |
--let $functionality = ALTER TABLE |
| 46 |
--source ../unexpected_result.inc |
| 47 |
} |
| 48 |
|
| 49 |
INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); |
| 50 |
|
| 51 |
let $table_name = t2; |
| 52 |
let $alter_definition = REPAIR PARTITION LOCAL p1; |
| 53 |
--source ../alter_table.inc |
| 54 |
|
| 55 |
INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); |
| 56 |
|
| 57 |
let $alter_definition = REPAIR PARTITION LOCAL ALL EXTENDED; |
| 58 |
--source ../alter_table.inc |
| 59 |
|
| 60 |
INSERT INTO t1 (a,b) VALUES (10,'j'); |
| 61 |
|
| 62 |
let $alter_definition = REPAIR PARTITION p1 QUICK USE_FRM; |
| 63 |
--source ../alter_table.inc |
| 64 |
|
| 65 |
INSERT INTO t2 (a,b) VALUES (12,'l'); |
| 66 |
|
| 67 |
let $table_name = t2; |
| 68 |
let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM; |
| 69 |
--source ../alter_table.inc |
| 70 |
|
| 71 |
DROP TABLE t1, t2; |
| 72 |
} |
| 73 |
|
| 74 |
let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2; |
| 75 |
--source ../repair_table.inc |
| 76 |
|
| 77 |
--source ../cleanup_engine.inc |
| 78 |
|