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
This commit is contained in:
Dmitri Smirnov 2017-02-10 10:51:08 -08:00 committed by Facebook Github Bot
parent b48e4778be
commit a5adda0642
2 changed files with 5 additions and 1 deletions

View File

@ -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) {

View File

@ -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);
}