public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling
@ 2026-04-27  8:49 Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 1/3] sync: return File in load_file_into Fabian Grünbichler
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2026-04-27  8:49 UTC (permalink / raw)
  To: pbs-devel

this series cleans up load_file_into by
- moving the File -> DataBlob conversion to the manifest variant call
  site
- moving the "skip snapshot" logging to the call site to allow using a
  LogLineSender

Fabian Grünbichler (3):
  sync: return File in load_file_into
  pull: do not allow archive fetching to return no archive
  pull: move logging of disappeared snapshots

 src/server/pull.rs | 19 ++++++++++++++++---
 src/server/sync.rs | 14 +++++---------
 2 files changed, 21 insertions(+), 12 deletions(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH proxmox-backup 1/3] sync: return File in load_file_into
  2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
@ 2026-04-27  8:49 ` Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 2/3] pull: do not allow archive fetching to return no archive Fabian Grünbichler
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2026-04-27  8:49 UTC (permalink / raw)
  To: pbs-devel

since only manifests are valid blobs, indices are not. this also makes a
CRC error manifest itself as error, instead of masking as "snapshot
disappeared".

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/server/pull.rs |  5 ++++-
 src/server/sync.rs | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 42c34732f..020dbf508 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -653,7 +653,7 @@ async fn pull_snapshot<'a>(
 
     let mut tmp_manifest_name = manifest_name.clone();
     tmp_manifest_name.set_extension("tmp");
-    let Some(tmp_manifest_blob) = reader
+    let Some(mut tmp_manifest_file) = reader
         .load_file_into(MANIFEST_BLOB_NAME.as_ref(), &tmp_manifest_name)
         .await
         .with_context(|| prefix.clone())?
@@ -661,6 +661,9 @@ async fn pull_snapshot<'a>(
         return Ok(sync_stats);
     };
 
+    let tmp_manifest_blob =
+        DataBlob::load_from_reader(&mut tmp_manifest_file).with_context(|| prefix.clone())?;
+
     let backend = &params.target.backend;
 
     let fetch_log = async |crypt_config: Option<Arc<CryptConfig>>| {
diff --git a/src/server/sync.rs b/src/server/sync.rs
index 92449ff98..d0d3ab31a 100644
--- a/src/server/sync.rs
+++ b/src/server/sync.rs
@@ -106,7 +106,7 @@ pub(crate) trait SyncSourceReader: Send + Sync {
     /// Asynchronously loads a file from the source into a local file.
     /// `filename` is the name of the file to load from the source.
     /// `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>;
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error>;
 
     /// Tries to fetch the client log from the source and save it into a local file.
     async fn try_fetch_client_log(
@@ -146,7 +146,7 @@ impl SyncSourceReader for RemoteSourceReader {
         Ok(Arc::new(chunk_reader))
     }
 
-    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error> {
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error> {
         let mut tmp_file = std::fs::OpenOptions::new()
             .write(true)
             .create(true)
@@ -174,7 +174,7 @@ impl SyncSourceReader for RemoteSourceReader {
             };
         };
         tmp_file.rewind()?;
-        Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
+        Ok(Some(tmp_file))
     }
 
     async fn try_fetch_client_log(
@@ -245,7 +245,7 @@ impl SyncSourceReader for LocalSourceReader {
         Ok(Arc::new(chunk_reader))
     }
 
-    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error> {
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error> {
         let mut tmp_file = std::fs::OpenOptions::new()
             .write(true)
             .create(true)
@@ -256,7 +256,7 @@ impl SyncSourceReader for LocalSourceReader {
         from_path.push(filename);
         tmp_file.write_all(std::fs::read(from_path)?.as_slice())?;
         tmp_file.rewind()?;
-        Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
+        Ok(Some(tmp_file))
     }
 
     async fn try_fetch_client_log(
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH proxmox-backup 2/3] pull: do not allow archive fetching to return no archive
  2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 1/3] sync: return File in load_file_into Fabian Grünbichler
@ 2026-04-27  8:49 ` Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 3/3] pull: move logging of disappeared snapshots Fabian Grünbichler
  2026-04-27  9:04 ` [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2026-04-27  8:49 UTC (permalink / raw)
  To: pbs-devel

allowing Ok(None) here only makes sense for manifests (where we can treat this
as a disappeared snapshot).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/server/pull.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 020dbf508..d7455c2ee 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -447,10 +447,14 @@ async fn pull_single_archive<'a>(
         .log(Level::INFO, format!("{archive_prefix}: sync archive"))
         .await?;
 
-    reader
+    if reader
         .load_file_into(archive_name, &tmp_path)
         .await
-        .with_context(|| archive_prefix.clone())?;
+        .with_context(|| archive_prefix.clone())?
+        .is_none()
+    {
+        bail!("Failed to load archive {archive_name}");
+    };
 
     let mut tmpfile = std::fs::OpenOptions::new()
         .read(true)
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH proxmox-backup 3/3] pull: move logging of disappeared snapshots
  2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 1/3] sync: return File in load_file_into Fabian Grünbichler
  2026-04-27  8:49 ` [PATCH proxmox-backup 2/3] pull: do not allow archive fetching to return no archive Fabian Grünbichler
@ 2026-04-27  8:49 ` Fabian Grünbichler
  2026-04-27  9:04 ` [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2026-04-27  8:49 UTC (permalink / raw)
  To: pbs-devel

to the call site where we have the log line sender available

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/server/pull.rs | 6 ++++++
 src/server/sync.rs | 4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index d7455c2ee..f2f90b83a 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -662,6 +662,12 @@ async fn pull_snapshot<'a>(
         .await
         .with_context(|| prefix.clone())?
     else {
+        log_sender
+            .log(
+                Level::INFO,
+                format!("{prefix}: skipped because vanished since start of sync",),
+            )
+            .await?;
         return Ok(sync_stats);
     };
 
diff --git a/src/server/sync.rs b/src/server/sync.rs
index d0d3ab31a..a06c90801 100644
--- a/src/server/sync.rs
+++ b/src/server/sync.rs
@@ -158,10 +158,6 @@ impl SyncSourceReader for RemoteSourceReader {
             match err.downcast_ref::<HttpError>() {
                 Some(HttpError { code, message }) => match *code {
                     StatusCode::NOT_FOUND => {
-                        info!(
-                            "Snapshot {}: skipped because vanished since start of sync",
-                            &self.dir
-                        );
                         return Ok(None);
                     }
                     _ => {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling
  2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
                   ` (2 preceding siblings ...)
  2026-04-27  8:49 ` [PATCH proxmox-backup 3/3] pull: move logging of disappeared snapshots Fabian Grünbichler
@ 2026-04-27  9:04 ` Fabian Grünbichler
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2026-04-27  9:04 UTC (permalink / raw)
  To: pbs-devel

forgot to add this here - this would be an alternative to Dominik's
patch in https://lore.proxmox.com/pbs-devel/1777277236.2hvl2my85r.astroid@yuna.none

On April 27, 2026 10:49 am, Fabian Grünbichler wrote:
> this series cleans up load_file_into by
> - moving the File -> DataBlob conversion to the manifest variant call
>   site
> - moving the "skip snapshot" logging to the call site to allow using a
>   LogLineSender
> 
> Fabian Grünbichler (3):
>   sync: return File in load_file_into
>   pull: do not allow archive fetching to return no archive
>   pull: move logging of disappeared snapshots
> 
>  src/server/pull.rs | 19 ++++++++++++++++---
>  src/server/sync.rs | 14 +++++---------
>  2 files changed, 21 insertions(+), 12 deletions(-)




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-27  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
2026-04-27  8:49 ` [PATCH proxmox-backup 1/3] sync: return File in load_file_into Fabian Grünbichler
2026-04-27  8:49 ` [PATCH proxmox-backup 2/3] pull: do not allow archive fetching to return no archive Fabian Grünbichler
2026-04-27  8:49 ` [PATCH proxmox-backup 3/3] pull: move logging of disappeared snapshots Fabian Grünbichler
2026-04-27  9:04 ` [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal