Skip to content

Commit

Permalink
fix(compaction): support having no backups yet
Browse files Browse the repository at this point in the history
  • Loading branch information
graelo committed Aug 18, 2022
1 parent 2eb2820 commit 0ac1b2a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/management/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Strategy {
pub fn plan<'a>(&self, backups: &'a [Backup]) -> Plan<'a> {
match self {
Strategy::KeepMostRecent { k } => {
let k = std::cmp::min(backups.len(), *k);
let index = std::cmp::max(0, backups.len() - k);
let (outdated_backups, recent_backups) = backups.split_at(index);

Expand Down

0 comments on commit 0ac1b2a

Please sign in to comment.