From 47e4063400cb963df8d00887f7ac7fb9872bab7b Mon Sep 17 00:00:00 2001 From: ArcueidType <981354012@qq.com> Date: Wed, 6 Nov 2024 21:43:22 +0800 Subject: [PATCH] simplify SetOtherInputs --- db/version_set.cc | 8 ++++---- db/version_set.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index afe3f68..a9f16ed 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1298,7 +1298,7 @@ Compaction* VersionSet::PickCompaction() { assert(!c->inputs_[0].empty()); } - SetupOtherInputs(c, false); + SetupOtherInputs(c); return c; } @@ -1382,7 +1382,7 @@ void AddBoundaryInputs(const InternalKeyComparator& icmp, } } -void VersionSet::SetupOtherInputs(Compaction* c, bool is_last_level) { +void VersionSet::SetupOtherInputs(Compaction* c) { const int level = c->level(); InternalKey smallest, largest; @@ -1390,7 +1390,7 @@ void VersionSet::SetupOtherInputs(Compaction* c, bool is_last_level) { GetRange(c->inputs_[0], &smallest, &largest); // TTL: manual compaction for last level shouldn't have inputs[1] - if (!is_last_level) { + if (!c->is_last_level()) { current_->GetOverlappingInputs(level + 1, &smallest, &largest, &c->inputs_[1]); AddBoundaryInputs(icmp_, current_->files_[level + 1], &c->inputs_[1]); @@ -1477,7 +1477,7 @@ Compaction* VersionSet::CompactRange(int level, const InternalKey* begin, c->input_version_ = current_; c->input_version_->Ref(); c->inputs_[0] = inputs; - SetupOtherInputs(c, is_last_level); + SetupOtherInputs(c); return c; } diff --git a/db/version_set.h b/db/version_set.h index 21c20f5..e23c558 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -286,7 +286,7 @@ class VersionSet { const std::vector& inputs2, InternalKey* smallest, InternalKey* largest); - void SetupOtherInputs(Compaction* c, bool is_last_level); + void SetupOtherInputs(Compaction* c); // Save current contents to *log Status WriteSnapshot(log::Writer* log);