From ce0ea61aecd53ac02a0e7da2b166961c7d98650a Mon Sep 17 00:00:00 2001 From: Xinye Tao Date: Mon, 26 Sep 2022 20:36:05 +0800 Subject: [PATCH] compute compaction score once for a batch of range file deletes (#316) Signed-off-by: tabokie Signed-off-by: tabokie --- db/db_impl/db_impl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 240ddca0d66..34aa65e90cf 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -3859,10 +3859,12 @@ Status DBImpl::DeleteFilesInRanges(ColumnFamilyHandle* column_family, deleted_files.insert(level_file); level_file->being_compacted = true; } - vstorage->ComputeCompactionScore(*cfd->ioptions(), - *cfd->GetLatestMutableCFOptions()); } } + if (!deleted_files.empty()) { + vstorage->ComputeCompactionScore(*cfd->ioptions(), + *cfd->GetLatestMutableCFOptions()); + } if (edit.GetDeletedFiles().empty()) { job_context.Clean(); return status;