If we are in kTolerateCorruptedTailRecords, treat these errors as the
end of the log. This is particularly important for recycled logs, where
we will regularly see corrupted headers (bad length or checksum) when
replaying a log. If we are aligned with a block boundary or get lucky,
we will land on an old header and see the log nubmer mismatch, but more
commonly we will land midway through some previously and effectively
see noise.
Signed-off-by: Sage Weil <sage@redhat.com>
break;
case kBadRecordLen:
+ if (wal_recovery_mode ==
+ WALRecoveryMode::kTolerateCorruptedTailRecords) {
+ scratch->clear();
+ return false;
+ }
ReportCorruption(drop_size, "bad record length");
if (in_fragmented_record) {
ReportCorruption(scratch->size(), "error in middle of record");
break;
case kBadRecordChecksum:
+ if (wal_recovery_mode ==
+ WALRecoveryMode::kTolerateCorruptedTailRecords) {
+ scratch->clear();
+ return false;
+ }
ReportCorruption(drop_size, "checksum mismatch");
if (in_fragmented_record) {
ReportCorruption(scratch->size(), "error in middle of record");