public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Robert Obkircher <r.obkircher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH v1 proxmox-backup 3/3] api: backup: disallow incremental backups with different index length
Date: Tue, 10 Mar 2026 17:04:00 +0100	[thread overview]
Message-ID: <20260310160537.182153-4-r.obkircher@proxmox.com> (raw)
In-Reply-To: <20260310160537.182153-1-r.obkircher@proxmox.com>

Restore the previous restrictions because fixed index files are only
reused for qemu backups where the total size never changes.

Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 src/api2/backup/mod.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs
index 3c044c78..4a37947b 100644
--- a/src/api2/backup/mod.rs
+++ b/src/api2/backup/mod.rs
@@ -498,6 +498,11 @@ fn create_fixed_index(
     let mut incremental = false;
     if let Some(csum) = reuse_csum {
         incremental = true;
+
+        if size.is_none() {
+            bail!("size is required for incremental backups");
+        }
+
         let last_backup = match &env.last_backup {
             Some(info) => info,
             None => {
@@ -531,6 +536,14 @@ fn create_fixed_index(
     let mut writer = env.datastore.create_fixed_writer(&path, size, chunk_size)?;
 
     if let Some(reader) = reader {
+        // compares chunk count instead of size for backwards compatability
+        if writer.index_length() != reader.index_count() {
+            bail!(
+                "cannot reuse index - index sizes not equal ({} != {})",
+                writer.index_length(),
+                reader.index_count()
+            );
+        }
         writer.clone_data_from(&reader)?;
     }
 
-- 
2.47.3





  parent reply	other threads:[~2026-03-10 16:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 16:03 [PATCH v1 proxmox-backup 0/3] fix incremental qemu backup Robert Obkircher
2026-03-10 16:03 ` [PATCH v1 proxmox-backup 1/3] api: backup: don't verify total file size for incremental backups Robert Obkircher
2026-03-10 17:03   ` Christian Ebner
2026-03-10 18:23     ` Thomas Lamprecht
2026-03-10 16:03 ` [PATCH v1 proxmox-backup 2/3] api: backup: improve schema documentation of fixed_close Robert Obkircher
2026-03-10 17:09   ` Christian Ebner
2026-03-10 16:04 ` Robert Obkircher [this message]
2026-03-10 17:16   ` [PATCH v1 proxmox-backup 3/3] api: backup: disallow incremental backups with different index length Christian Ebner
2026-03-10 18:40     ` Thomas Lamprecht
2026-03-10 17:11 ` [PATCH v1 proxmox-backup 0/3] fix incremental qemu backup Stoiko Ivanov
2026-03-10 17:34 ` Christian Ebner
2026-03-10 18:59 ` 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=20260310160537.182153-4-r.obkircher@proxmox.com \
    --to=r.obkircher@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