diff --git a/db/db_impl_experimental.cc b/db/db_impl_experimental.cc index f2c70740e6..d6c3dfc953 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 2eb49213d5..10f504eb35 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);