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
This commit is contained in:
Igor Canadi 2015-04-29 13:35:48 -07:00
parent 7f47ba0e26
commit 7246ad34d0
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ Status DBImpl::SuggestCompactRange(ColumnFamilyHandle* column_family,
{ {
InstrumentedMutexLock l(&mutex_); InstrumentedMutexLock l(&mutex_);
auto vstorage = cfd->current()->storage_info(); 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; std::vector<FileMetaData*> inputs;
vstorage->GetOverlappingInputs( vstorage->GetOverlappingInputs(
level, begin == nullptr ? nullptr : &start_key, level, begin == nullptr ? nullptr : &start_key,

View File

@ -12547,7 +12547,7 @@ TEST_F(DBTest, SuggestCompactRangeTest) {
options.compaction_style = kCompactionStyleLevel; options.compaction_style = kCompactionStyleLevel;
options.write_buffer_size = 100 << 10; // 100KB options.write_buffer_size = 100 << 10; // 100KB
options.level0_file_num_compaction_trigger = 2; options.level0_file_num_compaction_trigger = 2;
options.num_levels = 3; options.num_levels = 4;
options.max_bytes_for_level_base = 400 * 1024; options.max_bytes_for_level_base = 400 * 1024;
Reopen(options); Reopen(options);