diff --git a/zstor/src/actors/repairer.rs b/zstor/src/actors/repairer.rs index 0957a12..c8cd591 100644 --- a/zstor/src/actors/repairer.rs +++ b/zstor/src/actors/repairer.rs @@ -1,10 +1,14 @@ -use crate::actors::{ - backends::{BackendManagerActor, RequestBackends, StateInterest}, - meta::{MetaStoreActor, ObjectMetas}, - zstor::{Rebuild, ZstorActor}, +use crate::{ + actors::{ + backends::{BackendManagerActor, RequestBackends, StateInterest}, + meta::{MetaStoreActor, ObjectMetas}, + zstor::{Rebuild, ZstorActor}, + }, + zdb::ZdbConnectionInfo, }; use actix::prelude::*; -use log::{error, warn}; +use log::{debug, error, warn}; +use std::collections::HashSet; use std::time::Duration; /// Amount of time between starting a new sweep of the backend objects. @@ -79,13 +83,21 @@ impl Handler for RepairActor { }, }; + // prevent same backend from being checked multiple times + let mut unique_zdbs = HashSet::new(); for (key, metadata) in obj_metas.into_iter() { - let backend_requests = metadata + let backend_requests: Vec = metadata .shards() .iter() - .map(|shard_info| shard_info.zdb()) - .cloned() - .collect::>(); + .map(|shard_info| shard_info.zdb().clone()) + .filter(|zdb| unique_zdbs.insert(zdb.clone())) + .collect(); + if backend_requests.is_empty() { + debug!("No unchecked backends found for object: {}", key); + continue; + } + debug!("number of backends to check = {}", backend_requests.len()); + let backends = match backend_manager .send(RequestBackends { backend_requests,