From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4A2501FF13F for ; Wed, 14 Jan 2026 14:13:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AFAFC126C1; Wed, 14 Jan 2026 14:13:35 +0100 (CET) Date: Wed, 14 Jan 2026 14:13:30 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20260109173548.301653-1-r.obkircher@proxmox.com> <20260109173548.301653-4-r.obkircher@proxmox.com> In-Reply-To: <20260109173548.301653-4-r.obkircher@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1768394490.gkvjyda5dd.astroid@yuna.none> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1768396367192 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup 3/5] fix #3847: api: backup: make fixed index file size optional X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" On January 9, 2026 6:35 pm, Robert Obkircher wrote: > Grow the FixedIndexWriter as necessary and update the duplicate size > in BackupEnvironment. > > Signed-off-by: Robert Obkircher > --- > src/api2/backup/environment.rs | 8 ++++++-- > src/api2/backup/mod.rs | 4 ++-- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/src/api2/backup/environment.rs b/src/api2/backup/environment.rs > index bd9c5211..77361724 100644 > --- a/src/api2/backup/environment.rs > +++ b/src/api2/backup/environment.rs > @@ -349,7 +349,7 @@ impl BackupEnvironment { > &self, > index: FixedIndexWriter, > name: String, > - size: usize, > + size: Option, > chunk_size: u32, > incremental: bool, > ) -> Result { > @@ -365,7 +365,7 @@ impl BackupEnvironment { > index, > name, > chunk_count: 0, > - size, > + size: size.unwrap_or(0), would make more sense IMHO to keep this as an option, to signify this is a known_size/not-growable index > chunk_size, > small_chunk_count: 0, > upload_stat: UploadStatistic::new(), > @@ -443,7 +443,11 @@ 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)?; > + if end > data.size { > + data.size = end; > + } and drop this, but make index.size accessible via a getter, and then checking both: index.size is as submitted by the client (ensures the growing happened correctly on both sides) data.size is as submitted by the client, if set (this is the existing check, just accounting for it now being optional) when closing the writer here.. > > data.chunk_count += 1; > > diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs > index 3e6b7a95..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(); > > let archive_name = name.clone(); > -- > 2.47.3 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel > > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel