MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB:...

MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"

- If InnoDB encounters garbage or incomplete written log block during
recovery then don't throw the error. Treat it as end of the log.
- This kind of incomplete or empty block can be result of killing
InnoDB when writing the redo log.
parent e7695f95
...@@ -2631,30 +2631,30 @@ recv_scan_log_recs( ...@@ -2631,30 +2631,30 @@ recv_scan_log_recs(
fprintf(stderr, "Scanned lsn no %lu\n", fprintf(stderr, "Scanned lsn no %lu\n",
log_block_convert_lsn_to_no(scanned_lsn)); log_block_convert_lsn_to_no(scanned_lsn));
*/ */
if (no != log_block_convert_lsn_to_no(scanned_lsn) if (no != log_block_convert_lsn_to_no(scanned_lsn)) {
|| !log_block_checksum_is_ok_or_old_format(log_block, true)) { /* Garbage or an incompletely written log block.
We will not report any error; because this can happen
when InnoDB was killed while it was writing
redo log. We simply treat this as an abrupt end of the
redo log. */
finished = true;
break;
} else if (!log_block_checksum_is_ok_or_old_format(
log_block, true)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn) fprintf(stderr,
&& !log_block_checksum_is_ok_or_old_format( "InnoDB: Log block no %lu at"
log_block, true)) { " lsn " LSN_PF " has\n"
fprintf(stderr, "InnoDB: ok header, but checksum field"
"InnoDB: Log block no %lu at" " contains %lu, should be %lu\n",
" lsn " LSN_PF " has\n" (ulong) no,
"InnoDB: ok header, but checksum field" scanned_lsn,
" contains %lu, should be %lu\n", (ulong) log_block_get_checksum(log_block),
(ulong) no, (ulong) log_block_calc_checksum(log_block));
scanned_lsn,
(ulong) log_block_get_checksum(
log_block),
(ulong) log_block_calc_checksum(
log_block));
}
maybe_encrypted = log_crypt_block_maybe_encrypted(log_block, maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
&log_crypt_err); &log_crypt_err);
/* Garbage or an incompletely written log block */
/* Print checkpoint encryption keys if present */ /* Print checkpoint encryption keys if present */
log_crypt_print_checkpoint_keys(log_block); log_crypt_print_checkpoint_keys(log_block);
finished = TRUE; finished = TRUE;
......
...@@ -2720,30 +2720,30 @@ recv_scan_log_recs( ...@@ -2720,30 +2720,30 @@ recv_scan_log_recs(
log_block_convert_lsn_to_no(scanned_lsn)); log_block_convert_lsn_to_no(scanned_lsn));
*/ */
if (no != log_block_convert_lsn_to_no(scanned_lsn) if (no != log_block_convert_lsn_to_no(scanned_lsn)) {
|| !log_block_checksum_is_ok_or_old_format(log_block, true)) { /* Garbage or an incompletely written log block.
We will not report any error; because this can happen
when InnoDB was killed while it was writing
redo log. We simply treat this as an abrupt end of the
redo log. */
finished = true;
break;
} else if (!log_block_checksum_is_ok_or_old_format(
log_block, true)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn) fprintf(stderr,
&& !log_block_checksum_is_ok_or_old_format( "InnoDB: Log block no %lu at"
log_block, true)) { " lsn " LSN_PF " has\n"
fprintf(stderr, "InnoDB: ok header, but checksum field"
"InnoDB: Log block no %lu at" " contains %lu, should be %lu\n",
" lsn " LSN_PF " has\n" (ulong) no,
"InnoDB: ok header, but checksum field" scanned_lsn,
" contains %lu, should be %lu\n", (ulong) log_block_get_checksum(log_block),
(ulong) no, (ulong) log_block_calc_checksum(log_block));
scanned_lsn,
(ulong) log_block_get_checksum(
log_block),
(ulong) log_block_calc_checksum(
log_block));
}
maybe_encrypted = log_crypt_block_maybe_encrypted(log_block, maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
&log_crypt_err); &log_crypt_err);
/* Garbage or an incompletely written log block */
/* Print checkpoint encryption keys if present */ /* Print checkpoint encryption keys if present */
log_crypt_print_checkpoint_keys(log_block); log_crypt_print_checkpoint_keys(log_block);
finished = TRUE; finished = TRUE;
...@@ -2764,7 +2764,6 @@ recv_scan_log_recs( ...@@ -2764,7 +2764,6 @@ recv_scan_log_recs(
} }
break; break;
} }
if (log_block_get_flush_bit(log_block)) { if (log_block_get_flush_bit(log_block)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment