From a5adda0642a82d9e6c3fb25e878cd6ee768f133a Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 10 Feb 2017 10:51:08 -0800 Subject: [PATCH] Fix repair issues Summary: Record the first parsed sequence number as the minimum so we can find the true minimum otherwise everything is larger than zero. Fix the comparator name comparision. Closes https://github.com/facebook/rocksdb/pull/1858 Differential Revision: D4544365 Pulled By: ajkr fbshipit-source-id: 439cbc2 --- db/repair.cc | 1 + db/repair_test.cc | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/db/repair.cc b/db/repair.cc index 6a70e853d..29752d819 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -486,6 +486,7 @@ class Repairer { if (empty) { empty = false; t->meta.smallest.DecodeFrom(key); + t->min_sequence = parsed.sequence; } t->meta.largest.DecodeFrom(key); if (parsed.sequence < t->min_sequence) { diff --git a/db/repair_test.cc b/db/repair_test.cc index 93e5113b3..82384836f 100644 --- a/db/repair_test.cc +++ b/db/repair_test.cc @@ -253,7 +253,10 @@ TEST_F(RepairTest, RepairColumnFamilyOptions) { db_->GetPropertiesOfAllTables(handles_[1], &fname_to_props); ASSERT_EQ(fname_to_props.size(), 2U); for (const auto& fname_and_props : fname_to_props) { - ASSERT_EQ(InternalKeyComparator(rev_opts.comparator).Name(), + std::string comparator_name ( + InternalKeyComparator(rev_opts.comparator).Name()); + comparator_name = comparator_name.substr(comparator_name.find(':') + 1); + ASSERT_EQ(comparator_name, fname_and_props.second->comparator_name); }