From a455e7d969231577b60e2e10866c102441d613d2 Mon Sep 17 00:00:00 2001 From: marvin-j97 Date: Sat, 26 Oct 2024 20:49:10 +0200 Subject: [PATCH] gc: don't take blobs with 0% staleness into account --- src/gc/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gc/mod.rs b/src/gc/mod.rs index 05670fd..6b23414 100644 --- a/src/gc/mod.rs +++ b/src/gc/mod.rs @@ -40,7 +40,7 @@ impl GcStrategy for StaleThresholdStrategy { .read() .expect("lock is poisoned") .values() - .filter(|x| x.stale_ratio() >= self.0) + .filter(|x| x.stale_ratio() > self.0) .map(|x| x.id) .collect::>() } @@ -79,7 +79,11 @@ impl GcStrategy for SpaceAmpStrategy { .segments .read() .expect("lock is poisoned"); - let mut segments = lock.values().collect::>(); + + let mut segments = lock + .values() + .filter(|x| x.stale_ratio() > 0.0) + .collect::>(); // Sort by stale ratio descending segments.sort_by(|a, b| {