From 2b2a898e0b9ffe12e4ffb9e2bf4a697c843278f0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 14 Mar 2016 17:22:29 -0400 Subject: [PATCH] db/log_reader: combine kBadRecord{Len,Checksum} for readability These vary only by the corruption string reported. Signed-off-by: Sage Weil --- db/log_reader.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/db/log_reader.cc b/db/log_reader.cc index f2fd97f62b..a33d7e4801 100644 --- a/db/log_reader.cc +++ b/db/log_reader.cc @@ -192,20 +192,6 @@ bool Reader::ReadRecord(Slice* record, std::string* scratch, break; case kBadRecordLen: - if (recycled_ && - 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"); - in_fragmented_record = false; - scratch->clear(); - } - break; - case kBadRecordChecksum: if (recycled_ && wal_recovery_mode == @@ -213,7 +199,10 @@ bool Reader::ReadRecord(Slice* record, std::string* scratch, scratch->clear(); return false; } - ReportCorruption(drop_size, "checksum mismatch"); + if (record_type == kBadRecordLen) + ReportCorruption(drop_size, "bad record length"); + else + ReportCorruption(drop_size, "checksum mismatch"); if (in_fragmented_record) { ReportCorruption(scratch->size(), "error in middle of record"); in_fragmented_record = false;