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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
# According to perl's documentation, 'Q' in (un)pack() is supported only if perl
# has been compiled with support for 64bit integers.
--source include/have_perl_64bit_int.inc
--source log_pre_8_0_30_case_begin.inc
--echo ############################################################################################
--echo # Case 6: Attempt to start on redo files with corrupted checkpoint header.
--echo # 6A: InnoDB refuses to start if both checkpoint headers are corrupted.
--echo # 6B: InnoDB successfully starts if one of checkpoint headers (older) is corrupted.
--echo ############################################################################################
--echo # Save the ib_logfile0...
--copy_file $IB_LOGFILE0_PATH $MYSQLD_DATADIR/tmp_ib_logfile0
perl;
open my $fh, '+<:raw', $ENV{IB_LOGFILE0_PATH} or die "open failed: $!\n";
seek $fh, 512 + 8, 0;
syswrite($fh, 'xxxxxxxx', 8) > 0 or die "write failed: $!\n";
seek $fh, 3*512 + 8, 0;
syswrite($fh, 'xxxxxxxx', 8) > 0 or die "write failed: $!\n";
close $fh or die "close failed: $!\n";
EOF
let $i = 1;
while ($i <= 2) {
--remove_file $SEARCH_FILE
--echo # Case 6A: Start MySQL... (attempt $i)
--error 1,42
--exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM
--echo # Verify...
let SEARCH_PATTERN = Upgrading redo log: .*, LSN=;
# Expected: not found
--source include/search_pattern.inc
let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM;
# Expected: not found
--source include/search_pattern.inc
inc $i;
}
--echo # Restore the saved ib_logfile0...
--remove_file $IB_LOGFILE0_PATH
--move_file $MYSQLD_DATADIR/tmp_ib_logfile0 $IB_LOGFILE0_PATH
--echo ############################################################################################
--echo # Corrupt one of checkpoint headers (with older checkpoint_lsn)...
perl;
open my $fh, '+<:raw', $ENV{IB_LOGFILE0_PATH} or die "open failed: $!\n";
my $offset1 = 512 + 8;
my $offset2 = 3*512 + 8;
seek $fh, $offset1, 0;
read $fh, my $packed_checkpoint_lsn1, 8 or die "read failed: $!\n";
seek $fh, $offset2, 0;
read $fh, my $packed_checkpoint_lsn2, 8 or die "read failed: $!\n";
my $checkpoint_lsn1 = unpack('Q>', $packed_checkpoint_lsn1);
my $checkpoint_lsn2 = unpack('Q>', $packed_checkpoint_lsn2);
my $offset = 0;
if ($checkpoint_lsn1 <= $checkpoint_lsn2) {
$offset = $offset1;
} else {
$offset = $offset2;
}
seek $fh, $offset, 0;
syswrite($fh, 'xxxxxxxx', 8) == 8 or die "write failed: $!\n";
close $fh or die "close failed: $!\n";
EOF
let $i = 1;
while ($i <= 2) {
--remove_file $SEARCH_FILE
--echo # Case 6B: Start MySQL... (attempt $i)
--error 1,42
--exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM
--echo # Verify...
let SEARCH_PATTERN = Upgrading redo log: .*, LSN=;
# Expected: found iff $i == 1
--source include/search_pattern.inc
let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM;
# Expected: found
--source include/search_pattern.inc
inc $i;
}
--echo ############################################################################################
--source log_pre_8_0_30_case_end.inc
|