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
main
Igor Canadi 9 years ago
parent 7f47ba0e26
commit 7246ad34d0
  1. 2
      db/db_impl_experimental.cc
  2. 2
      db/db_test.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<FileMetaData*> inputs;
vstorage->GetOverlappingInputs(
level, begin == nullptr ? nullptr : &start_key,

@ -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);

Loading…
Cancel
Save