Skip to content

Commit

Permalink
gc: don't take blobs with 0% staleness into account
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Oct 26, 2024
1 parent e758201 commit a455e7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<C: Compressor + Clone> GcStrategy<C> 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::<Vec<_>>()
}
Expand Down Expand Up @@ -79,7 +79,11 @@ impl<C: Compressor + Clone> GcStrategy<C> for SpaceAmpStrategy {
.segments
.read()
.expect("lock is poisoned");
let mut segments = lock.values().collect::<Vec<_>>();

let mut segments = lock
.values()
.filter(|x| x.stale_ratio() > 0.0)
.collect::<Vec<_>>();

// Sort by stale ratio descending
segments.sort_by(|a, b| {
Expand Down

0 comments on commit a455e7d

Please sign in to comment.