From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id AC6D66316F for ; Thu, 24 Feb 2022 08:58:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9C3D451BB for ; Thu, 24 Feb 2022 08:57:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 1547851B2 for ; Thu, 24 Feb 2022 08:57:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DE2DE46E35 for ; Thu, 24 Feb 2022 08:57:40 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Thu, 24 Feb 2022 08:57:40 +0100 Message-Id: <20220224075740.392582-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.155 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [datastore.rs] Subject: [pbs-devel] [PATCH proxmox-backup] fix loading chunk_order from config 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: , X-List-Received-Date: Thu, 24 Feb 2022 07:58:11 -0000 when we updated the chunk-order for a datastore, it was not reloaded until a reload/restart of the daemon (or if the path or 'verify-new' option was changed) add it to the options that triggers a reload of the datastore config Signed-off-by: Dominik Csapak --- are we maybe at the point where we want to calculate a checksum of the raw options for checking a reload trigger instead of the seperate options? i find it slightly irritating that i have to parse the option here twice when they have changed... a checksum from the raw config lines(in deterministic order, e.g. alphabetically) would include every config change, but we would not have to maintain a list of options that trigger a change. this could prevent someone to forget that mechanism exists (like i did) pbs-datastore/src/datastore.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 8397da00..e01da2ba 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -76,7 +76,8 @@ impl DataStore { if let Some(datastore) = map.get(name) { // Compare Config - if changed, create new Datastore object! if datastore.chunk_store.base() == path && - datastore.verify_new == config.verify_new.unwrap_or(false) + datastore.verify_new == config.verify_new.unwrap_or(false) && + datastore.chunk_order == Self::parse_chunk_order(&config)? { return Ok(datastore.clone()); } @@ -120,20 +121,22 @@ impl DataStore { GarbageCollectionStatus::default() }; - let tuning: DatastoreTuning = serde_json::from_value( - DatastoreTuning::API_SCHEMA.parse_property_string(config.tuning.as_deref().unwrap_or(""))? - )?; - let chunk_order = tuning.chunk_order.unwrap_or(ChunkOrder::Inode); - Ok(Self { chunk_store: Arc::new(chunk_store), gc_mutex: Mutex::new(()), last_gc_status: Mutex::new(gc_status), verify_new: config.verify_new.unwrap_or(false), - chunk_order, + chunk_order: Self::parse_chunk_order(&config)?, }) } + fn parse_chunk_order(config: &DataStoreConfig) -> Result { + let tuning: DatastoreTuning = serde_json::from_value( + DatastoreTuning::API_SCHEMA.parse_property_string(config.tuning.as_deref().unwrap_or(""))? + )?; + Ok(tuning.chunk_order.unwrap_or(ChunkOrder::Inode)) + } + pub fn get_chunk_iterator( &self, ) -> Result< -- 2.30.2