diff --git a/db/compaction/compaction_job.cc b/db/compaction/compaction_job.cc index 97555fcb1dd..04efc011e39 100644 --- a/db/compaction/compaction_job.cc +++ b/db/compaction/compaction_job.cc @@ -1442,9 +1442,8 @@ void CompactionJob::ProcessKeyValueCompaction(SubcompactionState* sub_compact) { // close the output files. Open file function is also passed, in case there's // only range-dels, no file was opened, to save the range-dels, it need to // create a new output file. - status = sub_compact->CloseCompactionFiles( - status, sub_compact->compaction->SupportsPerKeyPlacement(), - open_file_func, close_file_func); + status = sub_compact->CloseCompactionFiles(status, open_file_func, + close_file_func); if (blob_file_builder) { if (status.ok()) { diff --git a/db/compaction/subcompaction_state.h b/db/compaction/subcompaction_state.h index a9b68b0601c..8b8c76f6e15 100644 --- a/db/compaction/subcompaction_state.h +++ b/db/compaction/subcompaction_state.h @@ -201,21 +201,20 @@ class SubcompactionState { // Close all compaction output files, both output_to_penultimate_level outputs // and normal outputs. Status CloseCompactionFiles(const Status& curr_status, - bool supports_per_key_placement, const CompactionFileOpenFunc& open_file_func, const CompactionFileCloseFunc& close_file_func) { + auto per_key = compaction->SupportsPerKeyPlacement(); // Call FinishCompactionOutputFile() even if status is not ok: it needs to // close the output file. // CloseOutput() may open new compaction output files. is_current_penultimate_level_ = true; Status s = penultimate_level_outputs_.CloseOutput( - curr_status, - supports_per_key_placement ? range_del_agg_.get() : nullptr, - open_file_func, close_file_func); + curr_status, per_key ? range_del_agg_.get() : nullptr, open_file_func, + close_file_func); is_current_penultimate_level_ = false; s = compaction_outputs_.CloseOutput( - s, supports_per_key_placement ? nullptr : range_del_agg_.get(), - open_file_func, close_file_func); + s, per_key ? nullptr : range_del_agg_.get(), open_file_func, + close_file_func); return s; }