Fix compaction_job_test

Summary:
Two issues:
* the input keys to the compaction don't include sequence number.
* sequence number is set to max(seq_num), but it should be set to max(seq_num)+1, because the condition here is strictly-larger (i.e. we will only zero-out sequence number if the DB's sequence number is strictly greater than the key's sequence number): https://github.com/facebook/rocksdb/blob/master/db/compaction_job.cc#L830

Test Plan: make compaction_job_test && ./compaction_job_test

Reviewers: sdong, lovro

Reviewed By: lovro

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D41247
main
Igor Canadi 10 years ago
parent b6655a679d
commit 155ce60daf
  1. 9
      db/compaction_job_test.cc

@ -76,11 +76,10 @@ class CompactionJobTest : public testing::Test {
largest = internal_key;
largest_seqno = sequence_number;
}
std::pair<std::string, std::string> key_value(
{bottommost_internal_key.Encode().ToString(), value});
contents.insert(key_value);
contents.insert({internal_key.Encode().ToString(), value});
if (i == 1 || k < kKeysPerFile / 2) {
expected_results.insert(key_value);
expected_results.insert(
{bottommost_internal_key.Encode().ToString(), value});
}
}
@ -97,7 +96,7 @@ class CompactionJobTest : public testing::Test {
mutable_cf_options_, &edit, &mutex_);
mutex_.Unlock();
}
versions_->SetLastSequence(sequence_number);
versions_->SetLastSequence(sequence_number + 1);
return expected_results;
}

Loading…
Cancel
Save