From 7246ad34d05dc4a29aadd80b378a607885c2edb2 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 29 Apr 2015 13:35:48 -0700 Subject: [PATCH] Don't compact bottommost level in SuggestCompactRange Summary: Before the fix we also marked the bottommost level for compaction. This is wrong because then RocksDB has N+1 levels instead of N as before the compaction. Test Plan: SuggestCompactRangeTest in db_test Reviewers: yhchiang, rven Reviewed By: rven Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D37869 --- db/db_impl_experimental.cc | 2 +- db/db_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/db_impl_experimental.cc b/db/db_impl_experimental.cc index f2c70740e..d6c3dfc95 100644 --- a/db/db_impl_experimental.cc +++ b/db/db_impl_experimental.cc @@ -38,7 +38,7 @@ Status DBImpl::SuggestCompactRange(ColumnFamilyHandle* column_family, { InstrumentedMutexLock l(&mutex_); auto vstorage = cfd->current()->storage_info(); - for (int level = 0; level < vstorage->num_non_empty_levels(); ++level) { + for (int level = 0; level < vstorage->num_non_empty_levels() - 1; ++level) { std::vector inputs; vstorage->GetOverlappingInputs( level, begin == nullptr ? nullptr : &start_key, diff --git a/db/db_test.cc b/db/db_test.cc index 2eb49213d..10f504eb3 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -12547,7 +12547,7 @@ TEST_F(DBTest, SuggestCompactRangeTest) { options.compaction_style = kCompactionStyleLevel; options.write_buffer_size = 100 << 10; // 100KB options.level0_file_num_compaction_trigger = 2; - options.num_levels = 3; + options.num_levels = 4; options.max_bytes_for_level_base = 400 * 1024; Reopen(options);