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: [PATCH proxmox-backup 1/4] move group: use human-readable snapshot timestamp in check
Date: Mon, 27 Apr 2026 14:02:25 +0200	[thread overview]
Message-ID: <20260427120234.634681-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20260427120234.634681-1-f.gruenbichler@proxmox.com>

before:

2026-04-27T13:39:44+02:00: TASK ERROR: cannot merge group 'ct/999' from 'foo' into 'bar': snapshot time overlap (oldest source: 1678867213, conflicting target: 1774348044)

after:

2026-04-27T13:42:03+02:00: TASK ERROR: cannot merge group 'ct/999' from 'foo' into 'bar': snapshot time overlap (oldest source: 2023-03-15T08:00:13Z, conflicting target: 2026-03-24T10:27:24Z)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 pbs-datastore/src/backup_info.rs | 35 ++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index 69949c511..5f61890ed 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -291,24 +291,35 @@ impl BackupGroup {
             );
         }
 
-        let src_oldest = self
-            .iter_snapshots()?
-            .filter_map(Result::ok)
-            .map(|s| s.backup_time())
-            .min();
+        let (src_oldest, src_oldest_str) = self.iter_snapshots()?.filter_map(Result::ok).fold(
+            (i64::MAX, String::new()),
+            |(min, min_str), s| {
+                let curr = s.backup_time();
+                if curr < min {
+                    (curr, s.backup_time_string.clone())
+                } else {
+                    (min, min_str)
+                }
+            },
+        );
 
-        if let Some(src_oldest) = src_oldest {
+        if src_oldest != i64::MAX {
             // Any target snapshot with time >= src_oldest violates the
             // "source strictly newer than target" merge invariant. Short-circuit on the first hit.
             if let Some(overlap) = target
                 .iter_snapshots()?
                 .filter_map(Result::ok)
-                .map(|s| s.backup_time())
-                .find(|t| *t >= src_oldest)
+                .find_map(|s| {
+                    if s.backup_time() >= src_oldest {
+                        Some(s.backup_time_string().to_owned())
+                    } else {
+                        None
+                    }
+                })
             {
                 bail!(
                     "cannot merge group '{}/{}' from '{}' into '{}': snapshot time overlap \
-                    (oldest source: {src_oldest}, conflicting target: {overlap})",
+                    (oldest source: {src_oldest_str}, conflicting target: {overlap})",
                     self.group.ty,
                     self.group.id,
                     self.ns,
@@ -957,6 +968,12 @@ impl BackupDir {
         crate::SnapshotReader::new_do(self.clone())
     }
 
+    /// Returns whether a manifest file exists
+    pub fn has_manifest(&self) -> bool {
+        let manifest_path = self.full_path().join(MANIFEST_BLOB_NAME.as_ref());
+        manifest_path.exists()
+    }
+
     /// Load the manifest without a lock. Must not be written back.
     pub fn load_manifest(&self) -> Result<(BackupManifest, u64), Error> {
         let blob = self.load_blob(MANIFEST_BLOB_NAME.as_ref())?;
-- 
2.47.3





  reply	other threads:[~2026-04-27 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 12:02 [PATCH proxmox-backup 0/4] move group/namespace logging improvements Fabian Grünbichler
2026-04-27 12:02 ` Fabian Grünbichler [this message]
2026-04-27 12:02 ` [PATCH proxmox-backup 2/4] move group: split overly long error message Fabian Grünbichler
2026-04-27 12:02 ` [PATCH proxmox-backup 3/4] move namespace: move context log line before check Fabian Grünbichler
2026-04-27 12:02 ` [PATCH proxmox-backup 4/4] move namespace: use group(s)/namespace(s) consistently Fabian Grünbichler

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=20260427120234.634681-2-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