Skip to content

Commit

Permalink
Start timer when L0 score is 1 and greater.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval-Ariel committed Mar 7, 2024
1 parent 4506ef9 commit f1230f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion db/column_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion db/version_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit f1230f9

Please sign in to comment.