From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pbs-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E66A31FF15C for <inbox@lore.proxmox.com>; Fri, 4 Apr 2025 20:01:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ABE7138F6; Fri, 4 Apr 2025 20:01:32 +0200 (CEST) Mime-Version: 1.0 Date: Fri, 04 Apr 2025 20:01:29 +0200 Message-Id: <D8Y1US4R6UGG.ATWQFC4UXBHB@proxmox.com> To: "Proxmox Backup Server development discussion" <pbs-devel@lists.proxmox.com> From: "Max Carrara" <m.carrara@proxmox.com> X-Mailer: aerc 0.18.2-0-ge037c095a049 References: <20250404134936.425392-1-c.ebner@proxmox.com> <20250404134936.425392-3-c.ebner@proxmox.com> In-Reply-To: <20250404134936.425392-3-c.ebner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.080 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 v4 proxmox-backup 2/7] client: backup writer: fix upload stats size and rate for push sync X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion <pbs-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/> List-Post: <mailto:pbs-devel@lists.proxmox.com> List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com> On Fri Apr 4, 2025 at 3:49 PM CEST, Christian Ebner wrote: > Currently, the logical size of the uploaded chunks is used for size > and upload rate calculation in case of sync jobs in push direction, > leading to incorrect values of the actual transferred size and rate. > > Use the compressed chunk size instead, by returning the more verbose > `UploadStats` on `upload_index_chunk_info` calls and use it's > compressed size for the transferred `bytes` of `SyncStats` instead, > being finally used to display the upload size and calculate the rate > for the push sync job. > > Signed-off-by: Christian Ebner <c.ebner@proxmox.com> > --- > changes since version 3: > - rebased onto current master > > pbs-client/src/backup_stats.rs | 20 ++++++++++---------- > pbs-client/src/backup_writer.rs | 4 ++-- > src/server/push.rs | 2 +- > 3 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/pbs-client/src/backup_stats.rs b/pbs-client/src/backup_stats.rs > index f0563a001..edf7ef3c4 100644 > --- a/pbs-client/src/backup_stats.rs > +++ b/pbs-client/src/backup_stats.rs > @@ -15,16 +15,16 @@ pub struct BackupStats { > } > > /// Extended backup run statistics and archive checksum > -pub(crate) struct UploadStats { > - pub(crate) chunk_count: usize, > - pub(crate) chunk_reused: usize, > - pub(crate) chunk_injected: usize, > - pub(crate) size: usize, > - pub(crate) size_reused: usize, > - pub(crate) size_injected: usize, > - pub(crate) size_compressed: usize, > - pub(crate) duration: Duration, > - pub(crate) csum: [u8; 32], > +pub struct UploadStats { > + pub chunk_count: usize, > + pub chunk_reused: usize, > + pub chunk_injected: usize, > + pub size: usize, > + pub size_reused: usize, > + pub size_injected: usize, > + pub size_compressed: usize, > + pub duration: Duration, > + pub csum: [u8; 32], > } > > impl UploadStats { > diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs > index 325425069..d93b3e7e8 100644 > --- a/pbs-client/src/backup_writer.rs > +++ b/pbs-client/src/backup_writer.rs > @@ -275,7 +275,7 @@ impl BackupWriter { > archive_name: &BackupArchiveName, > stream: impl Stream<Item = Result<MergedChunkInfo, Error>>, > options: UploadOptions, > - ) -> Result<BackupStats, Error> { > + ) -> Result<UploadStats, Error> { > let mut param = json!({ "archive-name": archive_name }); > let prefix = if let Some(size) = options.fixed_size { > param["size"] = size.into(); > @@ -359,7 +359,7 @@ impl BackupWriter { > .post(&format!("{prefix}_close"), Some(param)) > .await?; > > - Ok(upload_stats.to_backup_stats()) > + Ok(upload_stats) > } > > pub async fn upload_stream( > diff --git a/src/server/push.rs b/src/server/push.rs > index 0db3dff30..f00a6b1e0 100644 > --- a/src/server/push.rs > +++ b/src/server/push.rs > @@ -1016,7 +1016,7 @@ async fn push_index( > > Ok(SyncStats { > chunk_count: upload_stats.chunk_count as usize, > - bytes: upload_stats.size as usize, > + bytes: upload_stats.size_compressed as usize, The `as usize` cast here is unnecessary, as `size_compressed` is already `usize`. Same also goes for `chunk_count`. Can perhaps be fixed in a follow-up, though. Tiny thing. > elapsed: upload_stats.duration, > removed: None, > }) _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel