From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/4] tape restore: do not verify restored files
Date: Mon, 3 May 2021 13:23:37 +0200 [thread overview]
Message-ID: <20210503112337.29879-4-dietmar@proxmox.com> (raw)
In-Reply-To: <20210503112337.29879-1-dietmar@proxmox.com>
Because this is too slow and causes the tape motor to stop. Instead,
remove the verify_state from the manifest.
---
src/api2/tape/restore.rs | 53 +++++++++++++---------------------------
1 file changed, 17 insertions(+), 36 deletions(-)
diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
index 2e422cbc..2614c68a 100644
--- a/src/api2/tape/restore.rs
+++ b/src/api2/tape/restore.rs
@@ -32,7 +32,7 @@ use crate::{
task_log,
task_warn,
task::TaskState,
- tools::{compute_file_csum, ParallelHandler},
+ tools::ParallelHandler,
api2::types::{
DATASTORE_MAP_ARRAY_SCHEMA,
DATASTORE_MAP_LIST_SCHEMA,
@@ -51,17 +51,12 @@ use crate::{
},
},
backup::{
- archive_type,
MANIFEST_BLOB_NAME,
CryptMode,
DataStore,
BackupDir,
DataBlob,
BackupManifest,
- ArchiveType,
- IndexFile,
- DynamicIndexReader,
- FixedIndexReader,
},
server::{
lookup_user_email,
@@ -790,8 +785,8 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
worker: &WorkerTask,
decoder: &mut pxar::decoder::sync::Decoder<R>,
snapshot_path: &Path,
- datastore: &DataStore,
- checked_chunks: &mut HashSet<[u8;32]>,
+ _datastore: &DataStore,
+ _checked_chunks: &mut HashSet<[u8;32]>,
) -> Result<(), Error> {
let _root = match decoder.next() {
@@ -848,6 +843,16 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
if filename == manifest_file_name {
let blob = DataBlob::load_from_reader(&mut contents)?;
+ let mut old_manifest = BackupManifest::try_from(blob)?;
+
+ // Remove verify_state to indicate that this snapshot is not verified
+ old_manifest.unprotected
+ .as_object_mut()
+ .map(|m| m.remove("verify_state"));
+
+ let old_manifest = serde_json::to_string_pretty(&old_manifest)?;
+ let blob = DataBlob::encode(old_manifest.as_bytes(), None, true)?;
+
let options = CreateOptions::new();
replace_file(&tmp_path, blob.raw_data(), options)?;
@@ -868,36 +873,12 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
}
}
- let manifest = match manifest {
- None => bail!("missing manifest"),
- Some(manifest) => manifest,
- };
-
- for item in manifest.files() {
- let mut archive_path = snapshot_path.to_owned();
- archive_path.push(&item.filename);
-
- match archive_type(&item.filename)? {
- ArchiveType::DynamicIndex => {
- let index = DynamicIndexReader::open(&archive_path)?;
- let (csum, size) = index.compute_csum();
- manifest.verify_file(&item.filename, &csum, size)?;
- datastore.fast_index_verification(&index, checked_chunks)?;
- }
- ArchiveType::FixedIndex => {
- let index = FixedIndexReader::open(&archive_path)?;
- let (csum, size) = index.compute_csum();
- manifest.verify_file(&item.filename, &csum, size)?;
- datastore.fast_index_verification(&index, checked_chunks)?;
- }
- ArchiveType::Blob => {
- let mut tmpfile = std::fs::File::open(&archive_path)?;
- let (csum, size) = compute_file_csum(&mut tmpfile)?;
- manifest.verify_file(&item.filename, &csum, size)?;
- }
- }
+ if manifest.is_none() {
+ bail!("missing manifest");
}
+ // Do not verify anything here, because this would be to slow (causes tape stops).
+
// commit manifest
let mut manifest_path = snapshot_path.to_owned();
manifest_path.push(MANIFEST_BLOB_NAME);
--
2.20.1
prev parent reply other threads:[~2021-05-03 11:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 11:23 [pbs-devel] [PATCH proxmox-backup 1/4] tape restore: split restore_chunk_archive Dietmar Maurer
2021-05-03 11:23 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape restore: write datastore in separate thread Dietmar Maurer
2021-05-03 11:23 ` [pbs-devel] [PATCH proxmox-backup 3/4] tape restore: add restore speed to logs Dietmar Maurer
2021-05-03 11:23 ` Dietmar Maurer [this message]
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=20210503112337.29879-4-dietmar@proxmox.com \
--to=dietmar@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