From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5270464F62 for ; Tue, 21 Jul 2020 15:03:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 48D5718D4E for ; Tue, 21 Jul 2020 15:03:55 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BFF9E18D44 for ; Tue, 21 Jul 2020 15:03:54 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8B1D240B01 for ; Tue, 21 Jul 2020 15:03:54 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Tue, 21 Jul 2020 15:03:35 +0200 Message-Id: <20200721130337.934653-5-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200721130337.934653-1-f.gruenbichler@proxmox.com> References: <20200721130337.934653-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.077 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [pull.rs] Subject: [pbs-devel] [PATCH proxmox-backup 4/6] fix #2865: detect and skip vanished snapshots X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2020 13:03:55 -0000 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 --- Notes: there is probably a more elegant ways to do this? src/client/pull.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/client/pull.rs b/src/client/pull.rs index bbe01969..421260a3 100644 --- a/src/client/pull.rs +++ b/src/client/pull.rs @@ -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::() { + 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()?; -- 2.20.1