From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v3 3/3] sync job: pull: improve log output
Date: Thu, 13 Apr 2023 17:41:56 +0200 [thread overview]
Message-ID: <20230413154156.2304040-4-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20230413154156.2304040-1-s.hanreich@proxmox.com>
Adding an opening line for every group makes parsing the log easier.
We can also remove the 're-sync [...] done' line, because the next
line should be a progress line anyway. Printing the different reasons
for skipping snapshots makes it easier to check whether the
transfer-last parameter is working as expected.
Suggested-By: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
Still quite unsure about the format of the skip reasons, I've opted for newlines
since putting everything on one line seemed quite long:
2023-04-13T15:30:12+02:00: skipped: 4 snapshot(s) (2023-04-12T14:55:59Z .. 2023-04-13T13:02:09Z), 2 already synced, 2 due to transfer-last
One upside of this would be, that it is easy to grep.
The current version with newlines looks like this:
2023-04-13T15:08:31+02:00: skipped: 9 snapshot(s) (2023-04-12T14:55:59Z .. 2023-04-13T13:02:22Z)
7 older than newest local snapshot
2 due to transfer-last
Those would be the only lines in the Web UI Task Log without prepended
timestamps, which might be suboptimal as well.
I could move the output of the skip reasons out of the fmt method to be more
flexible, but having everything contained there seemed desirable to me - so I
settled on this solution for now.
Complete sample output for the sync of a group in the Web UI after this commit:
2023-04-13T15:08:31+02:00: sync group vm/101
2023-04-13T15:08:31+02:00: re-sync snapshot vm/101/2023-04-13T13:02:17Z
2023-04-13T15:08:31+02:00: no data changes
2023-04-13T15:08:31+02:00: percentage done: 28.79% (1/6 groups, 8/11 snapshots in group #2)
2023-04-13T15:08:31+02:00: sync snapshot vm/101/2023-04-13T13:02:25Z
2023-04-13T15:08:31+02:00: sync archive qemu-server.conf.blob
2023-04-13T15:08:31+02:00: sync archive drive-virtio0.img.fidx
2023-04-13T15:08:31+02:00: downloaded 0 bytes (0.00 MiB/s)
2023-04-13T15:08:31+02:00: sync archive drive-scsi0.img.fidx
2023-04-13T15:08:31+02:00: downloaded 0 bytes (0.00 MiB/s)
2023-04-13T15:08:31+02:00: got backup log file "client.log.blob"
2023-04-13T15:08:31+02:00: sync snapshot vm/101/2023-04-13T13:02:25Z done
2023-04-13T15:08:31+02:00: percentage done: 33.33% (2/6 groups)
2023-04-13T15:08:31+02:00: skipped: 9 snapshot(s) (2023-04-12T14:55:59Z .. 2023-04-13T13:02:22Z)
7 older than newest local snapshot
2 due to transfer-last
Any input would be appreciated, as I'm a bit torn.
src/server/pull.rs | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/server/pull.rs b/src/server/pull.rs
index 37058f9b..d6e3c2c4 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -1,6 +1,7 @@
//! Sync datastore from remote server
use std::collections::{HashMap, HashSet};
+use std::fmt::Write;
use std::io::{Seek, SeekFrom};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
@@ -535,7 +536,6 @@ async fn pull_snapshot_from(
} else {
task_log!(worker, "re-sync snapshot {}", snapshot.dir());
pull_snapshot(worker, reader, snapshot, downloaded_chunks).await?;
- task_log!(worker, "re-sync snapshot {} done", snapshot.dir());
}
Ok(())
@@ -589,12 +589,32 @@ impl SkipInfo {
impl std::fmt::Display for SkipInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(
- f,
- "skipped: {} snapshot(s) ({}) older than the newest local snapshot",
+ let mut reason_string = String::new();
+
+ writeln!(
+ reason_string,
+ "skipped: {} snapshot(s) ({}), ",
self.count(),
self.affected().map_err(|_| std::fmt::Error)?
- )
+ )?;
+
+ if self.already_synced_count > 0 {
+ writeln!(
+ reason_string,
+ "{} already synced",
+ self.already_synced_count
+ )?;
+ }
+
+ if self.transfer_last_count > 0 {
+ writeln!(
+ reason_string,
+ "{} due to transfer-last",
+ self.transfer_last_count
+ )?;
+ }
+
+ write!(f, "{}", reason_string.trim_end())
}
}
@@ -635,6 +655,8 @@ async fn pull_group(
remote_ns: BackupNamespace,
progress: &mut StoreProgress,
) -> Result<(), Error> {
+ task_log!(worker, "sync group {}", group);
+
let path = format!(
"api2/json/admin/datastore/{}/snapshots",
params.source.store()
--
2.30.2
prev parent reply other threads:[~2023-04-13 15:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 15:41 [pbs-devel] [PATCH-SERIES proxmox-backup v3 0/3] add transfer-last parameter to pull/sync job Stefan Hanreich
2023-04-13 15:41 ` [pbs-devel] [PATCH proxmox-backup v3 1/3] partial fix #3701: sync job: pull: add transfer-last parameter Stefan Hanreich
2023-04-17 8:56 ` Fabian Grünbichler
2023-04-13 15:41 ` [pbs-devel] [PATCH proxmox-backup v3 2/3] ui: sync job: " Stefan Hanreich
2023-04-17 9:23 ` Fabian Grünbichler
2023-04-13 15:41 ` Stefan Hanreich [this message]
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=20230413154156.2304040-4-s.hanreich@proxmox.com \
--to=s.hanreich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.