[pbs-devel] [PATCH v3 proxmox-backup] fix #5710: api: backup: stat known chunks on backup finish

Gabriel Goller g.goller at proxmox.com
Tue Oct 8 10:41:45 CEST 2024


>diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs
>index ea0d0292e..664e24d99 100644
>--- a/src/api2/backup/mod.rs
>+++ b/src/api2/backup/mod.rs
>@@ -785,6 +785,26 @@ fn finish_backup(
> ) -> Result<Value, Error> {
>     let env: &BackupEnvironment = rpcenv.as_ref();
>
>+    if let Err(err) = env.stat_prev_known_chunks() {
>+        env.debug(format!("stat registered chunks failed - {err:?}"));
>+
>+        if let Some(last) = env.last_backup.as_ref() {
>+            // No need to acquire snapshot lock, already locked when starting the backup
>+            let verify_state = SnapshotVerifyState {
>+                state: VerifyState::Failed,
>+                upid: env.worker.upid().clone(), // backup writer UPID
>+            };
>+            let verify_state = serde_json::to_value(verify_state)?;
>+            last.backup_dir
>+                .update_manifest(|manifest| {
>+                    manifest.unprotected["verify_state"] = verify_state;
>+                })
>+                .map_err(|err| format_err!("manifest update failed - {err:?}"))?;

Can't we add this line here to the error context as well?

>+        }
>+
>+        bail!("stat known chunks failed - {err:?}");
>+    }
>+
>     env.finish_backup()?;
>     env.log("successfully finished backup");
>

Everything else is perfect!




More information about the pbs-devel mailing list