1--source include/have_innodb.inc
2--source include/have_innodb_16k.inc
3
4let newdir= $MYSQLTEST_VARDIR/tmp/log_corruption;
5--mkdir $newdir
6let SEARCH_FILE = $newdir/my_restart.err;
7let $args=--no-defaults --datadir=$newdir --secure-file-priv="" --loose-skip-sha256-password-auto-generate-rsa-keys --loose-console > $SEARCH_FILE 2>&1 ;
8
9--echo # redo log from before MySQL 5.7.9
10--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption.zip -d $newdir > $SEARCH_FILE
11--error 1
12--exec $MYSQLD $args
13let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9\\.;
14--source include/search_pattern_in_file.inc
15
16--echo # redo log from before MySQL 5.7.9, with corrupted log checkpoint
17--remove_file $newdir/ib_logfile0
18--copy_file $newdir/ib_logfile1  $newdir/ib_logfile0
19--error 1
20--exec $MYSQLD $args
21let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and we did not find a valid checkpoint;
22--source include/search_pattern_in_file.inc
23
24--echo # redo log from before MySQL 5.7.9, with corrupted log block
25--remove_file $newdir/ib_logfile0
26--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption0.zip -d $newdir > $SEARCH_FILE
27--error 1
28--exec $MYSQLD $args
29let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and it appears corrupted;
30--source include/search_pattern_in_file.inc
31
32--echo # redo log from "after" MySQL 5.7.9, but with invalid header checksum
33--remove_file $newdir/ib_logfile0
34--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption1.zip -d $newdir > $SEARCH_FILE
35--error 1
36--exec $MYSQLD $args
37let SEARCH_PATTERN=InnoDB: Invalid redo log header checksum;
38--source include/search_pattern_in_file.inc
39
40--echo # distant future redo log format, with valid header checksum
41--remove_file $newdir/ib_logfile0
42--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption2.zip -d $newdir > $SEARCH_FILE
43--error 1
44--exec $MYSQLD $args
45let SEARCH_PATTERN=InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading-downgrading.html;
46--source include/search_pattern_in_file.inc
47
48--echo # valid header, but old-format checkpoint blocks
49--remove_file $newdir/ib_logfile0
50--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption3.zip -d $newdir > $SEARCH_FILE
51--error 1
52--exec $MYSQLD $args
53let SEARCH_PATTERN=InnoDB: No valid checkpoint found .corrupted redo log;
54--source include/search_pattern_in_file.inc
55
56--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum
57--remove_file $newdir/ib_logfile0
58--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption4.zip -d $newdir > $SEARCH_FILE
59# Anything below innodb_force_recovery=6 must find a valid redo log.
60# Missing tablespace files are tolerated already with innodb_force_recovery=1.
61--error 1
62--exec $MYSQLD $args --innodb-force-recovery=5
63let SEARCH_PATTERN=InnoDB: Log block 2372 at lsn 1213952 has valid header, but checksum field contains 144444122, should be 3362026715;
64--source include/search_pattern_in_file.inc
65let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.;
66--source include/search_pattern_in_file.inc
67let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed;
68--source include/search_pattern_in_file.inc
69--echo # --innodb-force-recovery=6 (skip the entire redo log)
70--error 1
71--exec $MYSQLD $args --innodb-force-recovery=6
72let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode;
73--source include/search_pattern_in_file.inc
74
75--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number
76--remove_file $newdir/ib_logfile0
77--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption4a.zip -d $newdir > $SEARCH_FILE
78# Anything below innodb_force_recovery=6 must find a valid redo log.
79# Missing tablespace files are tolerated already with innodb_force_recovery=1.
80--error 1
81--exec $MYSQLD $args --innodb-force-recovery=5
82let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.;
83--source include/search_pattern_in_file.inc
84let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed;
85--source include/search_pattern_in_file.inc
86
87--echo # --innodb-force-recovery=6 (skip the entire redo log)
88--error 1
89--exec $MYSQLD $args --innodb-force-recovery=6
90let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode;
91--source include/search_pattern_in_file.inc
92
93--echo # Test a corrupted MLOG_FILE_NAME record.
94--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2
95--remove_file $newdir/ib_logfile0
96--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption5.zip -d $newdir > $SEARCH_FILE
97--error 1
98--exec $MYSQLD $args
99let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964;
100--source include/search_pattern_in_file.inc
101let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################;
102--source include/search_pattern_in_file.inc
103let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0;
104--source include/search_pattern_in_file.inc
105let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8               bogus ;
106--source include/search_pattern_in_file.inc
107let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error;
108--source include/search_pattern_in_file.inc
109
110--echo # Test a corrupted MLOG_FILE_NAME record.
111--echo # valid header, invalid checkpoint 1, valid checkpoint 2
112--remove_file $newdir/ib_logfile0
113--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption6.zip -d $newdir > $SEARCH_FILE
114--error 1
115--exec $MYSQLD $args
116let SEARCH_PATTERN=InnoDB: The log file was created by mysqlbackup --apply-log at ibbackup was here!!!1!\. The following crash recovery is part of a normal restore\.;
117--source include/search_pattern_in_file.inc
118let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################;
119--source include/search_pattern_in_file.inc
120let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0;
121--source include/search_pattern_in_file.inc
122let SEARCH_PATTERN=InnoDB: Hex dump starting 0 bytes before and ending 13 bytes after the corrupted record;
123--source include/search_pattern_in_file.inc
124let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8               bogus ;
125--source include/search_pattern_in_file.inc
126let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error;
127--source include/search_pattern_in_file.inc
128
129--remove_file $SEARCH_FILE
130--remove_file $newdir/ibdata1
131--remove_file $newdir/ib_logfile0
132--remove_file $newdir/ib_logfile1
133--rmdir $newdir
134