public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/6] fix #2860: skip in-progress snapshots when syncing
Date: Tue, 21 Jul 2020 15:03:33 +0200	[thread overview]
Message-ID: <20200721130337.934653-3-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20200721130337.934653-1-f.gruenbichler@proxmox.com>

they don't have a final manifest yet and are not done, so they can't be
synced either.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/client/pull.rs | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/client/pull.rs b/src/client/pull.rs
index 5cf0dd1f..bbe01969 100644
--- a/src/client/pull.rs
+++ b/src/client/pull.rs
@@ -6,7 +6,6 @@ use std::convert::TryFrom;
 use std::sync::Arc;
 use std::collections::HashMap;
 use std::io::{Seek, SeekFrom};
-use chrono::{Utc, TimeZone};
 
 use crate::server::{WorkerTask};
 use crate::backup::*;
@@ -302,7 +301,16 @@ pub async fn pull_group(
     let mut remote_snapshots = std::collections::HashSet::new();
 
     for item in list {
-        let backup_time = Utc.timestamp(item.backup_time, 0);
+        let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time);
+
+        // in-progress backups can't be synced
+        if let None = item.size {
+            worker.log(format!("skipping snapshot {} - in-progress backup", snapshot));
+            continue;
+        }
+
+        let backup_time = snapshot.backup_time();
+
         remote_snapshots.insert(backup_time);
 
         if let Some(last_sync_time) = last_sync {
@@ -319,14 +327,12 @@ pub async fn pull_group(
             new_client,
             None,
             src_repo.store(),
-            &item.backup_type,
-            &item.backup_id,
+            snapshot.group().backup_type(),
+            snapshot.group().backup_id(),
             backup_time,
             true,
         ).await?;
 
-        let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time);
-
         pull_snapshot_from(worker, reader, tgt_store.clone(), &snapshot).await?;
     }
 
-- 
2.20.1





  parent reply	other threads:[~2020-07-21 13:04 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 ` Fabian Grünbichler [this message]
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
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=20200721130337.934653-3-f.gruenbichler@proxmox.com \
    --to=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