]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix #2865: detect and skip vanished snapshots
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 21 Jul 2020 13:03:35 +0000 (15:03 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 22 Jul 2020 07:19:29 +0000 (09:19 +0200)
also when they have been removed/forgotten since we retrieved the
snapshot list for the currently syncing backup group.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/client/pull.rs

index bbe019692ff311a8128a039af4db80a1df48c41b..421260a3b0b2e4c78af96ddad10f419b067343e9 100644 (file)
@@ -7,6 +7,7 @@ use std::sync::Arc;
 use std::collections::HashMap;
 use std::io::{Seek, SeekFrom};
 
+use proxmox::api::error::{StatusCode, HttpError};
 use crate::server::{WorkerTask};
 use crate::backup::*;
 use crate::api2::types::*;
@@ -151,7 +152,28 @@ async fn pull_snapshot(
     let mut tmp_manifest_name = manifest_name.clone();
     tmp_manifest_name.set_extension("tmp");
 
-    let mut tmp_manifest_file = download_manifest(&reader, &tmp_manifest_name).await?;
+    let download_res = download_manifest(&reader, &tmp_manifest_name).await;
+    let mut tmp_manifest_file = match download_res {
+        Ok(manifest_file) => manifest_file,
+        Err(err) => {
+            match err.downcast_ref::<HttpError>() {
+                Some(HttpError { code, message }) => {
+                    match code {
+                        &StatusCode::NOT_FOUND => {
+                            worker.log(format!("skipping snapshot {} - vanished since start of sync", snapshot));
+                            return Ok(());
+                        },
+                        _ => {
+                            bail!("HTTP error {} - {}", code, message);
+                        },
+                    }
+                },
+                None => {
+                    return Err(err);
+                },
+            };
+        },
+    };
     let tmp_manifest_blob = DataBlob::load(&mut tmp_manifest_file)?;
     tmp_manifest_blob.verify_crc()?;