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,12 +2631,17 @@ recv_scan_log_recs(
fprintf(stderr, "Scanned lsn no %lu\n",
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)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
if (no != log_block_convert_lsn_to_no(scanned_lsn)) {
/* 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)) {
fprintf(stderr,
"InnoDB: Log block no %lu at"
" lsn " LSN_PF " has\n"
......@@ -2644,17 +2649,12 @@ recv_scan_log_recs(
" contains %lu, should be %lu\n",
(ulong) no,
scanned_lsn,
(ulong) log_block_get_checksum(
log_block),
(ulong) log_block_calc_checksum(
log_block));
}
(ulong) log_block_get_checksum(log_block),
(ulong) log_block_calc_checksum(log_block));
maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
&log_crypt_err);
/* Garbage or an incompletely written log block */
/* Print checkpoint encryption keys if present */
log_crypt_print_checkpoint_keys(log_block);
finished = TRUE;
......
......@@ -2720,12 +2720,17 @@ recv_scan_log_recs(
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)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
if (no != log_block_convert_lsn_to_no(scanned_lsn)) {
/* 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)) {
fprintf(stderr,
"InnoDB: Log block no %lu at"
" lsn " LSN_PF " has\n"
......@@ -2733,17 +2738,12 @@ recv_scan_log_recs(
" contains %lu, should be %lu\n",
(ulong) no,
scanned_lsn,
(ulong) log_block_get_checksum(
log_block),
(ulong) log_block_calc_checksum(
log_block));
}
(ulong) log_block_get_checksum(log_block),
(ulong) log_block_calc_checksum(log_block));
maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
&log_crypt_err);
/* Garbage or an incompletely written log block */
/* Print checkpoint encryption keys if present */
log_crypt_print_checkpoint_keys(log_block);
finished = TRUE;
......@@ -2764,7 +2764,6 @@ recv_scan_log_recs(
}
break;
}
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