summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
blob: bd8784236b6d3ad27ec48b737a5c054e13673f7d (plain)
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
--source include/have_innodb.inc
--source include/have_debug.inc

--disable_query_log
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page ");
call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=19\\]");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to read file '.*test.t1\\.ibd' at offset 19: Page read from tablespace is corrupted\\.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at srv0start\\.cc.* with error Data structure corruption");
call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)");
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("\\[ERROR\\] mysqld.*: Index for table 't1' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB:  Error code: [0-9][0-9][0-9]* btr_pcur_open_low  level: 0 called from file: ");
--enable_query_log
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0;

SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG = 2;

INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'),
	(4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'),
	(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'),
	(12, 'test8');

let $restart_noprint=2;
--source include/restart_mysqld.inc

let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;

SELECT COUNT(*) FROM t1;
--source ../include/no_checkpoint_start.inc
UPDATE t1 SET c='best8' WHERE pk=12;

--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
--source ../include/no_checkpoint_end.inc
--echo # Corrupt the pages

perl;
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
seek (FILE, $ENV{INNODB_PAGE_SIZE} * 19 + 38, SEEK_SET) or die "seek";
print FILE "junk";
close FILE or die "close";
EOF

--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1 WHERE PK = 1;

let $restart_parameters=--innodb-force-recovery=1;
--source include/restart_mysqld.inc
SELECT * FROM t1 WHERE PK = 1;
--error ER_NOT_KEYFILE
SELECT * FROM t1 WHERE pk = 12;

DROP TABLE t1;
let $restart_parameters=;
--source include/restart_mysqld.inc