| 1 |
# test the auto-recover (--myisam-recover) of partitioned myisam tables |
| 2 |
|
| 3 |
call mtr.add_suppression("..test.t1_will_crash"); |
| 4 |
call mtr.add_suppression("Got an error from unknown thread"); |
| 5 |
call mtr.add_suppression("Table 't1_will_crash' is marked as crashed and should be repaired"); |
| 6 |
|
| 7 |
--source include/have_partition.inc |
| 8 |
|
| 9 |
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; |
| 10 |
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); |
| 11 |
FLUSH TABLES; |
| 12 |
|
| 13 |
--echo # replacing t1.MYI with a corrupt + unclosed one created by doing: |
| 14 |
--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI |
| 15 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 16 |
--remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI |
| 17 |
--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI |
| 18 |
--enable_prepare_warnings |
| 19 |
# Embedded server doesn't chdir to data directory |
| 20 |
--replace_regex /Table '.*t1_will_crash/Table 't1_will_crash/ |
| 21 |
--enable_prepare_warnings |
| 22 |
SELECT * FROM t1_will_crash; |
| 23 |
--disable_prepare_warnings |
| 24 |
DROP TABLE t1_will_crash; |
| 25 |
CREATE TABLE t1_will_crash (a INT, KEY (a)) |
| 26 |
ENGINE=MyISAM |
| 27 |
PARTITION BY HASH(a) |
| 28 |
PARTITIONS 3; |
| 29 |
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); |
| 30 |
FLUSH TABLES; |
| 31 |
--echo # replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing: |
| 32 |
--echo # 'create table t1 (a int key(a)) partition by hash (a) partitions 3' |
| 33 |
--echo # head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI |
| 34 |
--remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI |
| 35 |
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI |
| 36 |
--enable_prepare_warnings |
| 37 |
# Embedded server doesn't chdir to data directory |
| 38 |
--replace_regex /Table '.*t1_will_crash/Table 't1_will_crash/ |
| 39 |
--enable_prepare_warnings |
| 40 |
SELECT * FROM t1_will_crash; |
| 41 |
--disable_prepare_warnings |
| 42 |
DROP TABLE t1_will_crash; |