sync: fix client log fetching for local sync job

Pulling with a local sync job currently does not handle fetching the
client log correctly, completely lacking the implementation.

Fix this by adding the missing implementation on the local source
reader.

Since this does not actually download anything, also rename the
method from try_download_client_log() to a now better fitting
try_fetch_client_log().

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Link: https://lore.proxmox.com/20260425140927.928214-2-c.ebner@proxmox.com
This commit is contained in:
Christian Ebner 2026-04-25 16:09:25 +02:00 committed by Thomas Lamprecht
parent beafc2f0b0
commit c456d58a42
2 changed files with 7 additions and 5 deletions

View File

@ -679,7 +679,7 @@ async fn pull_snapshot<'a>(
let fetch_log = async || {
if !client_log_name.exists() {
reader
.try_download_client_log(&client_log_name)
.try_fetch_client_log(&client_log_name)
.await
.with_context(|| prefix.clone())?;
if client_log_name.exists() {

View File

@ -103,8 +103,8 @@ pub(crate) trait SyncSourceReader: Send + Sync {
/// `into` is the path of the local file to load the source file into.
async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error>;
/// Tries to download the client log from the source and save it into a local file.
async fn try_download_client_log(&self, to_path: &Path) -> Result<(), Error>;
/// Tries to fetch the client log from the source and save it into a local file.
async fn try_fetch_client_log(&self, to_path: &Path) -> Result<(), Error>;
fn skip_chunk_sync(&self, target_store_name: &str) -> bool;
}
@ -168,7 +168,7 @@ impl SyncSourceReader for RemoteSourceReader {
Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
}
async fn try_download_client_log(&self, to_path: &Path) -> Result<(), Error> {
async fn try_fetch_client_log(&self, to_path: &Path) -> Result<(), Error> {
let mut tmp_path = to_path.to_owned();
tmp_path.set_extension("tmp");
@ -229,7 +229,9 @@ impl SyncSourceReader for LocalSourceReader {
Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
}
async fn try_download_client_log(&self, _to_path: &Path) -> Result<(), Error> {
async fn try_fetch_client_log(&self, to_path: &Path) -> Result<(), Error> {
self.load_file_into(CLIENT_LOG_BLOB_NAME.as_ref(), to_path)
.await?;
Ok(())
}