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 86C0D1FF136 for ; Mon, 09 Mar 2026 17:22:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BFA893E65; Mon, 9 Mar 2026 17:22:04 +0100 (CET) From: Christian Ebner 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 Message-ID: <20260309162050.1047341-7-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309162050.1047341-1-c.ebner@proxmox.com> References: <20260309162050.1047341-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: 1773073229057 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 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: YGJLS7GP4SLYI734RCYBBPQOW4WM63NN X-Message-ID-Hash: YGJLS7GP4SLYI734RCYBBPQOW4WM63NN 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 --- 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, reader: Arc, snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, @@ -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, reader: Arc, snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, @@ -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, 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 Result { errors |= ns_errors; @@ -1050,7 +1051,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result, 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, ) -> Result<(StoreProgress, SyncStats, bool), Error> { let list: Vec = 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