public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox-backup 2/7] client: backup writer: fix upload stats size and rate for push sync
Date: Tue, 18 Mar 2025 13:24:18 +0100	[thread overview]
Message-ID: <20250318122423.385684-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250318122423.385684-1-c.ebner@proxmox.com>

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 2:
- no changes

 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,
         elapsed: upload_stats.duration,
         removed: None,
     })
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2025-03-18 12:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 12:24 [pbs-devel] [PATCH v3 proxmox proxmox-backup 0/7] fix #4182: concurrent group pull/push support for sync jobs Christian Ebner
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox 1/7] pbs api types: add 'parallel-groups' to sync job config Christian Ebner
2025-03-18 12:24 ` Christian Ebner [this message]
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox-backup 3/7] api: config/sync: add optional `parallel-groups` property Christian Ebner
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox-backup 4/7] fix #4182: server: sync: allow pulling groups concurrently Christian Ebner
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox-backup 5/7] server: pull: prefix log messages and add error context Christian Ebner
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox-backup 6/7] server: sync: allow pushing groups concurrently Christian Ebner
2025-03-18 12:24 ` [pbs-devel] [PATCH v3 proxmox-backup 7/7] server: push: prefix log messages and add additional logging Christian Ebner
2025-04-04 13:51 ` [pbs-devel] superseded: [PATCH v3 proxmox proxmox-backup 0/7] fix #4182: concurrent group pull/push support for sync jobs Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250318122423.385684-3-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal