From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v5 05/11] sync: pull: prepare pull parameters to be shared across parallel tasks
Date: Mon, 9 Mar 2026 17:20:44 +0100 [thread overview]
Message-ID: <20260309162050.1047341-7-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260309162050.1047341-1-c.ebner@proxmox.com>
When performing parallel group syncs, the pull parameters must be
shared between all tasks which is not possible with regular
references due to lifetime and ownership issues. Pack them into an
atomic reference counter instead so they can easily be cloned when
required.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
src/server/pull.rs | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/server/pull.rs b/src/server/pull.rs
index c074c2b78..3d7d47b9c 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -377,7 +377,7 @@ async fn pull_single_archive<'a>(
/// -- if not, pull it from the remote
/// - Download log if not already existing
async fn pull_snapshot<'a>(
- params: &PullParameters,
+ params: Arc<PullParameters>,
reader: Arc<dyn SyncSourceReader + 'a>,
snapshot: &'a pbs_datastore::BackupDir,
encountered_chunks: Arc<Mutex<EncounteredChunks>>,
@@ -555,7 +555,7 @@ async fn pull_snapshot<'a>(
/// The `reader` is configured to read from the source backup directory, while the
/// `snapshot` is pointing to the local datastore and target namespace.
async fn pull_snapshot_from<'a>(
- params: &PullParameters,
+ params: Arc<PullParameters>,
reader: Arc<dyn SyncSourceReader + 'a>,
snapshot: &'a pbs_datastore::BackupDir,
encountered_chunks: Arc<Mutex<EncounteredChunks>>,
@@ -613,7 +613,7 @@ async fn pull_snapshot_from<'a>(
/// - remote snapshot access is checked by remote (twice: query and opening the backup reader)
/// - local group owner is already checked by pull_store
async fn pull_group(
- params: &PullParameters,
+ params: Arc<PullParameters>,
source_namespace: &BackupNamespace,
group: &BackupGroup,
progress: &mut StoreProgress,
@@ -794,7 +794,7 @@ async fn pull_group(
.reader(source_namespace, &from_snapshot)
.await?;
let result = pull_snapshot_from(
- params,
+ Arc::clone(¶ms),
reader,
&to_snapshot,
encountered_chunks.clone(),
@@ -982,6 +982,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
let (mut groups, mut snapshots) = (0, 0);
let mut synced_ns = HashSet::with_capacity(namespaces.len());
let mut sync_stats = SyncStats::default();
+ let params = Arc::new(params);
for namespace in namespaces {
let source_store_ns_str = print_store_and_ns(params.source.get_store(), &namespace);
@@ -1004,7 +1005,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
}
}
- match pull_ns(&namespace, &mut params).await {
+ match pull_ns(&namespace, Arc::clone(¶ms)).await {
Ok((ns_progress, ns_sync_stats, ns_errors)) => {
errors |= ns_errors;
@@ -1050,7 +1051,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
/// Get and exclusive lock on the backup group, check ownership matches
/// sync job owner and pull group contents.
async fn lock_and_pull_group(
- params: &PullParameters,
+ params: Arc<PullParameters>,
group: &BackupGroup,
namespace: &BackupNamespace,
target_namespace: &BackupNamespace,
@@ -1095,7 +1096,7 @@ async fn lock_and_pull_group(
/// - owner check for vanished groups done here
async fn pull_ns(
namespace: &BackupNamespace,
- params: &mut PullParameters,
+ params: Arc<PullParameters>,
) -> Result<(StoreProgress, SyncStats, bool), Error> {
let list: Vec<BackupGroup> = params.source.list_groups(namespace, ¶ms.owner).await?;
@@ -1129,7 +1130,15 @@ async fn pull_ns(
progress.done_snapshots = 0;
progress.group_snapshots = 0;
- match lock_and_pull_group(params, &group, &namespace, &target_ns, &mut progress).await {
+ match lock_and_pull_group(
+ Arc::clone(¶ms),
+ &group,
+ namespace,
+ &target_ns,
+ &mut progress,
+ )
+ .await
+ {
Ok(stats) => sync_stats.add(stats),
Err(_err) => errors = true,
}
--
2.47.3
next prev parent reply other threads:[~2026-03-09 16:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 16:20 [PATCH proxmox{,-backup} v5 00/12] fix #4182: concurrent group pull/push support for sync jobs Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox v5 1/1] pbs api types: add `worker-threads` to sync job config Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 01/11] client: backup writer: fix upload stats size and rate for push sync Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 02/11] api: config/sync: add optional `worker-threads` property Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 03/11] sync: pull: revert avoiding reinstantiation for encountered chunks map Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 04/11] sync: pull: factor out backup group locking and owner check Christian Ebner
2026-03-09 16:20 ` Christian Ebner [this message]
2026-03-09 16:20 ` [PATCH proxmox-backup v5 06/11] fix #4182: server: sync: allow pulling backup groups in parallel Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 07/11] server: pull: prefix log messages and add error context Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 08/11] sync: push: prepare push parameters to be shared across parallel tasks Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 09/11] server: sync: allow pushing groups concurrently Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 10/11] server: push: prefix log messages and add additional logging Christian Ebner
2026-03-09 16:20 ` [PATCH proxmox-backup v5 11/11] ui: expose group worker setting in sync job edit window 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=20260309162050.1047341-7-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.