[PATCH proxmox-backup v6 07/15] sync: pull: revert avoiding reinstantiation for encountered chunks map

Christian Ebner
2026-04-17T09:26:43Z

While keeping a store wide instance to avoid reinstantiation on each
group is desired when iteratively processing groups, this cannot work
when performing the sync of multiple groups in parallel.

This is in preparation for parallel group syncs and reverts commit
ecdec5bc ("sync: pull: avoid reinstantiation for encountered chunks
map").

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 5:
- no changes

src/server/pull.rs | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index ca17eb243..45fe9f8b1 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -620,7 +620,6 @@ async fn pull_group(
source_namespace: &BackupNamespace,
group: &BackupGroup,
progress: &mut StoreProgress,
- encountered_chunks: Arc<Mutex<EncounteredChunks>>,
) -> Result<SyncStats, Error> {
let mut already_synced_skip_info = SkipInfo::new(SkipReason::AlreadySynced);
let mut transfer_last_skip_info = SkipInfo::new(SkipReason::TransferLast);
@@ -721,6 +720,9 @@ async fn pull_group(
transfer_last_skip_info.reset();
}

+ // start with 65536 chunks (up to 256 GiB)
+ let encountered_chunks = Arc::new(Mutex::new(EncounteredChunks::with_capacity(1024 * 64)));
+
let backup_group = params
.target
.store
@@ -984,9 +986,6 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
let mut synced_ns = HashSet::with_capacity(namespaces.len());
let mut sync_stats = SyncStats::default();

- // start with 65536 chunks (up to 256 GiB)
- let encountered_chunks = Arc::new(Mutex::new(EncounteredChunks::with_capacity(1024 * 64)));
-
for namespace in namespaces {
let source_store_ns_str = print_store_and_ns(params.source.get_store(), &namespace);

@@ -1008,7 +1007,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
}
}

- match pull_ns(&namespace, &mut params, encountered_chunks.clone()).await {
+ match pull_ns(&namespace, &mut params).await {
Ok((ns_progress, ns_sync_stats, ns_errors)) => {
errors |= ns_errors;

@@ -1066,7 +1065,6 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
async fn pull_ns(
namespace: &BackupNamespace,
params: &mut PullParameters,
- encountered_chunks: Arc<Mutex<EncounteredChunks>>,
) -> Result<(StoreProgress, SyncStats, bool), Error> {
let list: Vec<BackupGroup> = params.source.list_groups(namespace, &params.owner).await?;

@@ -1125,16 +1123,7 @@ async fn pull_ns(
);
errors = true; // do not stop here, instead continue
} else {
- encountered_chunks.lock().unwrap().clear();
- match pull_group(
- params,
- namespace,
- &group,
- &mut progress,
- encountered_chunks.clone(),
- )
- .await
- {
+ match pull_group(params, namespace, &group, &mut progress).await {
Ok(stats) => sync_stats.add(stats),
Err(err) => {
info!("sync group {} failed - {err:#}", &group);
@@ -1255,9 +1244,4 @@ impl EncounteredChunks {
}
}
}
-
- /// Clear all entries
- fn clear(&mut self) {
- self.chunk_set.clear();
- }
}
--
2.47.3