From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v5 08/11] sync: push: prepare push parameters to be shared across parallel tasks
Date: Mon, 9 Mar 2026 17:20:47 +0100 [thread overview]
Message-ID: <20260309162050.1047341-10-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260309162050.1047341-1-c.ebner@proxmox.com>
When performing parallel group syncs, the push 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/push.rs | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/server/push.rs b/src/server/push.rs
index a0484ef62..5828f2ed1 100644
--- a/src/server/push.rs
+++ b/src/server/push.rs
@@ -404,6 +404,7 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
let (mut groups, mut snapshots) = (0, 0);
let mut stats = SyncStats::default();
+ let params = Arc::new(params);
for source_namespace in &source_namespaces {
let source_store_and_ns = print_store_and_ns(params.source.store.name(), source_namespace);
let target_namespace = params.map_to_target(source_namespace)?;
@@ -427,7 +428,7 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
continue;
}
- match push_namespace(source_namespace, ¶ms).await {
+ match push_namespace(source_namespace, Arc::clone(¶ms)).await {
Ok((sync_progress, sync_stats, sync_errors)) => {
errors |= sync_errors;
stats.add(sync_stats);
@@ -522,11 +523,11 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
/// Iterate over all backup groups in the namespace and push them to the target.
pub(crate) async fn push_namespace(
namespace: &BackupNamespace,
- params: &PushParameters,
+ params: Arc<PushParameters>,
) -> Result<(StoreProgress, SyncStats, bool), Error> {
let target_namespace = params.map_to_target(namespace)?;
// Check if user is allowed to perform backups on remote datastore
- check_ns_remote_datastore_privs(params, &target_namespace, PRIV_REMOTE_DATASTORE_BACKUP)
+ check_ns_remote_datastore_privs(¶ms, &target_namespace, PRIV_REMOTE_DATASTORE_BACKUP)
.context("Pushing to remote namespace not allowed")?;
let mut list: Vec<BackupGroup> = params
@@ -554,7 +555,7 @@ pub(crate) async fn push_namespace(
let mut stats = SyncStats::default();
let (owned_target_groups, not_owned_target_groups) =
- fetch_target_groups(params, &target_namespace).await?;
+ fetch_target_groups(¶ms, &target_namespace).await?;
for (done, group) in list.into_iter().enumerate() {
progress.done_groups = done as u64;
@@ -570,7 +571,7 @@ pub(crate) async fn push_namespace(
}
synced_groups.insert(group.clone());
- match push_group(params, namespace, &group, &mut progress).await {
+ match push_group(Arc::clone(¶ms), namespace, &group, &mut progress).await {
Ok(sync_stats) => stats.add(sync_stats),
Err(err) => {
warn!("Encountered errors: {err:#}");
@@ -590,7 +591,7 @@ pub(crate) async fn push_namespace(
continue;
}
- match remove_target_group(params, &target_namespace, &target_group).await {
+ match remove_target_group(¶ms, &target_namespace, &target_group).await {
Ok(delete_stats) => {
info!("Removed vanished group {target_group} from remote");
if delete_stats.protected_snapshots() > 0 {
@@ -672,7 +673,7 @@ async fn forget_target_snapshot(
/// - Iterate the snapshot list and push each snapshot individually
/// - (Optional): Remove vanished groups if `remove_vanished` flag is set
pub(crate) async fn push_group(
- params: &PushParameters,
+ params: Arc<PushParameters>,
namespace: &BackupNamespace,
group: &BackupGroup,
progress: &mut StoreProgress,
@@ -691,7 +692,7 @@ pub(crate) async fn push_group(
}
let target_namespace = params.map_to_target(namespace)?;
- let mut target_snapshots = fetch_target_snapshots(params, &target_namespace, group).await?;
+ let mut target_snapshots = fetch_target_snapshots(¶ms, &target_namespace, group).await?;
target_snapshots.sort_unstable_by_key(|a| a.backup.time);
let last_snapshot_time = target_snapshots
@@ -748,8 +749,13 @@ pub(crate) async fn push_group(
let mut stats = SyncStats::default();
let mut fetch_previous_manifest = !target_snapshots.is_empty();
for (pos, source_snapshot) in snapshots.into_iter().enumerate() {
- let result =
- push_snapshot(params, namespace, &source_snapshot, fetch_previous_manifest).await;
+ let result = push_snapshot(
+ ¶ms,
+ namespace,
+ &source_snapshot,
+ fetch_previous_manifest,
+ )
+ .await;
fetch_previous_manifest = true;
progress.done_snapshots = pos as u64 + 1;
@@ -772,7 +778,7 @@ pub(crate) async fn push_group(
);
continue;
}
- match forget_target_snapshot(params, &target_namespace, &snapshot.backup).await {
+ match forget_target_snapshot(¶ms, &target_namespace, &snapshot.backup).await {
Ok(()) => {
info!(
"Removed vanished snapshot {name} from remote",
--
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 ` [PATCH proxmox-backup v5 05/11] sync: pull: prepare pull parameters to be shared across parallel tasks Christian Ebner
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 ` Christian Ebner [this message]
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-10-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.