diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-06-11 17:17:27 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-06-11 17:17:27 +0530 |
commit | cf5b19fadd39e65881ed6398edd6b79c3894a442 (patch) | |
tree | bd145b8cd5883f4fda484081a887a1859df6da6a | |
parent | e7695f95ae714f3168ce953fd022ddfb40f03e67 (diff) | |
download | mariadb-git-cf5b19fadd39e65881ed6398edd6b79c3894a442.tar.gz |
MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"bb-10.1-MDEV-16866
- 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.
-rw-r--r-- | storage/innobase/log/log0recv.cc | 38 | ||||
-rw-r--r-- | storage/xtradb/log/log0recv.cc | 37 |
2 files changed, 38 insertions, 37 deletions
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index a8a5f7b79e3..a86fd9fd8fd 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2631,30 +2631,30 @@ 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)) { + /* 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) - && !log_block_checksum_is_ok_or_old_format( - log_block, true)) { - fprintf(stderr, - "InnoDB: Log block no %lu at" - " lsn " LSN_PF " has\n" - "InnoDB: ok header, but checksum field" - " contains %lu, should be %lu\n", - (ulong) no, - scanned_lsn, - (ulong) log_block_get_checksum( - log_block), - (ulong) log_block_calc_checksum( - log_block)); - } + fprintf(stderr, + "InnoDB: Log block no %lu at" + " lsn " LSN_PF " has\n" + "InnoDB: ok header, but checksum field" + " contains %lu, should be %lu\n", + (ulong) no, + 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, &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; diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 2f43a1a42a8..127df00eedf 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -2720,24 +2720,26 @@ 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)) { + /* 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) - && !log_block_checksum_is_ok_or_old_format( - log_block, true)) { - fprintf(stderr, - "InnoDB: Log block no %lu at" - " lsn " LSN_PF " has\n" - "InnoDB: ok header, but checksum field" - " contains %lu, should be %lu\n", - (ulong) no, - scanned_lsn, - (ulong) log_block_get_checksum( - log_block), - (ulong) log_block_calc_checksum( - log_block)); - } + fprintf(stderr, + "InnoDB: Log block no %lu at" + " lsn " LSN_PF " has\n" + "InnoDB: ok header, but checksum field" + " contains %lu, should be %lu\n", + (ulong) no, + 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, &log_crypt_err); @@ -2764,7 +2766,6 @@ recv_scan_log_recs( } break; - } if (log_block_get_flush_bit(log_block)) { |