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
This commit is contained in:
Igor Canadi 2015-07-06 11:14:08 -07:00
parent b6655a679d
commit 155ce60daf

View File

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