Debian Codegraph @

mysql-test/suite/innodb/include/log_pre_8_0_30_case6.inc

raw
1
2 # According to perl's documentation, 'Q' in (un)pack() is supported only if perl
3 # has been compiled with support for 64bit integers.
4 --source include/have_perl_64bit_int.inc
5
6 --source log_pre_8_0_30_case_begin.inc
7
8 --echo ############################################################################################
9 --echo # Case 6: Attempt to start on redo files with corrupted checkpoint header.
10 --echo # 6A: InnoDB refuses to start if both checkpoint headers are corrupted.
11 --echo # 6B: InnoDB successfully starts if one of checkpoint headers (older) is corrupted.
12 --echo ############################################################################################
13
14 --echo # Save the ib_logfile0...
15 --copy_file $IB_LOGFILE0_PATH $MYSQLD_DATADIR/tmp_ib_logfile0
16
17 perl;
18 open my $fh, '+<:raw', $ENV{IB_LOGFILE0_PATH} or die "open failed: $!\n";
19 seek $fh, 512 + 8, 0;
20 syswrite($fh, 'xxxxxxxx', 8) > 0 or die "write failed: $!\n";
21 seek $fh, 3*512 + 8, 0;
22 syswrite($fh, 'xxxxxxxx', 8) > 0 or die "write failed: $!\n";
23 close $fh or die "close failed: $!\n";
24 EOF
25
26 let $i = 1;
27 while ($i <= 2) {
28 --remove_file $SEARCH_FILE
29
30 --echo # Case 6A: Start MySQL... (attempt $i)
31 --error 1,42
32 --exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM
33
34 --echo # Verify...
35
36 let SEARCH_PATTERN = Upgrading redo log: .*, LSN=;
37 # Expected: not found
38 --source include/search_pattern.inc
39
40 let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM;
41 # Expected: not found
42 --source include/search_pattern.inc
43
44 inc $i;
45 }
46
47 --echo # Restore the saved ib_logfile0...
48 --remove_file $IB_LOGFILE0_PATH
49 --move_file $MYSQLD_DATADIR/tmp_ib_logfile0 $IB_LOGFILE0_PATH
50
51 --echo ############################################################################################
52
53 --echo # Corrupt one of checkpoint headers (with older checkpoint_lsn)...
54 perl;
55 open my $fh, '+<:raw', $ENV{IB_LOGFILE0_PATH} or die "open failed: $!\n";
56 my $offset1 = 512 + 8;
57 my $offset2 = 3*512 + 8;
58 seek $fh, $offset1, 0;
59 read $fh, my $packed_checkpoint_lsn1, 8 or die "read failed: $!\n";
60 seek $fh, $offset2, 0;
61 read $fh, my $packed_checkpoint_lsn2, 8 or die "read failed: $!\n";
62 my $checkpoint_lsn1 = unpack('Q>', $packed_checkpoint_lsn1);
63 my $checkpoint_lsn2 = unpack('Q>', $packed_checkpoint_lsn2);
64 my $offset = 0;
65 if ($checkpoint_lsn1 <= $checkpoint_lsn2) {
66 $offset = $offset1;
67 } else {
68 $offset = $offset2;
69 }
70 seek $fh, $offset, 0;
71 syswrite($fh, 'xxxxxxxx', 8) == 8 or die "write failed: $!\n";
72 close $fh or die "close failed: $!\n";
73 EOF
74
75 let $i = 1;
76 while ($i <= 2) {
77 --remove_file $SEARCH_FILE
78
79 --echo # Case 6B: Start MySQL... (attempt $i)
80 --error 1,42
81 --exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM
82
83 --echo # Verify...
84
85 let SEARCH_PATTERN = Upgrading redo log: .*, LSN=;
86 # Expected: found iff $i == 1
87 --source include/search_pattern.inc
88
89 let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM;
90 # Expected: found
91 --source include/search_pattern.inc
92
93 inc $i;
94 }
95
96 --echo ############################################################################################
97 --source log_pre_8_0_30_case_end.inc