From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BA1291FF0C2 for ; Thu, 03 Dec 2026 16:05:25 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 65CEA2180C; Thu, 03 Dec 2026 16:05:12 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH v2 proxmox-backup 2/9] server: pull: defer sync stats instantiation until needed Date: Thu, 3 Dec 2026 16:04:41 +0100 Message-ID: <20261203150448.412515-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261203150448.412515-1-c.ebner@proxmox.com> References: <20261203150448.412515-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796310300731 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.335 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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 Message-ID-Hash: RBWOCN4MVIA47T25EZY642WKH2DLKTPO X-Message-ID-Hash: RBWOCN4MVIA47T25EZY642WKH2DLKTPO X-MailFrom: c.ebner@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: Instead of creating the instance of SyncStats right away during snapshot pull, defer it until it is actually required. This will reduce changes required to decouple the manifest loading and change checks from the rest of the snapshot sync in subsequent changes. Signed-off-by: Christian Ebner --- src/server/pull.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index 6d282ad21..c97ed9cc6 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -631,7 +631,6 @@ async fn pull_snapshot<'a>( ) -> Result, Error> { let prefix = snapshot.backup_time_string().to_owned(); - let mut sync_stats = SyncStats::default(); let manifest_name = snapshot.full_archive_path(&MANIFEST_BLOB_NAME); let client_log_name = snapshot.full_archive_path(&CLIENT_LOG_BLOB_NAME); @@ -727,7 +726,7 @@ async fn pull_snapshot<'a>( // requires no decryption since either none or both, source and target are encrypted fetch_log(None).await?; cleanup().await?; - return Ok(Some(sync_stats)); // nothing changed + return Ok(Some(SyncStats::default())); // nothing changed } Some(existing_manifest) @@ -770,10 +769,11 @@ async fn pull_snapshot<'a>( // nothing changed fetch_log(crypt_config).await?; cleanup().await?; - return Ok(Some(sync_stats)); + return Ok(Some(SyncStats::default())); } }; + let mut sync_stats = SyncStats::default(); let mut archives_pulled = false; for item in manifest.files() { let path = snapshot.full_archive_path(&item.filename); -- 2.47.3