Reduce empty SST creation/deletion during compaction (#4311)

Summary:
I have a PR to start calling `OnTableFileCreated` for empty SSTs: #4307. However, it is a behavior change so should not go into a patch release.

This PR adds back a check to make sure range deletions at least exist before starting file creation. This PR should be safe to backport to earlier versions.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4311

Differential Revision: D9493734

Pulled By: ajkr

fbshipit-source-id: f0d43cda4cfd904f133cfe3a6eb622f52a9ccbe8
main
Andrew Kryczka 6 years ago committed by Facebook Github Bot
parent e7bb8e9b92
commit 17f9a181d5
  1. 1
      HISTORY.md
  2. 3
      db/compaction_job.cc

@ -5,6 +5,7 @@
### New Features
### Bug Fixes
* Avoid creating empty SSTs and subsequently deleting them in certain cases during compaction.
## 5.16.0 (8/21/2018)
### Public API Change

@ -1077,7 +1077,8 @@ void CompactionJob::ProcessKeyValueCompaction(SubcompactionState* sub_compact) {
}
if (status.ok() && sub_compact->builder == nullptr &&
sub_compact->outputs.size() == 0) {
sub_compact->outputs.size() == 0 &&
!range_del_agg->IsEmpty()) {
// handle subcompaction containing only range deletions
status = OpenCompactionOutputFile(sub_compact);
}

Loading…
Cancel
Save