EVOLUTION-MANAGER
Edit File: corrupted_during_recovery.test
--source include/have_innodb.inc --disable_query_log call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); 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: Failed to read file '.*test.t1\\.ibd' at offset 3: Page read from tablespace is corrupted."); --enable_query_log let INNODB_PAGE_SIZE=`select @@innodb_page_size`; CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); # Force a redo log checkpoint. --source include/restart_mysqld.inc --source ../include/no_checkpoint_start.inc CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(2); SET GLOBAL innodb_flush_log_at_trx_commit=1; INSERT INTO t2 VALUES(1); --let CLEANUP_IF_CHECKPOINT=DROP TABLE t1,t2; --source ../include/no_checkpoint_end.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; sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; # Replace the a=1 with a=0. $page =~ s/\x80\x0\x0\x0\x0\x0\x0\x1/\x80\x0\x0\x0\x0\x0\x0\x0/; sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; close FILE or die "close"; $file = "$ENV{MYSQLD_DATADIR}/test/t2.ibd"; open(FILE, "+<$file") || die "Unable to open $file"; binmode FILE; # Corrupt pages 1 to 3. MLOG_INIT_FILE_PAGE2 should protect us! # Unfortunately, we are not immune to page 0 corruption. seek (FILE, $ps, SEEK_SET) or die "seek"; print FILE chr(0xff) x ($ps * 3); close FILE or die "close"; EOF --source include/start_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; let $restart_parameters=--innodb_force_recovery=1; --source include/restart_mysqld.inc SELECT * FROM t1; SELECT * FROM t2; CHECK TABLE t1,t2; DROP TABLE t1, t2;