verify: check all chunks of an index, even if we encounter a corrupt one
this makes it easier to see which chunks are corrupt (and enables us in the future to build a 'complete' list of corrupt chunks) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
d44185c4a1
commit
f66f537da9
|
@ -42,6 +42,7 @@ fn verify_index_chunks(
|
||||||
worker: &WorkerTask,
|
worker: &WorkerTask,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
|
let mut errors = 0;
|
||||||
for pos in 0..index.index_count() {
|
for pos in 0..index.index_count() {
|
||||||
|
|
||||||
worker.fail_on_abort()?;
|
worker.fail_on_abort()?;
|
||||||
|
@ -50,11 +51,19 @@ fn verify_index_chunks(
|
||||||
let size = info.range.end - info.range.start;
|
let size = info.range.end - info.range.start;
|
||||||
|
|
||||||
if !verified_chunks.contains(&info.digest) {
|
if !verified_chunks.contains(&info.digest) {
|
||||||
datastore.verify_stored_chunk(&info.digest, size)?;
|
if let Err(err) = datastore.verify_stored_chunk(&info.digest, size) {
|
||||||
verified_chunks.insert(info.digest);
|
worker.log(format!("{}", err));
|
||||||
|
errors += 1;
|
||||||
|
} else {
|
||||||
|
verified_chunks.insert(info.digest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if errors > 0 {
|
||||||
|
bail!("chunks could not be verified");
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue