| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
|
| 4 |
--disable_query_log |
| 5 |
call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to read page 19 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted\\."); |
| 6 |
call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page 19 in file .*t1\\.ibd"); |
| 7 |
call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at srv0start\\.cc.* with error Data structure corruption"); |
| 8 |
call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)"); |
| 9 |
call mtr.add_suppression("Fewer engines are enabled now than were before the crash"); |
| 10 |
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption"); |
| 11 |
call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't1' is corrupt; try to repair it"); |
| 12 |
call mtr.add_suppression("InnoDB: btr_pcur_open_low level: 0 table: `test`\\.`t1` index: `PRIMARY`"); |
| 13 |
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); |
| 14 |
call mtr.add_suppression("InnoDB: In page .* of index `PRIMARY` of table `test`\\.`t1`"); |
| 15 |
--enable_query_log |
| 16 |
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0; |
| 17 |
|
| 18 |
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG = 2; |
| 19 |
|
| 20 |
INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'), |
| 21 |
(4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'), |
| 22 |
(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'), |
| 23 |
(12, 'test8'); |
| 24 |
|
| 25 |
let $restart_noprint=2; |
| 26 |
--source include/restart_mysqld.inc |
| 27 |
|
| 28 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 29 |
let MYSQLD_DATADIR=`select @@datadir`; |
| 30 |
|
| 31 |
SELECT COUNT(*) FROM t1; |
| 32 |
--source ../include/no_checkpoint_start.inc |
| 33 |
UPDATE t1 SET c='best8' WHERE pk=12; |
| 34 |
|
| 35 |
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; |
| 36 |
--source ../include/no_checkpoint_end.inc |
| 37 |
--echo # Corrupt the pages |
| 38 |
|
| 39 |
perl; |
| 40 |
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; |
| 41 |
open(FILE, "+<$file") || die "Unable to open $file"; |
| 42 |
binmode FILE; |
| 43 |
seek (FILE, $ENV{INNODB_PAGE_SIZE} * 19 + 38, SEEK_SET) or die "seek"; |
| 44 |
print FILE "junk"; |
| 45 |
close FILE or die "close"; |
| 46 |
EOF |
| 47 |
|
| 48 |
--source include/start_mysqld.inc |
| 49 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 50 |
SELECT * FROM t1 WHERE PK = 1; |
| 51 |
|
| 52 |
# Force recovery to ignore the corrupted page. |
| 53 |
let $restart_parameters=--innodb-force-recovery=1; |
| 54 |
--source include/restart_mysqld.inc |
| 55 |
SELECT * FROM t1 WHERE PK = 1; |
| 56 |
--error ER_NOT_KEYFILE |
| 57 |
SELECT * FROM t1 WHERE pk = 12; |
| 58 |
CHECK TABLE t1; |
| 59 |
|
| 60 |
DROP TABLE t1; |