diff --git a/HISTORY.md b/HISTORY.md index 27688d6ac..7fd81aa3f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 3c6f1eefd..ada49103c 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -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); }