From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox-backup v2] client/pull: log snapshots that are skipped because of time
Date: Mon, 7 Jun 2021 10:51:50 +0200 (CEST) [thread overview]
Message-ID: <262778130.374.1623055910849@webmail.proxmox.com> (raw)
applied
> On 06/07/2021 10:30 AM Dominik Csapak <d.csapak@proxmox.com> wrote:
>
>
> we skip snapshots that are older than the newest snapshot of the group in
> the target datastore, log it so the user can know why it is not synced
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v1:
> * condense display trait by
> - omit 0 case (we check fot it anyway)
> - combine other cases by simplifying language (drop 'that is/are',
> change to 'snapshot(s)')
>
> src/client/pull.rs | 57 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 57 insertions(+)
>
> diff --git a/src/client/pull.rs b/src/client/pull.rs
> index 95720973..1ee0e0d1 100644
> --- a/src/client/pull.rs
> +++ b/src/client/pull.rs
> @@ -14,6 +14,7 @@ use crate::{
> backup::*,
> client::*,
> server::WorkerTask,
> + task_log,
> tools::{compute_file_csum, ParallelHandler},
> };
> use proxmox::api::error::{HttpError, StatusCode};
> @@ -443,6 +444,51 @@ pub async fn pull_snapshot_from(
> Ok(())
> }
>
> +struct SkipInfo {
> + oldest: i64,
> + newest: i64,
> + count: u64,
> +}
> +
> +impl SkipInfo {
> + fn update(&mut self, backup_time: i64) {
> + self.count += 1;
> +
> + if backup_time < self.oldest {
> + self.oldest = backup_time;
> + }
> +
> + if backup_time > self.newest {
> + self.newest = backup_time;
> + }
> + }
> +
> + fn affected(&self) -> Result<String, Error> {
> + match self.count {
> + 0 => Ok(String::new()),
> + 1 => proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest),
> + _ => {
> + Ok(format!(
> + "{} .. {}",
> + proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest)?,
> + proxmox::tools::time::epoch_to_rfc3339_utc(self.newest)?,
> + ))
> + }
> + }
> + }
> +}
> +
> +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",
> + self.count,
> + self.affected().map_err(|_| std::fmt::Error)?
> + )
> + }
> +}
> +
> pub async fn pull_group(
> worker: &WorkerTask,
> client: &HttpClient,
> @@ -477,6 +523,12 @@ pub async fn pull_group(
>
> progress.group_snapshots = list.len() as u64;
>
> + let mut skip_info = SkipInfo {
> + oldest: i64::MAX,
> + newest: i64::MIN,
> + count: 0,
> + };
> +
> for (pos, item) in list.into_iter().enumerate() {
> let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time)?;
>
> @@ -495,6 +547,7 @@ pub async fn pull_group(
>
> if let Some(last_sync_time) = last_sync {
> if last_sync_time > backup_time {
> + skip_info.update(backup_time);
> continue;
> }
> }
> @@ -552,6 +605,10 @@ pub async fn pull_group(
> }
> }
>
> + if skip_info.count > 0 {
> + task_log!(worker, "{}", skip_info);
> + }
> +
> Ok(())
> }
>
> --
> 2.20.1
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
reply other threads:[~2021-06-07 8:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=262778130.374.1623055910849@webmail.proxmox.com \
--to=dietmar@proxmox.com \
--cc=d.csapak@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.