From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D646B1FF0C2 for ; Thu, 03 Dec 2026 16:05:17 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 38C96217CD; Thu, 03 Dec 2026 16:05:11 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH v2 proxmox-backup 9/9] server: pull: skip exclusive lock when source has no client log Date: Thu, 3 Dec 2026 16:04:48 +0100 Message-ID: <20261203150448.412515-10-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261203150448.412515-1-c.ebner@proxmox.com> References: <20261203150448.412515-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: 1796310302459 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.332 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: 7QFWZSTWKTLAEOTKGC45VXRALECYJKZM X-Message-ID-Hash: 7QFWZSTWKTLAEOTKGC45VXRALECYJKZM 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: Check from the source snapshot listing whether a client log exists on the source and pass that into pull_snapshot_from(). Unchanged snapshots without a client log on the source no longer need to acquire an exclusive lock just to find out there is actually no client log available on the source. Signed-off-by: Christian Ebner --- src/server/pull.rs | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index ae780d0db..f36ae305b 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -800,6 +800,7 @@ async fn check_snapshot_under_shared_lock<'a>( reader: Arc, snapshot: &'a pbs_datastore::BackupDir, _shared_lock: BackupLockGuard, + source_has_client_log: bool, log_sender: Arc, ) -> Result>, Error> { let prefix = snapshot.backup_time_string().to_owned(); @@ -860,7 +861,7 @@ async fn check_snapshot_under_shared_lock<'a>( ) }; - if unchanged && client_log_name.exists() { + if unchanged && (client_log_name.exists() || !source_has_client_log) { log_sender .log(Level::INFO, format!("{prefix}: no data changes")) .await?; @@ -1219,6 +1220,7 @@ async fn pull_snapshot_from<'a>( snapshot: &'a pbs_datastore::BackupDir, encountered_chunks: Arc>, corrupt: bool, + source_has_client_log: bool, log_sender: Arc, ) -> Result { let prefix = snapshot.backup_time_string().to_string(); @@ -1241,6 +1243,7 @@ async fn pull_snapshot_from<'a>( Arc::clone(&reader), snapshot, shared_lock, + source_has_client_log, Arc::clone(&log_sender), ) .await? @@ -1368,8 +1371,9 @@ async fn pull_group( .unwrap_or(i64::MIN); // Filter remote BackupDirs to include in pull - // Also stores if the snapshot is corrupt (verification job failed) - let list: Vec<(BackupDir, bool)> = raw_list + // Also stores if the snapshot is corrupt (verification job failed) and if the source has a + // client log + let list: Vec<(BackupDir, bool, bool)> = raw_list .into_iter() .filter_map(|item| { if exclude_not_verified_or_encrypted(&item, params.verified_only, params.encrypted_only) @@ -1377,6 +1381,10 @@ async fn pull_group( return None; } + let has_client_log = item + .files + .iter() + .any(|file| file.filename == CLIENT_LOG_BLOB_NAME.as_ref()); let dir = item.backup; source_snapshots.insert(dir.time); // If resync_corrupt is set, check if the corresponding local snapshot failed to @@ -1391,7 +1399,7 @@ async fn pull_group( match local_dir.verify_state() { Ok(Some(state)) => { if state == VerifyState::Failed { - return Some((dir, true)); + return Some((dir, true, has_client_log)); } } Ok(None) => { @@ -1401,13 +1409,13 @@ async fn pull_group( Err(_) => { // There was an error loading the manifest, probably better if we // resync. - return Some((dir, true)); + return Some((dir, true, has_client_log)); } } } } } - Some((dir, false)) + Some((dir, false, has_client_log)) }) .collect(); @@ -1417,12 +1425,12 @@ async fn pull_group( .map(|count| total_amount.saturating_sub(count)) .unwrap_or_default(); - let list: Vec<(BackupDir, bool)> = list + let list: Vec<(BackupDir, bool, bool)> = list .into_iter() .enumerate() - .filter_map(|(pos, (dir, needs_resync))| { + .filter_map(|(pos, (dir, needs_resync, has_client_log))| { if params.resync_corrupt && needs_resync { - return Some((dir, needs_resync)); + return Some((dir, needs_resync, has_client_log)); } // 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 @@ -1435,7 +1443,7 @@ async fn pull_group( transfer_last_skip_info.update(dir.time); return None; } - Some((dir, needs_resync)) + Some((dir, needs_resync, has_client_log)) }) .collect(); @@ -1530,7 +1538,7 @@ async fn pull_group( let mut sync_stats = SyncStats::default(); - for (pos, (from_snapshot, corrupt)) in list.into_iter().enumerate() { + for (pos, (from_snapshot, corrupt, source_has_client_log)) in list.into_iter().enumerate() { let to_snapshot = params .target .store @@ -1546,6 +1554,7 @@ async fn pull_group( &to_snapshot, encountered_chunks.clone(), corrupt, + source_has_client_log, Arc::clone(&log_sender), ) .await; -- 2.47.3