[pbs-devel] [PATCH v3 proxmox-backup 50/58] client: backup writer: add injected chunk count to stats
Christian Ebner
c.ebner at proxmox.com
Thu Mar 28 13:36:59 CET 2024
Track the number of injected chunks and show them in the debug output
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 2:
- not present in previous version
pbs-client/src/backup_writer.rs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs
index 032d93da7..828bd7a3e 100644
--- a/pbs-client/src/backup_writer.rs
+++ b/pbs-client/src/backup_writer.rs
@@ -57,6 +57,7 @@ pub struct UploadOptions {
struct UploadStats {
chunk_count: usize,
chunk_reused: usize,
+ chunk_injected: usize,
size: usize,
size_reused: usize,
size_compressed: usize,
@@ -400,6 +401,11 @@ impl BackupWriter {
archive,
(upload_stats.duration.as_micros()) / (upload_stats.chunk_count as u128)
);
+ log::debug!(
+ "{}: Injected {} chunks from previous snapshot.",
+ archive,
+ upload_stats.chunk_injected,
+ );
}
let param = json!({
@@ -646,6 +652,8 @@ impl BackupWriter {
let total_chunks2 = total_chunks.clone();
let known_chunk_count = Arc::new(AtomicUsize::new(0));
let known_chunk_count2 = known_chunk_count.clone();
+ let injected_chunk_count = Arc::new(AtomicUsize::new(0));
+ let injected_chunk_count2 = known_chunk_count.clone();
let stream_len = Arc::new(AtomicUsize::new(0));
let stream_len2 = stream_len.clone();
@@ -675,7 +683,9 @@ impl BackupWriter {
)
.and_then(move |chunk_info| match chunk_info {
InjectedChunksInfo::Known(chunks) => {
- total_chunks.fetch_add(chunks.len(), Ordering::SeqCst);
+ let count = chunks.len();
+ total_chunks.fetch_add(count, Ordering::SeqCst);
+ injected_chunk_count.fetch_add(count, Ordering::SeqCst);
future::ok(MergedChunkInfo::Known(chunks))
}
InjectedChunksInfo::Raw((offset, data)) => {
@@ -787,6 +797,7 @@ impl BackupWriter {
let duration = start_time.elapsed();
let chunk_count = total_chunks2.load(Ordering::SeqCst);
let chunk_reused = known_chunk_count2.load(Ordering::SeqCst);
+ let chunk_injected = injected_chunk_count2.load(Ordering::SeqCst);
let size = stream_len2.load(Ordering::SeqCst);
let size_reused = reused_len2.load(Ordering::SeqCst);
let size_compressed = compressed_stream_len2.load(Ordering::SeqCst) as usize;
@@ -797,6 +808,7 @@ impl BackupWriter {
futures::future::ok(UploadStats {
chunk_count,
chunk_reused,
+ chunk_injected,
size,
size_reused,
size_compressed,
--
2.39.2
More information about the pbs-devel
mailing list