mark_used_chunks: simply ignore vanished files

In case a prune operation removed a file in the meantime.
This commit is contained in:
Dietmar Maurer 2020-10-16 08:01:38 +02:00
parent b947b1e7ee
commit e07620028d
1 changed files with 19 additions and 7 deletions

View File

@ -460,15 +460,27 @@ impl DataStore {
worker.check_abort()?; worker.check_abort()?;
tools::fail_on_shutdown()?; tools::fail_on_shutdown()?;
let full_path = self.chunk_store.relative_path(&path);
match std::fs::File::open(&full_path) {
Ok(file) => {
if let Ok(archive_type) = archive_type(&path) { if let Ok(archive_type) = archive_type(&path) {
if archive_type == ArchiveType::FixedIndex { if archive_type == ArchiveType::FixedIndex {
let index = self.open_fixed_reader(&path)?; let index = FixedIndexReader::new(file)?;
self.index_mark_used_chunks(index, &path, status, worker)?; self.index_mark_used_chunks(index, &path, status, worker)?;
} else if archive_type == ArchiveType::DynamicIndex { } else if archive_type == ArchiveType::DynamicIndex {
let index = self.open_dynamic_reader(&path)?; let index = DynamicIndexReader::new(file)?;
self.index_mark_used_chunks(index, &path, status, worker)?; self.index_mark_used_chunks(index, &path, status, worker)?;
} }
} }
}
Err(err) => {
if err.kind() == std::io::ErrorKind::NotFound {
// simply ignore vanished files
} else {
return Err(err.into());
}
}
}
done += 1; done += 1;
let percentage = done*100/image_count; let percentage = done*100/image_count;