From: Stefan Reiter <s.reiter@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 6/7] Revert "backup: ensure base snapshots are still available after backup"
Date: Tue, 4 Aug 2020 12:42:04 +0200 [thread overview]
Message-ID: <20200804104205.29540-7-s.reiter@proxmox.com> (raw)
In-Reply-To: <20200804104205.29540-1-s.reiter@proxmox.com>
This reverts commit d53fbe24741ed3bd920ee1c61bc163b1874b7c82.
The HashSet and "register" function are unnecessary, as we already know
which backup is the one we need to check: the last one, stored as
'last_backup'.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
The next patch restores this functionality in a much simpler way.
src/api2/backup.rs | 1 -
src/api2/backup/environment.rs | 21 +--------------------
src/backup/backup_info.rs | 2 +-
3 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/src/api2/backup.rs b/src/api2/backup.rs
index 29b1a606..4b751e3e 100644
--- a/src/api2/backup.rs
+++ b/src/api2/backup.rs
@@ -661,7 +661,6 @@ fn download_previous(
};
if let Some(index) = index {
env.log(format!("register chunks in '{}' from previous backup.", archive_name));
- env.register_base_snapshot(last_backup.backup_dir.clone());
for pos in 0..index.index_count() {
let info = index.chunk_info(pos).unwrap();
diff --git a/src/api2/backup/environment.rs b/src/api2/backup/environment.rs
index bc780d20..aa039cd9 100644
--- a/src/api2/backup/environment.rs
+++ b/src/api2/backup/environment.rs
@@ -1,6 +1,6 @@
use anyhow::{bail, format_err, Error};
use std::sync::{Arc, Mutex};
-use std::collections::{HashMap, HashSet};
+use std::collections::HashMap;
use ::serde::{Serialize};
use serde_json::{json, Value};
@@ -72,7 +72,6 @@ struct SharedBackupState {
dynamic_writers: HashMap<usize, DynamicWriterState>,
fixed_writers: HashMap<usize, FixedWriterState>,
known_chunks: HashMap<[u8;32], u32>,
- base_snapshots: HashSet<BackupDir>,
backup_size: u64, // sums up size of all files
backup_stat: UploadStatistic,
}
@@ -126,7 +125,6 @@ impl BackupEnvironment {
dynamic_writers: HashMap::new(),
fixed_writers: HashMap::new(),
known_chunks: HashMap::new(),
- base_snapshots: HashSet::new(),
backup_size: 0,
backup_stat: UploadStatistic::new(),
};
@@ -145,13 +143,6 @@ impl BackupEnvironment {
}
}
- /// Register a snapshot as a predecessor of the current backup.
- /// It's existance will be ensured on finishing.
- pub fn register_base_snapshot(&self, snap: BackupDir) {
- let mut state = self.state.lock().unwrap();
- state.base_snapshots.insert(snap);
- }
-
/// Register a Chunk with associated length.
///
/// We do not fully trust clients, so a client may only use registered
@@ -488,16 +479,6 @@ impl BackupEnvironment {
self.datastore.store_manifest(&self.backup_dir, manifest)
.map_err(|err| format_err!("unable to store manifest blob - {}", err))?;
- for snap in &state.base_snapshots {
- let path = self.datastore.snapshot_path(snap);
- if !path.exists() {
- bail!(
- "base snapshot {} was removed during backup, cannot finish as chunks might be missing",
- snap
- );
- }
- }
-
// marks the backup as successful
state.finished = true;
diff --git a/src/backup/backup_info.rs b/src/backup/backup_info.rs
index c35928ce..5bd8b8d5 100644
--- a/src/backup/backup_info.rs
+++ b/src/backup/backup_info.rs
@@ -218,7 +218,7 @@ impl std::str::FromStr for BackupGroup {
/// Uniquely identify a Backup (relative to data store)
///
/// We also call this a backup snaphost.
-#[derive(Debug, Eq, PartialEq, Hash, Clone)]
+#[derive(Debug, Eq, PartialEq, Clone)]
pub struct BackupDir {
/// Backup group
group: BackupGroup,
--
2.20.1
next prev parent reply other threads:[~2020-08-04 10:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-04 10:41 [pbs-devel] [PATCH 0/7] More flocking and race elimination Stefan Reiter
2020-08-04 10:41 ` [pbs-devel] [PATCH proxmox-backup 1/7] finish_backup: mark backup as finished only after checks have passed Stefan Reiter
2020-08-06 4:39 ` [pbs-devel] applied: " Dietmar Maurer
2020-08-04 10:42 ` [pbs-devel] [PATCH proxmox-backup 2/7] backup: only allow finished backups as base snapshot Stefan Reiter
2020-08-06 4:45 ` Dietmar Maurer
2020-08-06 7:58 ` Stefan Reiter
2020-08-07 5:40 ` [pbs-devel] applied: " Dietmar Maurer
2020-08-04 10:42 ` [pbs-devel] [PATCH proxmox-backup 3/7] datastore: prevent in-use deletion with locks instead of heuristic Stefan Reiter
2020-08-06 4:51 ` Dietmar Maurer
2020-08-04 10:42 ` [pbs-devel] [PATCH proxmox-backup 4/7] prune: also check backup snapshot locks Stefan Reiter
2020-08-05 7:23 ` Fabian Ebner
2020-08-05 8:34 ` Stefan Reiter
2020-08-04 10:42 ` [pbs-devel] [PATCH proxmox-backup 5/7] backup: flock snapshot on backup start Stefan Reiter
2020-08-04 10:42 ` Stefan Reiter [this message]
2020-08-04 10:42 ` [pbs-devel] [PATCH proxmox-backup 7/7] backup: lock base snapshot and ensure existance on finish Stefan Reiter
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=20200804104205.29540-7-s.reiter@proxmox.com \
--to=s.reiter@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.