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 7FBDA1FF39E for ; Fri, 7 Jun 2024 13:37:40 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0D5B71E0E3; Fri, 7 Jun 2024 13:38:10 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Fri, 7 Jun 2024 13:37:52 +0200 Message-Id: <20240607113752.324017-10-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240607113752.324017-1-c.ebner@proxmox.com> References: <20240607113752.324017-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 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] [PATCH v2 proxmox-backup 9/9] client: backup: conditionally write catalog for file level backups 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" Only write the catalog when using the regular backup mode, do not write it when using the split archive mode. Signed-off-by: Christian Ebner --- pbs-client/src/pxar_backup_stream.rs | 11 +++++++---- proxmox-backup-client/src/main.rs | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pbs-client/src/pxar_backup_stream.rs b/pbs-client/src/pxar_backup_stream.rs index f322566f0..cdbcdfec2 100644 --- a/pbs-client/src/pxar_backup_stream.rs +++ b/pbs-client/src/pxar_backup_stream.rs @@ -15,7 +15,7 @@ use nix::sys::stat::Mode; use proxmox_async::blocking::TokioWriterAdapter; use proxmox_io::StdChannelWriter; -use pbs_datastore::catalog::CatalogWriter; +use pbs_datastore::catalog::{BackupCatalogWriter, CatalogWriter}; use crate::inject_reused_chunks::InjectChunks; use crate::pxar::create::PxarWriters; @@ -42,7 +42,7 @@ impl Drop for PxarBackupStream { impl PxarBackupStream { pub fn new( dir: Dir, - catalog: Arc>>, + catalog: Option>>>, options: crate::pxar::PxarCreateOptions, boundaries: Option>, separate_payload_stream: bool, @@ -82,7 +82,10 @@ impl PxarBackupStream { let handler = async move { if let Err(err) = crate::pxar::create_archive( dir, - PxarWriters::new(writer, Some(catalog)), + PxarWriters::new( + writer, + catalog.map(|c| c as Arc>), + ), crate::pxar::Flags::DEFAULT, move |path| { log::debug!("{:?}", path); @@ -122,7 +125,7 @@ impl PxarBackupStream { pub fn open( dirname: &Path, - catalog: Arc>>, + catalog: Option>>>, options: crate::pxar::PxarCreateOptions, boundaries: Option>, separate_payload_stream: bool, diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 09af912df..f1c7fbf93 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -192,7 +192,7 @@ async fn backup_directory>( archive_name: &str, payload_target: Option<&str>, chunk_size: Option, - catalog: Arc>>>>, + catalog: Option>>>>>, pxar_create_options: pbs_client::pxar::PxarCreateOptions, upload_options: UploadOptions, ) -> Result<(BackupStats, Option), Error> { @@ -1059,19 +1059,20 @@ async fn create_backup( }; // start catalog upload on first use - if catalog.is_none() { + if catalog.is_none() && !detection_mode.is_data() && !detection_mode.is_metadata() { let catalog_upload_res = spawn_catalog_upload(client.clone(), crypto.mode == CryptMode::Encrypt)?; catalog = Some(catalog_upload_res.catalog_writer); catalog_result_rx = Some(catalog_upload_res.result); } - let catalog = catalog.as_ref().unwrap(); log_file("directory", &filename, &target); - catalog - .lock() - .unwrap() - .start_directory(std::ffi::CString::new(target.as_str())?.as_c_str())?; + if let Some(catalog) = catalog.as_ref() { + catalog + .lock() + .unwrap() + .start_directory(std::ffi::CString::new(target.as_str())?.as_c_str())?; + } let mut previous_ref = None; let max_cache_size = if detection_mode.is_metadata() { @@ -1139,7 +1140,7 @@ async fn create_backup( &target, payload_target.as_deref(), chunk_size_opt, - catalog.clone(), + catalog.as_ref().cloned(), pxar_options, upload_options, ) @@ -1155,7 +1156,9 @@ async fn create_backup( )?; } manifest.add_file(target, stats.size, stats.csum, crypto.mode)?; - catalog.lock().unwrap().end_directory()?; + if let Some(catalog) = catalog.as_ref() { + catalog.lock().unwrap().end_directory()?; + } } (BackupSpecificationType::IMAGE, false) => { log_file("image", &filename, &target); -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel