From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C7A0B706AB for ; Mon, 7 Jun 2021 10:52:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BD7B1EDC6 for ; Mon, 7 Jun 2021 10:52:42 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6AE8DEDB8 for ; Mon, 7 Jun 2021 10:52:38 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3C25842E77 for ; Mon, 7 Jun 2021 10:52:38 +0200 (CEST) Date: Mon, 7 Jun 2021 10:51:50 +0200 (CEST) From: Dietmar Maurer To: Proxmox Backup Server development discussion , Dominik Csapak Message-ID: <262778130.374.1623055910849@webmail.proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.5-Rev13 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 1.144 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] applied: [PATCH proxmox-backup v2] client/pull: log snapshots that are skipped because of time X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 08:52:42 -0000 applied > On 06/07/2021 10:30 AM Dominik Csapak 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 > --- > 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 { > + 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