summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.test2
-rw-r--r--mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result20
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.opt3
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt2
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test50
5 files changed, 75 insertions, 2 deletions
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
index 1ca3419820b..94fcd5f382d 100644
--- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
@@ -54,7 +54,7 @@ SELECT * FROM t1;
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[1].ibd looks corrupted; key_version=1786080875");
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted. Please drop the table and recreate.");
--enable_query_log
-let $restart_parameters=--innodb_force_recovery=1;
+let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE
diff --git a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
new file mode 100644
index 00000000000..e0e920ef64e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
@@ -0,0 +1,20 @@
+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');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+12
+UPDATE t1 SET c='best8' WHERE pk=12;
+# Kill the server
+# Corrupt the pages
+SELECT * FROM t1 WHERE PK = 1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1 WHERE PK = 1;
+pk c
+1 sql
+SELECT * FROM t1 WHERE pk = 12;
+ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.opt b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
index 6051f4cd1fa..ba4fa744d8f 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
@@ -1 +1,2 @@
---innodb_doublewrite=0
+--skip-innodb-doublewrite
+--skip-innodb-buffer-pool-load-at-startup
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt
new file mode 100644
index 00000000000..ba4fa744d8f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt
@@ -0,0 +1,2 @@
+--skip-innodb-doublewrite
+--skip-innodb-buffer-pool-load-at-startup
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
new file mode 100644
index 00000000000..747077ef02f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
@@ -0,0 +1,50 @@
+--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)");
+--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;
+UPDATE t1 SET c='best8' WHERE pk=12;
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+
+--source include/kill_mysqld.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, 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_GET_ERRMSG
+SELECT * FROM t1 WHERE pk = 12;
+
+DROP TABLE t1;