From f1230f91cb7b2b9e21d26c96052dfe1de7d4d55d Mon Sep 17 00:00:00 2001 From: Yuval Ariel Date: Thu, 7 Mar 2024 13:14:52 +0200 Subject: [PATCH] Start timer when L0 score is 1 and greater. --- db/column_family.cc | 2 +- db/version_set.cc | 4 ++-- db/version_set.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index fabe7ac21..c290594c9 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -1143,7 +1143,7 @@ void ColumnFamilyData::SetL0BaseCompactionSpeed(uint64_t l0_bytes_compacted) { void ColumnFamilyData::MaybeStartL0L1Timer() { auto* vstorage = current_->storage_info(); // start timer for L0 clearance when trigger passed. - if (!started_l0_timer_ && vstorage->IsL0ScoreAbove1()) { + if (!started_l0_timer_ && vstorage->IsL0Score1AndAbove()) { started_l0_timer_ = true; l0_start_clearance_time_ = ioptions_.clock->NowMicros(); ROCKS_LOG_INFO(ioptions_.logger, diff --git a/db/version_set.cc b/db/version_set.cc index 4bd9ff5b2..f914882c4 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -3631,14 +3631,14 @@ void VersionStorageInfo::ComputeCompactionScore( EstimateCompactionBytesNeeded(mutable_cf_options); } -bool VersionStorageInfo::IsL0ScoreAbove1() { +bool VersionStorageInfo::IsL0Score1AndAbove() { if (!finalized_) { return false; } for (size_t i = 0; i < compaction_level_.size(); i++) { if (compaction_level_[i] == 0) { - return compaction_score_[i] > 1; + return compaction_score_[i] >= 1; } } return false; diff --git a/db/version_set.h b/db/version_set.h index d1e29adfb..474cc9d76 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -609,7 +609,7 @@ class VersionStorageInfo { return bottommost_files_mark_threshold_; } - bool IsL0ScoreAbove1(); + bool IsL0Score1AndAbove(); // Returns whether any key in [`smallest_key`, `largest_key`] could appear in // an older L0 file than `last_l0_idx` or in a greater level than `last_level`