From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 106EE1FF39E for ; Mon, 10 Jun 2024 14:06:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1E05E162F1; Mon, 10 Jun 2024 14:07:27 +0200 (CEST) Date: Mon, 10 Jun 2024 14:06:49 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20240610110621.308907-1-c.ebner@proxmox.com> <20240610110621.308907-2-c.ebner@proxmox.com> In-Reply-To: <20240610110621.308907-2-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1718020111.bnvypzw36x.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.057 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] applied: [PATCH proxmox-backup 2/2] client: pxar: encode prelude based on writer variant 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 June 10, 2024 1:06 pm, Christian Ebner wrote: > Currently, whether to encode the exlcude patterns passed via cli as > prelude or via the `.pxar-exclude-cli` is based on the presence of > a previous metadata accessor. > That leaves however to the encoding of the file entry instead of the > prelude for split archives in `data` mode and for the first snapshot > in a backup, creating undesired padding in the first payload chunk. > > Therefore, use the pxar writer variant to make the decision instead. > > Signed-off-by: Christian Ebner > --- > pbs-client/src/pxar/create.rs | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs > index dc0a31e7a..9a41bf3ee 100644 > --- a/pbs-client/src/pxar/create.rs > +++ b/pbs-client/src/pxar/create.rs > @@ -183,6 +183,7 @@ struct Archiver { > previous_payload_index: Option, > cache: PxarLookaheadCache, > reuse_stats: ReuseStats, > + split_archive: bool, > } > > type Encoder<'a, T> = pxar::encoder::aio::Encoder<'a, T>; > @@ -247,7 +248,8 @@ where > )?); > } > > - let prelude = if options.previous_ref.is_some() && !patterns.is_empty() { > + let split_archive = writers.archive.payload().is_some(); > + let prelude = if split_archive && !patterns.is_empty() { > let prelude = PbsClientPrelude { > exclude_patterns: Some(String::from_utf8(generate_pxar_excludes_cli( > &patterns[..], > @@ -258,7 +260,7 @@ where > None > }; > > - let metadata_mode = options.previous_ref.is_some() && writers.archive.payload().is_some(); > + let metadata_mode = options.previous_ref.is_some() && split_archive; > let (previous_payload_index, previous_metadata_accessor) = > if let Some(refs) = options.previous_ref { > ( > @@ -291,6 +293,7 @@ where > previous_payload_index, > cache: PxarLookaheadCache::new(options.max_cache_size), > reuse_stats: ReuseStats::default(), > + split_archive, > }; > > archiver > @@ -388,12 +391,11 @@ impl Archiver { > for file_entry in file_list { > let file_name = file_entry.name.to_bytes(); > > - if is_root > - && file_name == b".pxarexclude-cli" > - && previous_metadata_accessor.is_none() > - { > - self.encode_pxarexclude_cli(encoder, &file_entry.name, old_patterns_count) > - .await?; > + if is_root && file_name == b".pxarexclude-cli" { > + if !self.split_archive { > + self.encode_pxarexclude_cli(encoder, &file_entry.name, old_patterns_count) > + .await?; > + } > continue; > } > > @@ -1944,6 +1946,7 @@ mod tests { > suggested_boundaries: Some(suggested_boundaries), > cache: PxarLookaheadCache::new(None), > reuse_stats: ReuseStats::default(), > + split_archive: true, > }; > > let accessor = Accessor::new(pxar::PxarVariant::Unified(reader), metadata_size) > -- > 2.39.2 > > > > _______________________________________________ > 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