From 155ce60dafbc3841da73eedf0d9dc6c4fabd8404 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 6 Jul 2015 11:14:08 -0700 Subject: [PATCH] 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 --- db/compaction_job_test.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/db/compaction_job_test.cc b/db/compaction_job_test.cc index 79d12d8a7..7eed7e490 100644 --- a/db/compaction_job_test.cc +++ b/db/compaction_job_test.cc @@ -76,11 +76,10 @@ class CompactionJobTest : public testing::Test { largest = internal_key; largest_seqno = sequence_number; } - std::pair 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; }