tape restore: do not verify restored files
Because this is too slow and causes the tape motor to stop. Instead, remove the verify_state from the manifest.
This commit is contained in:
parent
88aa3076f0
commit
603aa09d54
|
@ -32,7 +32,7 @@ use crate::{
|
||||||
task_log,
|
task_log,
|
||||||
task_warn,
|
task_warn,
|
||||||
task::TaskState,
|
task::TaskState,
|
||||||
tools::{compute_file_csum, ParallelHandler},
|
tools::ParallelHandler,
|
||||||
api2::types::{
|
api2::types::{
|
||||||
DATASTORE_MAP_ARRAY_SCHEMA,
|
DATASTORE_MAP_ARRAY_SCHEMA,
|
||||||
DATASTORE_MAP_LIST_SCHEMA,
|
DATASTORE_MAP_LIST_SCHEMA,
|
||||||
|
@ -51,17 +51,12 @@ use crate::{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
backup::{
|
backup::{
|
||||||
archive_type,
|
|
||||||
MANIFEST_BLOB_NAME,
|
MANIFEST_BLOB_NAME,
|
||||||
CryptMode,
|
CryptMode,
|
||||||
DataStore,
|
DataStore,
|
||||||
BackupDir,
|
BackupDir,
|
||||||
DataBlob,
|
DataBlob,
|
||||||
BackupManifest,
|
BackupManifest,
|
||||||
ArchiveType,
|
|
||||||
IndexFile,
|
|
||||||
DynamicIndexReader,
|
|
||||||
FixedIndexReader,
|
|
||||||
},
|
},
|
||||||
server::{
|
server::{
|
||||||
lookup_user_email,
|
lookup_user_email,
|
||||||
|
@ -790,8 +785,8 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
|
||||||
worker: &WorkerTask,
|
worker: &WorkerTask,
|
||||||
decoder: &mut pxar::decoder::sync::Decoder<R>,
|
decoder: &mut pxar::decoder::sync::Decoder<R>,
|
||||||
snapshot_path: &Path,
|
snapshot_path: &Path,
|
||||||
datastore: &DataStore,
|
_datastore: &DataStore,
|
||||||
checked_chunks: &mut HashSet<[u8;32]>,
|
_checked_chunks: &mut HashSet<[u8;32]>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
let _root = match decoder.next() {
|
let _root = match decoder.next() {
|
||||||
|
@ -848,6 +843,16 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
|
||||||
if filename == manifest_file_name {
|
if filename == manifest_file_name {
|
||||||
|
|
||||||
let blob = DataBlob::load_from_reader(&mut contents)?;
|
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();
|
let options = CreateOptions::new();
|
||||||
replace_file(&tmp_path, blob.raw_data(), options)?;
|
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 {
|
if manifest.is_none() {
|
||||||
None => bail!("missing manifest"),
|
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)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not verify anything here, because this would be to slow (causes tape stops).
|
||||||
|
|
||||||
// commit manifest
|
// commit manifest
|
||||||
let mut manifest_path = snapshot_path.to_owned();
|
let mut manifest_path = snapshot_path.to_owned();
|
||||||
manifest_path.push(MANIFEST_BLOB_NAME);
|
manifest_path.push(MANIFEST_BLOB_NAME);
|
||||||
|
|
Loading…
Reference in New Issue