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 798291FF0C2 for ; Thu, 03 Dec 2026 16:05:20 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C55C4217DE; Thu, 03 Dec 2026 16:05:11 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH v2 proxmox-backup 1/9] server: pull: refactor snapshot sync start logging Date: Thu, 3 Dec 2026 16:04:40 +0100 Message-ID: <20261203150448.412515-2-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: 1796310300491 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.334 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: WVQZIR2VS67KVI5CSCAT2YYAS7R5ES5M X-Message-ID-Hash: WVQZIR2VS67KVI5CSCAT2YYAS7R5ES5M 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: Move the initial start/re-sync log lines from pull_snapshot() up to pull_snapshot_from() which allows to drop `is_new` as function parameter and simplify the code by only doing the log line formatting in the respective branches. No functional changes. Signed-off-by: Christian Ebner --- src/server/pull.rs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index 763fdb5d3..6d282ad21 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -627,26 +627,9 @@ async fn pull_snapshot<'a>( snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, corrupt: bool, - is_new: bool, log_sender: Arc, ) -> Result, Error> { let prefix = snapshot.backup_time_string().to_owned(); - if is_new { - log_sender - .log(Level::INFO, format!("{prefix}: start sync")) - .await?; - } else if corrupt { - log_sender - .log( - Level::INFO, - format!("re-sync snapshot {prefix} due to corruption"), - ) - .await?; - } else { - log_sender - .log(Level::INFO, format!("re-sync snapshot {prefix}")) - .await?; - } let mut sync_stats = SyncStats::default(); let manifest_name = snapshot.full_archive_path(&MANIFEST_BLOB_NAME); @@ -1120,13 +1103,21 @@ async fn pull_snapshot_from<'a>( .create_locked_backup_dir(snapshot.backup_ns(), snapshot.as_ref()) .context(prefix.clone())?; + let log_message = if is_new { + format!("{prefix}: start sync") + } else if corrupt { + format!("re-sync snapshot {prefix} due to corruption") + } else { + format!("re-sync snapshot {prefix}") + }; + log_sender.log(Level::INFO, log_message).await?; + let result = pull_snapshot( params, reader, snapshot, encountered_chunks, corrupt, - is_new, Arc::clone(&log_sender), ) .await; -- 2.47.3