public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] pull: properly skip missing snapshots
Date: Wed, 27 Nov 2024 09:26:04 +0100	[thread overview]
Message-ID: <20241127082604.89880-1-f.gruenbichler@proxmox.com> (raw)

when loading the verification state for a local snapshot, it must first be
ensured that it actually exists, else the lack of manifest will be interpreted
as corrupt snapshot triggering a "resync" that is actually a sync of all
missing snapshots.

Fixes: 0974ddfa17be018f777d6ece90a71bfa8fc130d8 "fix #3786: api: add resync-corrupt option to sync jobs"

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

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 9abb673ae..361ed0687 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -551,21 +551,23 @@ async fn pull_group(
                     .store
                     .backup_dir(target_ns.clone(), dir.clone());
                 if let Ok(local_dir) = local_dir {
-                    match local_dir.verify_state() {
-                        Ok(Some(state)) => {
-                            if state == VerifyState::Failed {
+                    if local_dir.full_path().exists() {
+                        match local_dir.verify_state() {
+                            Ok(Some(state)) => {
+                                if state == VerifyState::Failed {
+                                    return Some((dir, true));
+                                }
+                            }
+                            Ok(None) => {
+                                // The verify_state item was not found in the manifest, this means the
+                                // snapshot is new.
+                            }
+                            Err(_) => {
+                                // There was an error loading the manifest, probably better if we
+                                // resync.
                                 return Some((dir, true));
                             }
                         }
-                        Ok(None) => {
-                            // The verify_state item was not found in the manifest, this means the
-                            // snapshot is new.
-                        }
-                        Err(_) => {
-                            // There was an error loading the manifest, probably better if we
-                            // resync.
-                            return Some((dir, true));
-                        }
                     }
                 }
             }
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

             reply	other threads:[~2024-11-27  8:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27  8:26 Fabian Grünbichler [this message]
2024-11-27  9:05 ` Dominik Csapak
2024-11-27  9:17   ` Fabian Grünbichler
2024-11-27 10:46     ` Thomas Lamprecht
2024-11-27  9:05 ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241127082604.89880-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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