public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
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	[thread overview]
Message-ID: <20261203150448.412515-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20261203150448.412515-1-c.ebner@proxmox.com>

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 <c.ebner@proxmox.com>
---
 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<Mutex<EncounteredChunks>>,
     corrupt: bool,
-    is_new: bool,
     log_sender: Arc<LogLineSender>,
 ) -> Result<Option<SyncStats>, 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





  reply	other threads:[~2026-12-03 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:04 [PATCH v2 proxmox-backup 0/9] pull: avoid lock contention with verify on unchanged snapshots Christian Ebner
2026-12-03 15:04 ` Christian Ebner [this message]
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 2/9] server: pull: defer sync stats instantiation until needed Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 3/9] server: pull: load source manifest into memory instead of a temp file Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 4/9] server: pull: move target manifest loading logic into reusable helper Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 5/9] server: pull: decouple decryption key gathering from logging Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 6/9] pbs-datastore: add BackupDir::lock_with_timeout() Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 7/9] pbs-datastore: add create_locked_backup_dir_with_timeout() Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 8/9] server: pull: check for unchanged snapshots under a shared lock Christian Ebner
2026-12-03 15:04 ` [PATCH v2 proxmox-backup 9/9] server: pull: skip exclusive lock when source has no client log Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203150448.412515-2-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal