From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/5] pull: refactor source snapshot list filtering logic
Date: Fri, 16 May 2025 13:54:28 +0200 [thread overview]
Message-ID: <20250516115429.208563-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250516115429.208563-1-c.ebner@proxmox.com>
In preparation for filter based on the snapshot's verify and
encryption state before applying the transfer last cutoff.
This will allow to correctly use the transfer last filter on the
correspondingly prefiltered items only.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
src/server/pull.rs | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/server/pull.rs b/src/server/pull.rs
index 832ee1b85..53de74f19 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -547,13 +547,6 @@ async fn pull_group(
.await?;
raw_list.sort_unstable_by(|a, b| a.backup.time.cmp(&b.backup.time));
- let total_amount = raw_list.len();
-
- let cutoff = params
- .transfer_last
- .map(|count| total_amount.saturating_sub(count))
- .unwrap_or_default();
-
let target_ns = source_namespace.map_prefix(¶ms.source.get_ns(), ¶ms.target.ns)?;
let mut source_snapshots = HashSet::new();
@@ -567,8 +560,7 @@ async fn pull_group(
// Also stores if the snapshot is corrupt (verification job failed)
let list: Vec<(BackupDir, bool)> = raw_list
.into_iter()
- .enumerate()
- .filter_map(|(pos, item)| {
+ .filter_map(|item| {
let dir = item.backup;
source_snapshots.insert(dir.time);
@@ -600,6 +592,20 @@ async fn pull_group(
}
}
}
+ Some((dir, false))
+ })
+ .collect();
+
+ let total_amount = list.len();
+ let cutoff = params
+ .transfer_last
+ .map(|count| total_amount.saturating_sub(count))
+ .unwrap_or_default();
+
+ let list: Vec<(BackupDir, bool)> = list
+ .into_iter()
+ .enumerate()
+ .filter_map(|(pos, (dir, verified))| {
// Note: the snapshot represented by `last_sync_time` might be missing its backup log
// or post-backup verification state if those were not yet available during the last
// sync run, always resync it
@@ -611,7 +617,7 @@ async fn pull_group(
transfer_last_skip_info.update(dir.time);
return None;
}
- Some((dir, false))
+ Some((dir, verified))
})
.collect();
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-05-16 11:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 11:54 [pbs-devel] [PATCH proxmox-backup 0/5] prefilter source list by verify state for sync jobs Christian Ebner
2025-05-16 11:54 ` [pbs-devel] [PATCH proxmox-backup 1/5] api: admin: refactor generation of backup dir for snapshot listing Christian Ebner
2025-05-16 11:54 ` [pbs-devel] [PATCH proxmox-backup 2/5] api: factor out helper converting backup info to snapshot list item Christian Ebner
2025-05-16 11:54 ` [pbs-devel] [PATCH proxmox-backup 3/5] sync: source: list snapshot items instead of backup directories Christian Ebner
2025-05-16 11:54 ` Christian Ebner [this message]
2025-05-16 11:54 ` [pbs-devel] [PATCH proxmox-backup 5/5] sync: conditionally pre-filter source list by verified or encrypted state 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=20250516115429.208563-5-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