From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 96B751FF148 for ; Mon, 27 Apr 2026 10:50:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 57DAD156E9; Mon, 27 Apr 2026 10:49:58 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup 1/3] sync: return File in load_file_into Date: Mon, 27 Apr 2026 10:49:47 +0200 Message-ID: <20260427084952.303245-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260427084952.303245-1-f.gruenbichler@proxmox.com> References: <20260427084952.303245-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777279700180 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: QHOB7YJ4RD6BL4BDJGDTAZL6VDTQTLLY X-Message-ID-Hash: QHOB7YJ4RD6BL4BDJGDTAZL6VDTQTLLY X-MailFrom: f.gruenbichler@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: since only manifests are valid blobs, indices are not. this also makes a CRC error manifest itself as error, instead of masking as "snapshot disappeared". Signed-off-by: Fabian Grünbichler --- src/server/pull.rs | 5 ++++- src/server/sync.rs | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index 42c34732f..020dbf508 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -653,7 +653,7 @@ async fn pull_snapshot<'a>( let mut tmp_manifest_name = manifest_name.clone(); tmp_manifest_name.set_extension("tmp"); - let Some(tmp_manifest_blob) = reader + let Some(mut tmp_manifest_file) = reader .load_file_into(MANIFEST_BLOB_NAME.as_ref(), &tmp_manifest_name) .await .with_context(|| prefix.clone())? @@ -661,6 +661,9 @@ async fn pull_snapshot<'a>( return Ok(sync_stats); }; + let tmp_manifest_blob = + DataBlob::load_from_reader(&mut tmp_manifest_file).with_context(|| prefix.clone())?; + let backend = ¶ms.target.backend; let fetch_log = async |crypt_config: Option>| { diff --git a/src/server/sync.rs b/src/server/sync.rs index 92449ff98..d0d3ab31a 100644 --- a/src/server/sync.rs +++ b/src/server/sync.rs @@ -106,7 +106,7 @@ pub(crate) trait SyncSourceReader: Send + Sync { /// Asynchronously loads a file from the source into a local file. /// `filename` is the name of the file to load from the source. /// `into` is the path of the local file to load the source file into. - async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error>; + async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error>; /// Tries to fetch the client log from the source and save it into a local file. async fn try_fetch_client_log( @@ -146,7 +146,7 @@ impl SyncSourceReader for RemoteSourceReader { Ok(Arc::new(chunk_reader)) } - async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error> { + async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error> { let mut tmp_file = std::fs::OpenOptions::new() .write(true) .create(true) @@ -174,7 +174,7 @@ impl SyncSourceReader for RemoteSourceReader { }; }; tmp_file.rewind()?; - Ok(DataBlob::load_from_reader(&mut tmp_file).ok()) + Ok(Some(tmp_file)) } async fn try_fetch_client_log( @@ -245,7 +245,7 @@ impl SyncSourceReader for LocalSourceReader { Ok(Arc::new(chunk_reader)) } - async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error> { + async fn load_file_into(&self, filename: &str, into: &Path) -> Result, Error> { let mut tmp_file = std::fs::OpenOptions::new() .write(true) .create(true) @@ -256,7 +256,7 @@ impl SyncSourceReader for LocalSourceReader { from_path.push(filename); tmp_file.write_all(std::fs::read(from_path)?.as_slice())?; tmp_file.rewind()?; - Ok(DataBlob::load_from_reader(&mut tmp_file).ok()) + Ok(Some(tmp_file)) } async fn try_fetch_client_log( -- 2.47.3