| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_innodb_16k.inc |
| 3 |
--source include/no_valgrind_without_big.inc |
| 4 |
|
| 5 |
--disable_query_log |
| 6 |
call mtr.add_suppression("InnoDB: Upgrade after a crash is not supported"); |
| 7 |
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); |
| 8 |
call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); |
| 9 |
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); |
| 10 |
call mtr.add_suppression("InnoDB: Unsupported redo log format"); |
| 11 |
call mtr.add_suppression("InnoDB: No valid checkpoint was found"); |
| 12 |
call mtr.add_suppression("InnoDB: Invalid log header checksum"); |
| 13 |
call mtr.add_suppression("InnoDB: Missing MLOG_CHECKPOINT"); |
| 14 |
call mtr.add_suppression("InnoDB: MLOG_FILE_NAME incorrect"); |
| 15 |
call mtr.add_suppression("InnoDB: ############### CORRUPT LOG RECORD FOUND"); |
| 16 |
call mtr.add_suppression("InnoDB: Log scan aborted at LSN"); |
| 17 |
call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\\r?$"); |
| 18 |
call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed"); |
| 19 |
call mtr.add_suppression("InnoDB: Decrypting checkpoint failed"); |
| 20 |
call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files (1048576|4194304) bytes!"); |
| 21 |
call mtr.add_suppression("InnoDB: The change buffer is corrupted"); |
| 22 |
--enable_query_log |
| 23 |
|
| 24 |
let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption; |
| 25 |
--mkdir $bugdir |
| 26 |
--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err |
| 27 |
|
| 28 |
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES |
| 29 |
WHERE engine = 'innodb' |
| 30 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 31 |
|
| 32 |
write_file $bugdir/ib_buffer_pool; |
| 33 |
EOF |
| 34 |
|
| 35 |
--let $dirs= --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir |
| 36 |
|
| 37 |
perl; |
| 38 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; |
| 39 |
# Create a dummy system tablespace file using the default innodb_page_size=16k |
| 40 |
die unless open OUT, ">", "$ENV{bugdir}/ibdata1"; |
| 41 |
binmode OUT; |
| 42 |
|
| 43 |
# We calculate innodb_checksum_algorithm=crc32 for the pages. |
| 44 |
# The following bytes are excluded: |
| 45 |
# bytes 0..3 (the checksum is stored there) |
| 46 |
# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) |
| 47 |
# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) |
| 48 |
my $polynomial = 0x82f63b78; # CRC-32C |
| 49 |
|
| 50 |
# Tablespace header page with valid FSP_SIZE=768 pages. |
| 51 |
# Also, write a dummy FSEG_MAGIC_N at offset 60 to keep fseg_inode_try_get() |
| 52 |
# happy when fseg_n_reserved_pages() is following an invalid pointer |
| 53 |
# from the all-zero change buffer header page (page 3). |
| 54 |
## FIL_PAGE_OFFSET |
| 55 |
my $head = pack("Nx[18]", 0); |
| 56 |
## FSP_PAGE_SIZE, # FSEG_MAGIC_N |
| 57 |
my $body = pack("x[8]Nx[10]Nx[16312]", 768, 97937874); |
| 58 |
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 59 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 60 |
|
| 61 |
# Dummy change buffer header page (page 3). |
| 62 |
die unless seek(OUT, 3 * 16384, 0); |
| 63 |
## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE |
| 64 |
my $head = pack("NNNx[8]n", 3, 0xffffffff, 0xffffffff, 6); |
| 65 |
my $body = pack("x[62]nnx[16272]", 2, 50); |
| 66 |
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 67 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 68 |
|
| 69 |
# Dummy change buffer root page (page 4). |
| 70 |
## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT |
| 71 |
my $head = pack("NNNx[10]", 4, 0xffffffff, 0xffffffff); |
| 72 |
my $body = chr(0) x 16338; |
| 73 |
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 74 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 75 |
|
| 76 |
# Dictionary header page (page 7). |
| 77 |
die unless seek(OUT, 7 * 16384, 0); |
| 78 |
## FIL_PAGE_OFFSET |
| 79 |
$head = pack("Nx[18]", 7); |
| 80 |
## DICT_HDR_TABLES,DICT_HDR_INDEXES |
| 81 |
$body = pack("x[32]Nx[8]Nx[16290]", 8, 9); |
| 82 |
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 83 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 84 |
|
| 85 |
# Empty SYS_TABLES page (page 8). |
| 86 |
## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE |
| 87 |
$head = pack("NNNx[8]n", 8, ~0, ~0, 17855); |
| 88 |
## PAGE_N_DIR_SLOTS, PAGE_HEAP_TOP, PAGE_INDEX_ID == DICT_TABLES_ID |
| 89 |
$body = pack("nnx[31]Cx[20]", 2, 124, 1); |
| 90 |
$body .= pack("nxnn", 0x801, 3, 116) . "infimum"; |
| 91 |
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum"; |
| 92 |
$body .= pack("x[16248]nn", 116, 101); |
| 93 |
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 94 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 95 |
|
| 96 |
# Empty SYS_INDEXES page (page 9). |
| 97 |
## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE |
| 98 |
$head = pack("NNNx[8]n", 9, ~0, ~0, 17855); |
| 99 |
## PAGE_N_DIR_SLOTS, PAGE_HEAP_TOP, PAGE_INDEX_ID == DICT_INDEXES_ID |
| 100 |
$body = pack("nnx[31]Cx[20]", 2, 124, 3); |
| 101 |
$body .= pack("nxnn", 0x801, 3, 116) . "infimum"; |
| 102 |
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum"; |
| 103 |
$body .= pack("x[16248]nn", 116, 101); |
| 104 |
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); |
| 105 |
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); |
| 106 |
|
| 107 |
print OUT chr(0) x (759 * 16384); |
| 108 |
close OUT or die; |
| 109 |
|
| 110 |
# Create a redo log from before MariaDB 10.2.2/MySQL 5.7.9 |
| 111 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0"; |
| 112 |
binmode OUT; |
| 113 |
print OUT pack("x[9]nx[5]", 0x1286), " ", chr(0) x 492; |
| 114 |
print OUT pack("x[13]nCNnxxNNx[256]", 0x1286, 12, 0x80c, 0xf0, ~0, ~0); |
| 115 |
print OUT pack("H*x[1240]", "590DBAACFE922582"); |
| 116 |
print OUT pack("H*x[5]", "800009440022000c0000000138"); |
| 117 |
print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); |
| 118 |
print OUT chr(0) x 2094592; |
| 119 |
close OUT or die; |
| 120 |
EOF |
| 121 |
|
| 122 |
--echo # redo log from before MariaDB 10.2.2/MySQL 5.7.9 |
| 123 |
--let $restart_parameters= $dirs |
| 124 |
--source include/restart_mysqld.inc |
| 125 |
eval $check_no_innodb; |
| 126 |
--source include/shutdown_mysqld.inc |
| 127 |
|
| 128 |
let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\\.2\\.2\\.; |
| 129 |
--source include/search_pattern_in_file.inc |
| 130 |
|
| 131 |
--echo # redo log from before MariaDB 10.2.2, with corrupted log checkpoint |
| 132 |
--move_file $bugdir/ib_logfile0 $bugdir/ib_logfile |
| 133 |
perl; |
| 134 |
# Create a dummy second redo log file |
| 135 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0"; |
| 136 |
binmode OUT; |
| 137 |
print OUT chr(0) x 1048576; |
| 138 |
close OUT or die; |
| 139 |
EOF |
| 140 |
--source include/start_mysqld.inc |
| 141 |
eval $check_no_innodb; |
| 142 |
--source include/shutdown_mysqld.inc |
| 143 |
|
| 144 |
let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\\.2\\.2, and we did not find a valid checkpoint; |
| 145 |
--source include/search_pattern_in_file.inc |
| 146 |
|
| 147 |
--echo # redo log from before MariaDB 10.2.2, with corrupted log block |
| 148 |
--remove_file $bugdir/ib_logfile0 |
| 149 |
--move_file $bugdir/ib_logfile $bugdir/ib_logfile0 |
| 150 |
# Create a dummy second redo log file that does not contain payload. |
| 151 |
--copy_file $bugdir/ib_logfile0 $bugdir/ib_logfile1 |
| 152 |
|
| 153 |
perl; |
| 154 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 155 |
binmode OUT; |
| 156 |
die unless seek(OUT, 0x800, 0); |
| 157 |
print OUT pack("Nx[508]", 0xc0deba5e); |
| 158 |
close OUT or die; |
| 159 |
EOF |
| 160 |
|
| 161 |
--source include/start_mysqld.inc |
| 162 |
eval $check_no_innodb; |
| 163 |
--source include/shutdown_mysqld.inc |
| 164 |
--source include/search_pattern_in_file.inc |
| 165 |
|
| 166 |
--echo # empty redo log from before MariaDB 10.2.2 |
| 167 |
perl; |
| 168 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 169 |
binmode OUT; |
| 170 |
die unless seek(OUT, 0x800, 0); |
| 171 |
print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 0, 0xb2a); |
| 172 |
close OUT or die; |
| 173 |
EOF |
| 174 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 175 |
--source include/start_mysqld.inc |
| 176 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 177 |
WHERE engine = 'innodb' |
| 178 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 179 |
--source include/shutdown_mysqld.inc |
| 180 |
--let SEARCH_PATTERN= InnoDB: Upgrading redo log: |
| 181 |
--source include/search_pattern_in_file.inc |
| 182 |
--let $restart_parameters= $dirs |
| 183 |
|
| 184 |
--echo # Corrupted multi-file redo log from before MariaDB 10.2.2 |
| 185 |
--move_file $bugdir/ib_logfile0 $bugdir/ib_logfile |
| 186 |
perl; |
| 187 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0"; |
| 188 |
binmode OUT; |
| 189 |
print OUT pack("x[9]nx[5]", 0x1286), " ", chr(0) x 492; |
| 190 |
print OUT pack("x[13]nCNnxxNNx[256]", 0x1286, 12, 0x20000c, 0xf0, ~0, ~0); |
| 191 |
print OUT pack("H*x[1240]", "B41DCAC4525D1217"); |
| 192 |
print OUT pack("H*x[5]", "800009440022000c0000000138"); |
| 193 |
print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); |
| 194 |
print OUT chr(0) x 1046016; |
| 195 |
close OUT or die; |
| 196 |
|
| 197 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; |
| 198 |
binmode OUT; |
| 199 |
die unless seek(OUT, 0xFF800, 0); |
| 200 |
print OUT chr(0) x 2048; |
| 201 |
close OUT or die; |
| 202 |
EOF |
| 203 |
|
| 204 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 205 |
--source include/start_mysqld.inc |
| 206 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 207 |
WHERE engine = 'innodb' |
| 208 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 209 |
--source include/shutdown_mysqld.inc |
| 210 |
let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\\.2\\.2, and it appears corrupted; |
| 211 |
--source include/search_pattern_in_file.inc |
| 212 |
|
| 213 |
--echo # Empty multi-file redo log (wrong offset) from before MariaDB 10.2.2 |
| 214 |
perl; |
| 215 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile1"; |
| 216 |
binmode OUT; |
| 217 |
die unless seek(OUT, 0xFF800, 0); |
| 218 |
print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 0, 0xb2a); |
| 219 |
print OUT chr(0) x 1536; |
| 220 |
close OUT or die; |
| 221 |
EOF |
| 222 |
|
| 223 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 224 |
--source include/start_mysqld.inc |
| 225 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 226 |
WHERE engine = 'innodb' |
| 227 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 228 |
--source include/shutdown_mysqld.inc |
| 229 |
--let SEARCH_PATTERN= Upgrade after a crash is not supported. This redo log was created before MariaDB 10\\.2\\.2, and we did not find a valid checkpoint\\. |
| 230 |
--source include/search_pattern_in_file.inc |
| 231 |
|
| 232 |
--echo # Multi-file redo log with size mismatch from after MariaDB 10.2.2 |
| 233 |
perl; |
| 234 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; |
| 235 |
my $polynomial = 0x82f63b78; # CRC-32C |
| 236 |
|
| 237 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 238 |
binmode OUT; |
| 239 |
$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 1.2.3.4" . chr(0) x 478; |
| 240 |
print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); |
| 241 |
# checkpoint page 1 and all-zero checkpoint 2 |
| 242 |
$_= pack("x[13]nCNNx[484]", 0x1286, 12, 0, 0x20080c); |
| 243 |
print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); |
| 244 |
print OUT chr(0) x 1024; |
| 245 |
close OUT or die; |
| 246 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; |
| 247 |
binmode OUT; |
| 248 |
die unless seek(OUT, 0xFF800, 0); |
| 249 |
print OUT chr(0) x 2048; |
| 250 |
close OUT or die; |
| 251 |
EOF |
| 252 |
|
| 253 |
--echo # Corrupted multi-file redo log from after MariaDB 10.2.2 |
| 254 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 255 |
--source include/start_mysqld.inc |
| 256 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 257 |
WHERE engine = 'innodb' |
| 258 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 259 |
--source include/shutdown_mysqld.inc |
| 260 |
--source include/search_pattern_in_file.inc |
| 261 |
--let SEARCH_PATTERN=InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\\.2\\.3\\.4\\. |
| 262 |
--source include/search_pattern_in_file.inc |
| 263 |
|
| 264 |
perl; |
| 265 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; |
| 266 |
binmode OUT; |
| 267 |
die unless seek(OUT, 0x1FFFFF, 0); |
| 268 |
print OUT chr(0); |
| 269 |
close OUT or die; |
| 270 |
EOF |
| 271 |
|
| 272 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 273 |
--source include/start_mysqld.inc |
| 274 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 275 |
WHERE engine = 'innodb' |
| 276 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 277 |
--source include/shutdown_mysqld.inc |
| 278 |
--let SEARCH_PATTERN=InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 1048576 bytes! |
| 279 |
--source include/search_pattern_in_file.inc |
| 280 |
--let SEARCH_PATTERN=InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\\.2\\.3\\.4\\. |
| 281 |
--source include/search_pattern_in_file.inc |
| 282 |
|
| 283 |
--echo # Empty multi-file redo log from after MariaDB 10.2.2 |
| 284 |
perl; |
| 285 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; |
| 286 |
my $polynomial = 0x82f63b78; # CRC-32C |
| 287 |
|
| 288 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile1"; |
| 289 |
binmode OUT; |
| 290 |
die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused! |
| 291 |
$_= pack("Nnnx[500]", 0x80000944, 12, 12); |
| 292 |
print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); |
| 293 |
close OUT or die; |
| 294 |
EOF |
| 295 |
|
| 296 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 297 |
--source include/start_mysqld.inc |
| 298 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 299 |
WHERE engine = 'innodb' |
| 300 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 301 |
--source include/shutdown_mysqld.inc |
| 302 |
--source include/search_pattern_in_file.inc |
| 303 |
--let $restart_parameters= $dirs |
| 304 |
|
| 305 |
--remove_file $bugdir/ib_logfile0 |
| 306 |
--move_file $bugdir/ib_logfile $bugdir/ib_logfile0 |
| 307 |
|
| 308 |
--echo # redo log from "after" MariaDB 10.2.2, but with invalid header checksum |
| 309 |
perl; |
| 310 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 311 |
binmode OUT; |
| 312 |
print OUT pack("N",2); |
| 313 |
close OUT or die; |
| 314 |
EOF |
| 315 |
--source include/start_mysqld.inc |
| 316 |
eval $check_no_innodb; |
| 317 |
--source include/shutdown_mysqld.inc |
| 318 |
--let SEARCH_PATTERN=InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 4194304 bytes! |
| 319 |
--source include/search_pattern_in_file.inc |
| 320 |
let SEARCH_PATTERN=InnoDB: Invalid log header checksum; |
| 321 |
--source include/search_pattern_in_file.inc |
| 322 |
|
| 323 |
--echo # distant future redo log format, with valid header checksum |
| 324 |
perl; |
| 325 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 326 |
binmode OUT; |
| 327 |
print OUT pack("Nx[5]nx[5]", ~0, 0x1286); |
| 328 |
print OUT "malicious intentions, or perhaps not"; |
| 329 |
print OUT pack("x[456]N", 0x8a1bb475); |
| 330 |
close OUT or die; |
| 331 |
EOF |
| 332 |
--source include/start_mysqld.inc |
| 333 |
eval $check_no_innodb; |
| 334 |
--source include/shutdown_mysqld.inc |
| 335 |
let SEARCH_PATTERN=InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\.; |
| 336 |
--source include/search_pattern_in_file.inc |
| 337 |
|
| 338 |
--echo # valid header, but old-format checkpoint blocks |
| 339 |
perl; |
| 340 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 341 |
binmode OUT; |
| 342 |
# header block |
| 343 |
print OUT pack("Nx[5]nx[5]", 1, 0x1286); |
| 344 |
print OUT "malicious intentions, or perhaps not"; |
| 345 |
print OUT pack("x[456]N", 0xd42d53a2); |
| 346 |
# old-format checkpoint block 1 |
| 347 |
print OUT pack("x[13]nCNnxxNNx[256]", 0x1286, 12, 0x80c, 0xf0, ~0, ~0); |
| 348 |
print OUT pack("H*x[1240]", "590DBAACFE922582"); |
| 349 |
print OUT pack("H*x[5]", "800009440022000c0000000138"); |
| 350 |
print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); |
| 351 |
close OUT or die; |
| 352 |
EOF |
| 353 |
--source include/start_mysqld.inc |
| 354 |
eval $check_no_innodb; |
| 355 |
--source include/shutdown_mysqld.inc |
| 356 |
--let SEARCH_PATTERN=InnoDB: No valid checkpoint was found; the log was created with malicious intentions, or perhaps\\. |
| 357 |
--source include/search_pattern_in_file.inc |
| 358 |
|
| 359 |
--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum |
| 360 |
perl; |
| 361 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 362 |
binmode OUT; |
| 363 |
die unless seek(OUT, 0x210, 0); |
| 364 |
print OUT pack("NNx[264]", 0, 0x80c); |
| 365 |
print OUT pack("NNx[212]N", 0x590dbaac, 0xfe922582, 0xc72d49c4); |
| 366 |
close OUT or die; |
| 367 |
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; |
| 368 |
print OUT pack("x[4194304]"); |
| 369 |
close OUT or die; |
| 370 |
EOF |
| 371 |
# Anything below innodb_force_recovery=6 must find a valid redo log. |
| 372 |
# Missing tablespace files are tolerated already with innodb_force_recovery=1. |
| 373 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 |
| 374 |
--source include/start_mysqld.inc |
| 375 |
eval $check_no_innodb; |
| 376 |
--source include/shutdown_mysqld.inc |
| 377 |
let SEARCH_PATTERN=InnoDB: Invalid log header checksum; |
| 378 |
--source include/search_pattern_in_file.inc |
| 379 |
let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported\. The redo log was created with malicious intentions, or perhaps, and it appears corrupted\.; |
| 380 |
--source include/search_pattern_in_file.inc |
| 381 |
|
| 382 |
--echo # same, but with current-version header |
| 383 |
perl; |
| 384 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 385 |
binmode OUT; |
| 386 |
print OUT pack("Nx[5]nx[5]", 103, 0x1286), "MariaDB 10.3.1"; |
| 387 |
print OUT pack("x[478]N", 0x85021a0f); |
| 388 |
close OUT or die; |
| 389 |
EOF |
| 390 |
--source include/start_mysqld.inc |
| 391 |
eval $check_no_innodb; |
| 392 |
--source include/shutdown_mysqld.inc |
| 393 |
|
| 394 |
let SEARCH_PATTERN=InnoDB: Invalid log header checksum; |
| 395 |
--source include/search_pattern_in_file.inc |
| 396 |
--echo # --innodb-force-recovery=6 (skip the entire redo log) |
| 397 |
--let $restart_parameters= $dirs --innodb-force-recovery=6 |
| 398 |
--source include/start_mysqld.inc |
| 399 |
eval $check_no_innodb; |
| 400 |
--source include/shutdown_mysqld.inc |
| 401 |
--let SEARCH_PATTERN=\\[Note\\] InnoDB: log sequence number 0.*; transaction id 0 |
| 402 |
--source include/search_pattern_in_file.inc |
| 403 |
|
| 404 |
--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number |
| 405 |
perl; |
| 406 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 407 |
binmode OUT; |
| 408 |
# header block |
| 409 |
print OUT pack("Nx[5]nx[5]", 103, 0x1286), "MariaDB 10.3.1"; |
| 410 |
print OUT pack("x[478]N", 0x85021a0f); |
| 411 |
# checkpoint page 1 and all-zero checkpoint 2 |
| 412 |
print OUT pack("x[13]nCNNx[264]", 0x1286, 12, 0, 0x80c); |
| 413 |
print OUT pack("H*x[212]Nx[1024]", "590DBAACFE922582", 0xc72d49c4); |
| 414 |
# redo log data |
| 415 |
print OUT pack("H*x[5]", "C0DEBA5E0022000c0000000138"); |
| 416 |
print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); |
| 417 |
close OUT or die; |
| 418 |
EOF |
| 419 |
--copy_file $bugdir/ib_logfile0 $bugdir/ib_logfile |
| 420 |
# Anything below innodb_force_recovery=6 must find an invalid redo log. |
| 421 |
# Missing tablespace files are tolerated already with innodb_force_recovery=1. |
| 422 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 |
| 423 |
--source include/start_mysqld.inc |
| 424 |
eval $check_no_innodb; |
| 425 |
--source include/shutdown_mysqld.inc |
| 426 |
--echo # --innodb-force-recovery=6 (skip the entire redo log) |
| 427 |
--let $restart_parameters= $dirs --innodb-force-recovery=6 |
| 428 |
--source include/start_mysqld.inc |
| 429 |
eval $check_no_innodb; |
| 430 |
--source include/shutdown_mysqld.inc |
| 431 |
|
| 432 |
--echo # Test a corrupted MLOG_FILE_NAME record. |
| 433 |
--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 |
| 434 |
--remove_file $bugdir/ib_logfile0 |
| 435 |
--move_file $bugdir/ib_logfile $bugdir/ib_logfile0 |
| 436 |
perl; |
| 437 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 438 |
binmode OUT; |
| 439 |
die unless seek(OUT, 0x800, 0); |
| 440 |
print OUT pack("N", 0x80000944); |
| 441 |
die unless seek(OUT, 0x9fc, 0); |
| 442 |
print OUT pack("N", 0xc86474db); |
| 443 |
close OUT or die; |
| 444 |
EOF |
| 445 |
--let $restart_parameters= $dirs |
| 446 |
--source include/start_mysqld.inc |
| 447 |
eval $check_no_innodb; |
| 448 |
--source include/shutdown_mysqld.inc |
| 449 |
let SEARCH_PATTERN=\\[ERROR\\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\.; |
| 450 |
--source include/search_pattern_in_file.inc |
| 451 |
|
| 452 |
--echo # Test a corrupted MLOG_FILE_NAME record. |
| 453 |
--echo # valid header, invalid checkpoint 1, valid checkpoint 2, invalid block |
| 454 |
perl; |
| 455 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 456 |
binmode OUT; |
| 457 |
# header block |
| 458 |
print OUT pack("Nx[5]nx[5]", 103, 0x1286), "MariaDB 10.3.1"; |
| 459 |
print OUT pack("x[478]N", 0x85021a0f); |
| 460 |
# invalid (all-zero) checkpoint page 1 and an empty log page |
| 461 |
print OUT chr(0) x 1024; |
| 462 |
# valid checkpoint block 2 |
| 463 |
print OUT pack("x[13]nCNNx[264]", 0x1286, 12, 0, 0x80c); |
| 464 |
print OUT pack("H*x[212]N", "590DBAACFE922582", 0xc72d49c4); |
| 465 |
# log page |
| 466 |
print OUT pack("H*", "800009440022000c00000001"); |
| 467 |
# MLOG_CHECKPOINT record |
| 468 |
print OUT pack("H*", "38000000000012860c"); |
| 469 |
# MLOG_FILE_NAME record |
| 470 |
print OUT pack("H*", "b7809781e80006"), "bigot"; |
| 471 |
# padding and wrong log block checksum |
| 472 |
print OUT pack("x[475]N", 150151); |
| 473 |
close OUT or die; |
| 474 |
EOF |
| 475 |
--source include/start_mysqld.inc |
| 476 |
eval $check_no_innodb; |
| 477 |
--source include/shutdown_mysqld.inc |
| 478 |
let SEARCH_PATTERN=InnoDB: Invalid log header checksum |
| 479 |
--source include/search_pattern_in_file.inc |
| 480 |
let SEARCH_PATTERN=\\[ERROR\\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1, and it appears corrupted\.; |
| 481 |
--source include/search_pattern_in_file.inc |
| 482 |
--echo # valid header, invalid checkpoint 1, valid checkpoint 2, invalid log record |
| 483 |
perl; |
| 484 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 485 |
binmode OUT; |
| 486 |
die unless seek(OUT, 0x9fc, 0); |
| 487 |
print OUT pack("N", 2454333373); |
| 488 |
close OUT or die; |
| 489 |
EOF |
| 490 |
|
| 491 |
--source include/start_mysqld.inc |
| 492 |
eval $check_no_innodb; |
| 493 |
--source include/shutdown_mysqld.inc |
| 494 |
let SEARCH_PATTERN=\\[ERROR\\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\.; |
| 495 |
--source include/search_pattern_in_file.inc |
| 496 |
|
| 497 |
--echo # 10.2 missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT |
| 498 |
perl; |
| 499 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 500 |
binmode OUT; |
| 501 |
# header block |
| 502 |
print OUT pack("Nx[5]nx[5]", 1, 0x1286); |
| 503 |
print OUT "ibbackup was here!!!1!"; |
| 504 |
print OUT pack("x[470]N", 0x52b54540); |
| 505 |
# invalid (all-zero) checkpoint page 1 and an empty log page |
| 506 |
print OUT chr(0) x 1024; |
| 507 |
# valid checkpoint block 2 |
| 508 |
print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x80c); |
| 509 |
# pointer to the MLOG_CHECKPOINT record, and checkpoint page checksum |
| 510 |
print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x101741b); |
| 511 |
# log page |
| 512 |
print OUT pack("H*", "800009440022000c00000001"); |
| 513 |
# MLOG_1BYTE record for missing tablespace 42 page 123 |
| 514 |
print OUT pack("CCCnC", 128 | 1, 42, 123, 4567, 89); |
| 515 |
# MLOG_CHECKPOINT record |
| 516 |
print OUT pack("CNN", 56, 0, 0x12860c); |
| 517 |
# padding (MLOG_DUMMY_RECORD) and block checksum |
| 518 |
print OUT " " x 481, pack("N", 0x644e6db8); |
| 519 |
close OUT or die; |
| 520 |
EOF |
| 521 |
|
| 522 |
--source include/start_mysqld.inc |
| 523 |
eval $check_no_innodb; |
| 524 |
--source include/shutdown_mysqld.inc |
| 525 |
let SEARCH_PATTERN=\\[ERROR\\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with ibbackup was here!!!1!\.; |
| 526 |
--source include/search_pattern_in_file.inc |
| 527 |
|
| 528 |
--echo # 10.3 missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT |
| 529 |
perl; |
| 530 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 531 |
binmode OUT; |
| 532 |
print OUT pack("Nx[5]nx[5]", 103, 0x1286), "MariaDB 10.3.1"; |
| 533 |
print OUT pack("x[478]N", 0x85021a0f); |
| 534 |
close OUT or die; |
| 535 |
EOF |
| 536 |
|
| 537 |
--source include/start_mysqld.inc |
| 538 |
eval $check_no_innodb; |
| 539 |
--source include/shutdown_mysqld.inc |
| 540 |
let SEARCH_PATTERN=\\[ERROR\\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\.; |
| 541 |
--source include/search_pattern_in_file.inc |
| 542 |
|
| 543 |
--echo # Empty 10.3 redo log |
| 544 |
perl; |
| 545 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 546 |
binmode OUT; |
| 547 |
die unless seek(OUT, 0x800, 0); |
| 548 |
print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); |
| 549 |
close OUT or die; |
| 550 |
EOF |
| 551 |
|
| 552 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m |
| 553 |
--source include/start_mysqld.inc |
| 554 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 555 |
WHERE engine = 'innodb' |
| 556 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 557 |
--source include/shutdown_mysqld.inc |
| 558 |
--let SEARCH_PATTERN= InnoDB: log sequence number 1213964\\b.*; transaction id 0 |
| 559 |
--source include/search_pattern_in_file.inc |
| 560 |
|
| 561 |
--echo # Empty 10.2 redo log |
| 562 |
perl; |
| 563 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 564 |
binmode OUT; |
| 565 |
# header block |
| 566 |
print OUT pack("Nx[5]nx[5]", 1, 0x1286); |
| 567 |
print OUT "ibbackup was here!!!1!"; |
| 568 |
print OUT pack("x[470]N", 0x52b54540); |
| 569 |
# In encryption.innodb_log_corruption the previous step would |
| 570 |
# replace the block with an encrypted one and update the checkpoint. |
| 571 |
# Restore them. |
| 572 |
# invalid (all-zero) checkpoint page 1 and an empty log page |
| 573 |
print OUT chr(0) x 1024; |
| 574 |
# valid checkpoint block 2 |
| 575 |
print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x80c); |
| 576 |
# pointer to the MLOG_CHECKPOINT record, and checkpoint page checksum |
| 577 |
print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x101741b); |
| 578 |
# log page |
| 579 |
print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); |
| 580 |
close OUT or die; |
| 581 |
EOF |
| 582 |
|
| 583 |
--source include/start_mysqld.inc |
| 584 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 585 |
WHERE engine = 'innodb' |
| 586 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 587 |
--source include/shutdown_mysqld.inc |
| 588 |
--let SEARCH_PATTERN= InnoDB: Upgrading redo log: |
| 589 |
--source include/search_pattern_in_file.inc |
| 590 |
|
| 591 |
--echo # Empty 10.5 redo log |
| 592 |
perl; |
| 593 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 594 |
binmode OUT; |
| 595 |
# header block |
| 596 |
print OUT pack("Nx[5]nx[5]", 0x50485953, 0x1286); |
| 597 |
print OUT "ibbackup was here!!!1!"; |
| 598 |
print OUT pack("x[470]N", 0x677700cf); |
| 599 |
# invalid (all-zero) checkpoint page 1 and an empty log page |
| 600 |
print OUT chr(0) x 1024; |
| 601 |
# valid checkpoint block 2 |
| 602 |
print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x120c); |
| 603 |
# pointer to the FILE_CHECKPOINT record, and checkpoint page checksum |
| 604 |
print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x3b4ce62d); |
| 605 |
# log page |
| 606 |
print OUT pack("x[2560]NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); |
| 607 |
close OUT or die; |
| 608 |
EOF |
| 609 |
|
| 610 |
--source include/start_mysqld.inc |
| 611 |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES |
| 612 |
WHERE engine = 'innodb' |
| 613 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 614 |
--source include/shutdown_mysqld.inc |
| 615 |
--let SEARCH_PATTERN= InnoDB: Upgrading redo log: |
| 616 |
--source include/search_pattern_in_file.inc |
| 617 |
|
| 618 |
--echo # Minimal MariaDB 10.1.21 encrypted redo log |
| 619 |
perl; |
| 620 |
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; |
| 621 |
binmode OUT; |
| 622 |
# header and empty checkpoint page 1 (not encrypted) |
| 623 |
print OUT pack("x[9]nx[5]A[4]x[46]Cx[1469]", 0x186e, "", 2); |
| 624 |
# checkpoint page 2 (not encrypted) |
| 625 |
print OUT pack("NNNNNNNN", 0, 1, 0, 0x186e16, 0x816, 0x1000000, ~0, ~0); |
| 626 |
print OUT pack("x[6]Cx[249]", 0x20); |
| 627 |
print OUT pack("H*x[12]nNNn", "FDE012DE6D3BD6AC", 0x201, 1, 1, 0xEFC); |
| 628 |
print OUT pack("H*x[162]", |
| 629 |
"75774015174BE4723904C88E110E3B50FF5C634167DB058D02A415D2A4A3"); |
| 630 |
# log block (encrypted) |
| 631 |
print OUT pack("H*", "80000c380016000c000000015cf22e8aff355642045605c22b97f7cba94cc9932b6032b9c828ef85269024127d3863193b44e52d22eccdd0a8b197ce837f6b530c3042a022738bbac803adc5e7607333409b35c1f6351601a9da83d9b0bc3f389fb288d2bd6a0783066e3b07cae0e276fe83aa522d3f2b59b9549e2338031674383bbef87d7a42f415870fa33685afd3894a9d8214d60b5cde0c776489f45ad0c759e0495bc5d0c91018750070ed21ec1a41bcb9054007851df28e1da15fb662ab219bd558f1569b22671c943bfb0c12e97b604feb0d96a53c05c868e2eea9d4692cd0b6f4625a52adc8251ac955957e33d8c32eb964e416b246b950321a71d5b2e8e95c26e00333abe24ca827cd2eb95cff7b21dce639073f526614816fa2151afdb967aa049b4625cd70881fbd73827c1eb6f70447dcb7755055fa939a2c8ec38fc24f135c22f9f9691bd34a91be7047e5fd68d2e68b0d072cb69c253e14c7111b950b9d6df327f3ffb2a0dc6eff045d64baeb3c75c4ae4aeb41235757f40291540148d79deaff983851247134d7513a550ed7e21bf2e209d8dec51b252f0e9ba6fa33cc2ad0b28d05c04442dac9d233d0ca93d8ef0b81ba82e7396ffaec979b2df97f7249a20d8cb8036b582c245f27e64ac12c8b1d46248b670936893c7c737ba8a4ecf623689c18d79755865626993a43d607611d0736d1c626ebf88946"); |
| 632 |
close OUT or die; |
| 633 |
EOF |
| 634 |
|
| 635 |
--let $restart_parameters= $dirs --innodb-force-recovery=5 |
| 636 |
--source include/start_mysqld.inc |
| 637 |
if (!$no_cleanup) { |
| 638 |
eval $check_no_innodb; |
| 639 |
--source include/shutdown_mysqld.inc |
| 640 |
--let SEARCH_PATTERN= InnoDB: Obtaining redo log encryption key version 1 failed |
| 641 |
--source include/search_pattern_in_file.inc |
| 642 |
--let SEARCH_PATTERN= InnoDB: Decrypting checkpoint failed |
| 643 |
--source include/search_pattern_in_file.inc |
| 644 |
|
| 645 |
--list_files $bugdir |
| 646 |
--remove_files_wildcard $bugdir |
| 647 |
--rmdir $bugdir |
| 648 |
--let $restart_parameters= |
| 649 |
--source include/start_mysqld.inc |
| 650 |
} |