summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
blob: f3eb9d830592488e1f545f38d85dfc3c22369c2c (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
--source include/have_innodb.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\\]");
--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");

--source include/restart_mysqld.inc

SELECT COUNT(*) FROM t1;

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

--source include/kill_mysqld.inc
--echo # Corrupt the pages

perl;
my $ps = $ENV{INNODB_PAGE_SIZE};

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, SEEK_SET) or die "seek";
print FILE "junk";
close FILE or die "close";
EOF

let $restart_paramters=--innodb_force_recovery=1;
--source include/start_mysqld.inc

SELECT * FROM t1 WHERE PK = 1;

--error ER_GET_ERRMSG
SELECT * FROM t1 WHERE pk = 12;

DROP TABLE t1;