From: Robert Obkircher <r.obkircher@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH v5 proxmox-backup 07/16] api: backup: make fixed index file size optional
Date: Mon, 2 Feb 2026 14:20:18 +0100 [thread overview]
Message-ID: <37527a80-51b7-4b16-b2a8-a1b1c0a66664@proxmox.com> (raw)
In-Reply-To: <e50ff40c-1075-4348-aae1-e187a739fe27@proxmox.com>
On 2/2/26 12:38, Christian Ebner wrote:
> On 1/30/26 5:45 PM, Robert Obkircher wrote:
>> Pass the optional size to the FixedIndexWriter to make it grow as
>> necessary.
>>
>> Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
>> ---
>> src/api2/backup/environment.rs | 21 ++++++++++++---------
>> src/api2/backup/mod.rs | 8 +++-----
>> 2 files changed, 15 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/api2/backup/environment.rs
>> b/src/api2/backup/environment.rs
>> index bd9c5211..90a84ed2 100644
>> --- a/src/api2/backup/environment.rs
>> +++ b/src/api2/backup/environment.rs
>> @@ -67,7 +67,7 @@ struct DynamicWriterState {
>> struct FixedWriterState {
>> name: String,
>> index: FixedIndexWriter,
>> - size: usize,
>> + size: Option<usize>,
>> chunk_size: u32,
>> chunk_count: u64,
>> small_chunk_count: usize, // allow 0..1 small chunks (last
>> chunk may be smaller)
>> @@ -349,7 +349,7 @@ impl BackupEnvironment {
>> &self,
>> index: FixedIndexWriter,
>> name: String,
>> - size: usize,
>> + size: Option<usize>,
>> chunk_size: u32,
>> incremental: bool,
>> ) -> Result<usize, Error> {
>> @@ -443,6 +443,7 @@ impl BackupEnvironment {
>> }
>> let end = (offset as usize) + (size as usize);
>> + data.index.grow_to_size(end)?;
>> let idx = data.index.check_chunk_alignment(end, size as
>> usize)?;
>> data.chunk_count += 1;
>> @@ -624,13 +625,15 @@ impl BackupEnvironment {
>> );
>> }
>> - if size != (data.size as u64) {
>> - bail!(
>> - "fixed writer '{}' close failed - unexpected
>> file size ({} != {})",
>> - data.name,
>> - data.size,
>> - size
>> - );
>> + if let Some(known_size) = data.size {
>> + if size != known_size as u64 {
>> + bail!(
>> + "fixed writer '{}' close failed -
>> unexpected file size ({} != {})",
>> + data.name,
>> + known_size,
>> + size,
>> + );
>> + }
>> }
>> }
>> diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs
>> index c625a2dc..c2822c18 100644
>> --- a/src/api2/backup/mod.rs
>> +++ b/src/api2/backup/mod.rs
>> @@ -456,7 +456,7 @@ pub const API_METHOD_CREATE_FIXED_INDEX:
>> ApiMethod = ApiMethod::new(
>> ("archive-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA),
>> (
>> "size",
>> - false,
>> + true,
>> &IntegerSchema::new("File
>> size.").minimum(1).schema()
>> ),
>> (
>> @@ -480,7 +480,7 @@ fn create_fixed_index(
>> let env: &BackupEnvironment = rpcenv.as_ref();
>> let name = required_string_param(¶m,
>> "archive-name")?.to_owned();
>> - let size = required_integer_param(¶m, "size")? as usize;
>> + let size =
>> param["size"].as_u64().map(usize::try_from).transpose()?;
>> let reuse_csum = param["reuse-csum"].as_str();
>
> The fixed index writer does not allow for incremental backups,
> failing if it is requested.
>
> question: should we allow to proceed the backup without failing by
> simply switching to a non incremental backup for those index writers
> where no size is specified, including a log warning that that a
> non-incremental mode is used?
I think reuse-csum without size could reasonably be supported by
copying the entire file and taking the size from there. Now that
add_chunk is a single operation it would even be possible to allow
overwriting the partial chunk in the end to continue growing.
>
> Should be better than failing the whole backup snapshot in case of
> multiple archives with mixed inputs.
As far as I can tell, "reuse-csum" is only set in one specific place
in proxmox-backup-qemu and only if the checksum matches exactly. Is
this actually relevant for anything else?
>
>> let archive_name = name.clone();
>> @@ -528,9 +528,7 @@ fn create_fixed_index(
>> reader = Some(index);
>> }
>> - let mut writer = env
>> - .datastore
>> - .create_fixed_writer(&path, Some(size), chunk_size)?;
>> + let mut writer = env.datastore.create_fixed_writer(&path,
>> size, chunk_size)?;
>> if let Some(reader) = reader {
>> writer.clone_data_from(&reader)?;
>
next prev parent reply other threads:[~2026-02-02 13:20 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 16:45 [PATCH v5 proxmox-backup 00/16] fix: #3847 pipe from STDIN to proxmox-backup-client Robert Obkircher
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 01/16] datastore: remove Arc<ChunkStore> from FixedIndexWriter Robert Obkircher
2026-02-02 10:02 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 02/16] datastore: remove Arc<ChunkStore> from DynamicIndexWriter Robert Obkircher
2026-02-02 10:03 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 03/16] datastore: add TempTestDir that is automatically deleted on drop Robert Obkircher
2026-02-02 8:32 ` Lukas Wagner
2026-02-02 10:12 ` Robert Obkircher
2026-02-02 10:56 ` Lukas Wagner
2026-02-02 10:03 ` Christian Ebner
2026-02-02 10:17 ` Christian Ebner
2026-02-02 10:50 ` Robert Obkircher
2026-02-02 11:13 ` Christian Ebner
2026-02-02 11:21 ` Robert Obkircher
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 04/16] datastore: use temporary directory for chunk store test Robert Obkircher
2026-02-02 10:16 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 05/16] datastore: support writing fidx files of unknown size Robert Obkircher
2026-02-02 10:43 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 06/16] datastore: test FixedIndexWriter Robert Obkircher
2026-02-02 11:11 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 07/16] api: backup: make fixed index file size optional Robert Obkircher
2026-02-02 11:39 ` Christian Ebner
2026-02-02 13:20 ` Robert Obkircher [this message]
2026-02-02 13:57 ` Christian Ebner
2026-02-09 11:48 ` Robert Obkircher
2026-02-09 12:12 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 08/16] api: verify fixed index writer size on close Robert Obkircher
2026-02-02 11:48 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 09/16] fix #3847: client: support fifo pipe inputs for images Robert Obkircher
2026-02-02 12:09 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 10/16] client: treat minus sign as stdin Robert Obkircher
2026-02-02 12:15 ` Christian Ebner
2026-02-04 14:02 ` Robert Obkircher
2026-02-04 14:43 ` Christian Ebner
2026-02-05 13:40 ` Robert Obkircher
2026-02-05 14:45 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 11/16] datastore: combine public FixedIndexWriter methods into add_chunk Robert Obkircher
2026-02-02 12:32 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 12/16] datastore: use u64 instead of usize for fidx writer content size Robert Obkircher
2026-02-02 12:48 ` Christian Ebner
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 13/16] datastore: compute fidx file size with overflow checks Robert Obkircher
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 14/16] datastore: support writing fidx files on systems with larger page size Robert Obkircher
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 15/16] datastore: FixedIndexWriter: switch public chunk_size to u32 Robert Obkircher
2026-01-30 16:45 ` [PATCH v5 proxmox-backup 16/16] datastore: FixedIndexWriter: switch internal " Robert Obkircher
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=37527a80-51b7-4b16-b2a8-a1b1c0a66664@proxmox.com \
--to=r.obkircher@proxmox.com \
--cc=c.ebner@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