| 1 |
# According to perl's documentation, 'Q' in (un)pack() is supported only if perl |
| 2 |
# has been compiled with support for 64bit integers. |
| 3 |
--source include/have_perl_64bit_int.inc |
| 4 |
|
| 5 |
--source log_pre_8_0_30_case_begin.inc |
| 6 |
|
| 7 |
--echo ############################################################################################ |
| 8 |
--echo # Case 7: Attempt to start on non-empty redo files. |
| 9 |
--echo # 7A: InnoDB refuses to start on logically non-empty redo log. |
| 10 |
--echo # 7B: InnoDB refuses to start when the first log block is corrupted (invalid checksum). |
| 11 |
--echo ############################################################################################ |
| 12 |
|
| 13 |
--echo # Update data_len field to 512 in the data block containing the checkpoint_lsn... |
| 14 |
perl; |
| 15 |
# Find the oldest checkpoint lsn and related offset: |
| 16 |
open my $fh, '+<:raw', $ENV{IB_LOGFILE0_PATH} or die "open failed: $!\n"; |
| 17 |
my $offset1 = 512 + 8; |
| 18 |
my $offset2 = 3*512 + 8; |
| 19 |
seek $fh, $offset1, 0; |
| 20 |
read $fh, my $packed_checkpoint_lsn1, 8 or die "read failed: $!\n"; |
| 21 |
seek $fh, $offset2, 0; |
| 22 |
read $fh, my $packed_checkpoint_lsn2, 8 or die "read failed: $!\n"; |
| 23 |
my $checkpoint_lsn1 = unpack('Q>', $packed_checkpoint_lsn1); |
| 24 |
my $checkpoint_lsn2 = unpack('Q>', $packed_checkpoint_lsn2); |
| 25 |
my $offset = 0; |
| 26 |
if ($checkpoint_lsn1 <= $checkpoint_lsn2) { |
| 27 |
$offset = $offset1; |
| 28 |
} else { |
| 29 |
$offset = $offset2; |
| 30 |
} |
| 31 |
$offset += 8; |
| 32 |
seek $fh, $offset, 0; |
| 33 |
read $fh, my $packed_checkpoint_offset, 8 or die "read failed: $!\n"; |
| 34 |
my $checkpoint_offset = unpack('Q>', $packed_checkpoint_offset); |
| 35 |
close $fh or die "close failed: $!\n"; |
| 36 |
|
| 37 |
# Compute file and block pointed by the checkpoint offset: |
| 38 |
my $file_size = -s $ENV{IB_LOGFILE0_PATH}; |
| 39 |
my $nth_file = $checkpoint_offset / $file_size % 2; |
| 40 |
my $file_path = ''; |
| 41 |
if ($nth_file == 0) { |
| 42 |
$file_path = $ENV{IB_LOGFILE0_PATH}; |
| 43 |
} else { |
| 44 |
$file_path = $ENV{IB_LOGFILE1_PATH}; |
| 45 |
} |
| 46 |
my $file_offset = $checkpoint_offset % $file_size; |
| 47 |
my $block_offset = int($file_offset / 512) * 512; |
| 48 |
|
| 49 |
# Open the pointed file and update the data_len field: |
| 50 |
open $fh, '+<:raw', $file_path or die "open failed: $!\n"; |
| 51 |
seek $fh, $block_offset + 4, 0; |
| 52 |
syswrite($fh, pack('S>', 512), 2) == 2 or die "write failed: $!\n"; |
| 53 |
close $fh or die "close failed: $!\n"; |
| 54 |
EOF |
| 55 |
|
| 56 |
let $i = 1; |
| 57 |
while ($i <= 2) { |
| 58 |
--remove_file $SEARCH_FILE |
| 59 |
|
| 60 |
--echo # Case 7A: Start MySQL... (attempt $i) |
| 61 |
--error 1,42 |
| 62 |
--exec $MYSQLD_CMD $MYSQLD_ARGS --innodb-log-checksums=OFF --$UNKNOWN_PARAM |
| 63 |
|
| 64 |
--echo # Verify... |
| 65 |
|
| 66 |
let SEARCH_PATTERN = Upgrade is not supported after a crash or shutdown with innodb_fast_shutdown = 2.* appears logically non empty; |
| 67 |
# Expected: found |
| 68 |
--source include/search_pattern.inc |
| 69 |
|
| 70 |
let SEARCH_PATTERN = Upgrading redo log: .*, LSN=; |
| 71 |
# Expected: not found |
| 72 |
--source include/search_pattern.inc |
| 73 |
|
| 74 |
let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM; |
| 75 |
# Expected: not found |
| 76 |
--source include/search_pattern.inc |
| 77 |
|
| 78 |
inc $i; |
| 79 |
} |
| 80 |
|
| 81 |
--echo ############################################################################################ |
| 82 |
|
| 83 |
let $i = 1; |
| 84 |
while ($i <= 2) { |
| 85 |
--remove_file $SEARCH_FILE |
| 86 |
|
| 87 |
--echo # Case 7B: Start MySQL... (attempt $i) |
| 88 |
--error 1,42 |
| 89 |
--exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM |
| 90 |
|
| 91 |
--echo # Verify... |
| 92 |
|
| 93 |
let SEARCH_PATTERN = Upgrade after a crash is not supported.* appears corrupted; |
| 94 |
# Expected: found |
| 95 |
--source include/search_pattern.inc |
| 96 |
|
| 97 |
let SEARCH_PATTERN = Upgrading redo log: .*, LSN=; |
| 98 |
# Expected: not found |
| 99 |
--source include/search_pattern.inc |
| 100 |
|
| 101 |
let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM; |
| 102 |
# Expected: not found |
| 103 |
--source include/search_pattern.inc |
| 104 |
|
| 105 |
inc $i; |
| 106 |
} |
| 107 |
|
| 108 |
--echo ############################################################################################ |
| 109 |
--source log_pre_8_0_30_case_end.inc |