From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id BFC4A1FF13E for ; Fri, 17 Apr 2026 11:27:26 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 60CCD1C115; Fri, 17 Apr 2026 11:27:15 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v6 09/15] sync: pull: prepare pull parameters to be shared across parallel tasks Date: Fri, 17 Apr 2026 11:26:15 +0200 Message-ID: <20260417092621.455374-10-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260417092621.455374-1-c.ebner@proxmox.com> References: <20260417092621.455374-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1776417914423 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.070 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: CW3XWN6UNQGOUO7FQVFGMUH2HA4PV5UN X-Message-ID-Hash: CW3XWN6UNQGOUO7FQVFGMUH2HA4PV5UN X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- changes since version 5: - no changes 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 7126a5102..5beca6b8d 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -380,7 +380,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, reader: Arc, snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, @@ -558,7 +558,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, reader: Arc, snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, @@ -616,7 +616,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, source_namespace: &BackupNamespace, group: &BackupGroup, progress: &mut StoreProgress, @@ -797,7 +797,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(), @@ -985,6 +985,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result Result { errors |= ns_errors; @@ -1053,7 +1054,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result, group: &BackupGroup, namespace: &BackupNamespace, target_namespace: &BackupNamespace, @@ -1105,7 +1106,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, ) -> Result<(StoreProgress, SyncStats, bool), Error> { let list: Vec = params.source.list_groups(namespace, ¶ms.owner).await?; @@ -1139,7 +1140,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