fix blocksync not resyncing compressed blocs properly #89

Merged
lx merged 1 commit from trinity-1686a/garage:fix-blocksync-storage-opti into storage-optimizations 2021-06-01 21:54:45 +00:00
Showing only changes of commit e44bec738c - Show all commits

View file

@ -599,11 +599,19 @@ impl BlockManager {
Err(_) => continue, Err(_) => continue,
}; };
let ent_type = data_dir_ent.file_type().await?; let ent_type = data_dir_ent.file_type().await?;
let mut iter_name = name.split('.');
let name = iter_name
.next()
.expect("split always contain at least one item");
let corrupted = iter_name
.last()
.map(|ext| ext == "corrupted")
.unwrap_or(false);
if name.len() == 2 && hex::decode(&name).is_ok() && ent_type.is_dir() { if name.len() == 2 && hex::decode(&name).is_ok() && ent_type.is_dir() {
self.repair_aux_read_dir_rec(&data_dir_ent.path(), must_exit) self.repair_aux_read_dir_rec(&data_dir_ent.path(), must_exit)
.await?; .await?;
} else if name.len() == 64 { } else if name.len() == 64 && !corrupted {
let hash_bytes = match hex::decode(&name) { let hash_bytes = match hex::decode(&name) {
Ok(h) => h, Ok(h) => h,
Err(_) => continue, Err(_) => continue,