sync: pull: skip local client log fetch when source lacks one

LocalSourceReader::try_fetch_client_log() bubbles up ENOENT from the
underlying std::fs::read() in load_file_into() if the source snapshot
has no client.log.blob, which the caller in pull_snapshot()
propagates via `?`, aborting the snapshot pull. Many snapshots
legitimately lack a log (VM backups, scheduled API jobs, older
clients), so this breaks local sync for them.

Match the remote reader's intentional best-effort behavior ("be
silent if there is no log") by checking up front whether the source
file is present and returning Ok(()) without touching the
destination if not. As a side benefit, this avoids the empty
client.log.blob that load_file_into() would otherwise leave behind
through its O_CREAT|O_TRUNC open.

Fixes: c456d58a4 ("sync: fix client log fetching for local sync job")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2026-04-25 18:12:11 +02:00
parent e5b1911092
commit 68668ba533

View File

@ -262,9 +262,13 @@ impl SyncSourceReader for LocalSourceReader {
crypt_config: Option<Arc<CryptConfig>>,
log_sender: Arc<LogLineSender>,
) -> Result<(), Error> {
let mut from_path = self.dir.full_path();
from_path.push(CLIENT_LOG_BLOB_NAME.as_ref());
// be silent if there is no log, matching the remote source reader's behavior
if !from_path.exists() {
return Ok(());
}
if let Some(crypt_config) = &crypt_config {
let mut from_path = self.dir.full_path();
from_path.push(CLIENT_LOG_BLOB_NAME.as_ref());
let blob_file = tokio::fs::File::open(from_path).await?;
let blob_file = blob_file.into_std().await;
let (_csum, _size) = decrypt_encrypted_data_blob(