From 343392613ddf93ad2150bcd8281ba20f0e72c179 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 27 Oct 2021 13:22:31 +0200 Subject: [PATCH] pull_store/group: dont try remove locally protected snapshots and log if a vanished groups could not be completely deleted if it contains protected snapshots Signed-off-by: Dominik Csapak Signed-off-by: Wolfgang Bumiller --- src/server/pull.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index a15d3bb5..555f0a94 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -605,6 +605,14 @@ pub async fn pull_group( if remote_snapshots.contains(&backup_time) { continue; } + if info.backup_dir.is_protected(tgt_store.base_path()) { + task_log!( + worker, + "don't delete vanished snapshot {:?} (protected)", + info.backup_dir.relative_path() + ); + continue; + } task_log!(worker, "delete vanished snapshot {:?}", info.backup_dir.relative_path()); tgt_store.remove_backup_dir(&info.backup_dir, false)?; } @@ -719,9 +727,15 @@ pub async fn pull_store( local_group.backup_type(), local_group.backup_id() ); - if let Err(err) = tgt_store.remove_backup_group(&local_group) { - task_log!(worker, "{}", err.to_string()); - errors = true; + match tgt_store.remove_backup_group(&local_group) { + Ok(true) => {}, + Ok(false) => { + task_log!(worker, "kept some protected snapshots of group '{}'", local_group); + }, + Err(err) => { + task_log!(worker, "{}", err); + errors = true; + } } } Ok(())