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 2/9] server: pull: defer sync stats instantiation until needed
Date: Thu,  3 Dec 2026 16:04:41 +0100	[thread overview]
Message-ID: <20261203150448.412515-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20261203150448.412515-1-c.ebner@proxmox.com>

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 <c.ebner@proxmox.com>
---
 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<Option<SyncStats>, 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





  parent 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 ` [PATCH v2 proxmox-backup 1/9] server: pull: refactor snapshot sync start logging Christian Ebner
2026-12-03 15:04 ` Christian Ebner [this message]
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-3-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