diff --git a/.gitignore b/.gitignore index 9b4ac1591a..8dd7e82960 100644 --- a/.gitignore +++ b/.gitignore @@ -95,4 +95,5 @@ fuzz/crash-* cmake-build-* third-party/folly/ -.cache \ No newline at end of file +.cache +*.sublime-* diff --git a/db/compaction/compaction.cc b/db/compaction/compaction.cc index 1832f13031..e3e084e89d 100644 --- a/db/compaction/compaction.cc +++ b/db/compaction/compaction.cc @@ -486,26 +486,25 @@ bool Compaction::IsTrivialMove() const { // assert inputs_.size() == 1 - std::unique_ptr partitioner = CreateSstPartitioner(); - - for (const auto& file : inputs_.front().files) { - std::vector file_grand_parents; - if (output_level_ + 1 >= number_levels_) { - continue; - } - input_vstorage_->GetOverlappingInputs(output_level_ + 1, &file->smallest, - &file->largest, &file_grand_parents); - const auto compaction_size = - file->fd.GetFileSize() + TotalFileSize(file_grand_parents); - if (compaction_size > max_compaction_bytes_) { - return false; - } - - if (partitioner.get() != nullptr) { - if (!partitioner->CanDoTrivialMove(file->smallest.user_key(), - file->largest.user_key())) { + if (output_level_ + 1 < number_levels_) { + std::unique_ptr partitioner = CreateSstPartitioner(); + for (const auto& file : inputs_.front().files) { + std::vector file_grand_parents; + input_vstorage_->GetOverlappingInputs(output_level_ + 1, &file->smallest, + &file->largest, + &file_grand_parents); + const auto compaction_size = + file->fd.GetFileSize() + TotalFileSize(file_grand_parents); + if (compaction_size > max_compaction_bytes_) { return false; } + + if (partitioner.get() != nullptr) { + if (!partitioner->CanDoTrivialMove(file->smallest.user_key(), + file->largest.user_key())) { + return false; + } + } } }