[pbs-devel] [PATCH v4 proxmox-backup 2/2] backup: check all referenced chunks actually exist

Dietmar Maurer dietmar at proxmox.com
Tue Sep 15 08:09:04 CEST 2020


unrelated question below:

 /// Ensure all chunks referenced in this backup actually exist.
> +    /// Only call *after* all writers have been closed, to avoid race with GC.
> +    /// In case of error, mark the previous backup as 'verify failed'.
> +    fn verify_chunk_existance(&self, known_chunks: &KnownChunksMap) -> Result<(), Error> {
> +        for (digest, (_, checked)) in known_chunks.iter() {
> +            if !checked && !self.datastore.chunk_path(digest).0.exists() {
> +                let mark_msg = if let Some(ref last_backup) = self.last_backup {
> +                    let last_dir = &last_backup.backup_dir;
> +                    let verify_state = SnapshotVerifyState {
> +                        state: "failed".to_owned(),

Why is state a String? This should be an enum instead? Please can you take a look at that? 

> +                        upid: self.worker.upid().clone(),
> +                    };
> +
> +                    let res = proxmox::try_block!{
> +                        let (mut manifest, _) = self.datastore.load_manifest(last_dir)?;
> +                        manifest.unprotected["verify_state"] = serde_json::to_value(verify_state)?;
> +                        self.datastore.store_manifest(last_dir, serde_json::to_value(manifest)?)
> +                    };





More information about the pbs-devel mailing list