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 34E221FF13B for ; Wed, 03 Jun 2026 14:18:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B603AA6C2; Wed, 3 Jun 2026 14:18:45 +0200 (CEST) Message-ID: <89791648-e7ea-4a49-b132-6404d7f8e6d4@proxmox.com> Date: Wed, 3 Jun 2026 14:18:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox-backup 4/6] task tracking: count WriteNonExpanding datastore operations To: Robert Obkircher , pbs-devel@lists.proxmox.com References: <20260602130001.217482-1-r.obkircher@proxmox.com> <20260602130001.217482-10-r.obkircher@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <20260602130001.217482-10-r.obkircher@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780489085052 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.069 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 Message-ID-Hash: MZSTVAAOAKJNILB4DBBWCFZONHIY3LMM X-Message-ID-Hash: MZSTVAAOAKJNILB4DBBWCFZONHIY3LMM X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Code wise this looks good to me, but I was pondering a bit if we should take the occasion here and define a `format-version` field in order to have some way of checking this in case of future extension. The older process might then only update values it knows about, but write out all the contents known to the newer versions. Other opinions on that? On 6/2/26 3:00 PM, Robert Obkircher wrote: > Count WriteNonExpanding as writes to ensure that switching over from > Write does not break forward compatibility when older versions read > the counters. > > Also add a new counter to display the GarbageCollection maintenance > mode conflicts. It may not be accurate while older processes are > running but it should be good enough for the UI. > > Signed-off-by: Robert Obkircher Reviewed-by: Christian Ebner > --- > pbs-datastore/src/task_tracking.rs | 12 ++++++++++++ > src/api2/admin/datastore.rs | 1 + > 2 files changed, 13 insertions(+) > > diff --git a/pbs-datastore/src/task_tracking.rs b/pbs-datastore/src/task_tracking.rs > index a67b77221..87ce4f5de 100644 > --- a/pbs-datastore/src/task_tracking.rs > +++ b/pbs-datastore/src/task_tracking.rs > @@ -13,6 +13,12 @@ use serde::{Deserialize, Serialize}; > pub struct ActiveOperationStats { > pub read: i64, > pub write: i64, > + /// The number of writers that do not significantly increase disk usage. > + /// > + /// The count is unreliable because older processes without this field > + /// will delete it on every update! > + #[serde(default)] > + pub write_non_expanding: i64, > } > > impl ActiveOperationStats { > @@ -20,6 +26,11 @@ impl ActiveOperationStats { > match operation { > Operation::Read => self.read += count, > Operation::Write => self.write += count, > + Operation::WriteNonExpanding => { > + self.write += count; > + // prevent underflow if an older process deleted the field > + self.write_non_expanding = (self.write_non_expanding + count).max(0); > + } > Operation::Lookup => (), // no IO must happen there > } > } > @@ -33,6 +44,7 @@ impl Sum for ActiveOperationStats { > iter.fold(Self::default(), |a, b| Self { > read: a.read + b.read, > write: a.write + b.write, > + write_non_expanding: a.write_non_expanding + b.write_non_expanding, > }) > } > } > diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs > index 94272c32d..3cbdd8922 100644 > --- a/src/api2/admin/datastore.rs > +++ b/src/api2/admin/datastore.rs > @@ -2024,6 +2024,7 @@ pub fn get_active_operations(store: String, _param: Value) -> Result Ok(json!({ > "read": active_operations.read, > "write": active_operations.write, > + "writeNonExpanding": active_operations.write_non_expanding, > })) > } >