public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: "Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>,
	"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox-backup 6/6] sync: improve log output
Date: Wed, 22 Jul 2020 09:31:39 +0200	[thread overview]
Message-ID: <83fde4ca-9ebd-f240-7b10-aeb241ece75f@proxmox.com> (raw)
In-Reply-To: <20200721130337.934653-7-f.gruenbichler@proxmox.com>

On 21.07.20 15:03, Fabian Grünbichler wrote:
> add a bit more info and simplify some log statements.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> 
> Notes:
>     I am not sure whether this idea of 'last successful sync' == 'last successful
>     backup' is such a good idea in any case..
>     
>     this also might be too verbose for busy datastores - maybe just printing a
>     count of skipped, already previously synced snapshots is better?

yeah, IMO the "skipping snapshot {} - already synced" is to much, can generated
easily some thousands to hundred thousands of log lines in a big and "old"
datastore.

I'd then also put the count of skipped, already previously synced and "remote
returned {} snapshots" into one single line.

> 
>  src/client/pull.rs | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/client/pull.rs b/src/client/pull.rs
> index 421260a3..1718c752 100644
> --- a/src/client/pull.rs
> +++ b/src/client/pull.rs
> @@ -310,8 +310,10 @@ pub async fn pull_group(
>          "backup-id": group.backup_id(),
>      });
>  
> +    worker.log(format!("sync group {}", group));
>      let mut result = client.get(&path, Some(args)).await?;
>      let mut list: Vec<SnapshotListItem> = serde_json::from_value(result["data"].take())?;
> +    worker.log(format!("remote returned {} snapshots", list.len()));
>  
>      list.sort_unstable_by(|a, b| a.backup_time.cmp(&b.backup_time));
>  
> @@ -336,7 +338,10 @@ pub async fn pull_group(
>          remote_snapshots.insert(backup_time);
>  
>          if let Some(last_sync_time) = last_sync {
> -            if last_sync_time > backup_time { continue; }
> +            if last_sync_time > backup_time {
> +                worker.log(format!("skipping snapshot {} - already synced", snapshot));
> +                continue;
> +            }
>          }
>  
>          let options = HttpClientOptions::new()
> @@ -411,14 +416,14 @@ pub async fn pull_store(
>          let owner = tgt_store.create_backup_group(&group, &username)?;
>          // permission check
>          if owner != username { // only the owner is allowed to create additional snapshots
> -            worker.log(format!("sync group {}/{} failed - owner check failed ({} != {})",
> -                               item.backup_type, item.backup_id, username, owner));
> +            worker.log(format!("sync group {} failed - owner check failed ({} != {})",
> +                               group, username, owner));
>              errors = true;
>              continue; // do not stop here, instead continue
>          }
>  
>          if let Err(err) = pull_group(worker, client, src_repo, tgt_store.clone(), &group, delete).await {
> -            worker.log(format!("sync group {}/{} failed - {}", item.backup_type, item.backup_id, err));
> +            worker.log(format!("sync group {} failed - {}", group, err));
>              errors = true;
>              continue; // do not stop here, instead continue
>          }
> @@ -429,7 +434,7 @@ pub async fn pull_store(
>              let local_groups = BackupGroup::list_groups(&tgt_store.base_path())?;
>              for local_group in local_groups {
>                  if new_groups.contains(&local_group) { continue; }
> -                worker.log(format!("delete vanished group '{}/{}'", local_group.backup_type(), local_group.backup_id()));
> +                worker.log(format!("delete vanished group '{}'", local_group));
>                  if let Err(err) = tgt_store.remove_backup_group(&local_group) {
>                      worker.log(err.to_string());
>                      errors = true;
> 






  reply	other threads:[~2020-07-22  7:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 13:03 [pbs-devel] [PATCH proxmox-backup 0/6] various sync fixes/improvements Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [PATCH proxmox-backup 1/6] .gitignore: add build directory Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [PATCH proxmox-backup 2/6] fix #2860: skip in-progress snapshots when syncing Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [PATCH proxmox-backup 3/6] api: translate ENOTFOUND to 404 for downloads Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [PATCH proxmox-backup 4/6] fix #2865: detect and skip vanished snapshots Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [PATCH proxmox-backup 5/6] fix #2871: close FDs when scanning backup group Fabian Grünbichler
2020-07-21 13:03 ` [pbs-devel] [RFC proxmox-backup 6/6] sync: improve log output Fabian Grünbichler
2020-07-22  7:31   ` Thomas Lamprecht [this message]
2020-07-22  7:32 ` [pbs-devel] partially-applied: [PATCH proxmox-backup 0/6] various sync fixes/improvements Thomas Lamprecht

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=83fde4ca-9ebd-f240-7b10-aeb241ece75f@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=f.gruenbichler@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