Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to data rebuild #136

Open
1 of 3 tasks
iwanbk opened this issue Nov 29, 2024 · 1 comment
Open
1 of 3 tasks

Improvements to data rebuild #136

iwanbk opened this issue Nov 29, 2024 · 1 comment
Assignees

Comments

@iwanbk
Copy link
Member

iwanbk commented Nov 29, 2024

Improve the periodic SweepObject:

  • replace object_metas (func to get all metadata) which returns Vector to something which returns Stream or using Redis scan (improve sweep object to use scan. #140)
  • Avoid duplicated backend checking
  • cache unhealthy backend check
  • Make the period longer, 10 mins is too fast, especially for big storage

Previous discussion: #131

Code reference:

impl Handler<SweepObjects> for RepairActor {
type Result = ResponseFuture<()>;
fn handle(&mut self, _: SweepObjects, _: &mut Self::Context) -> Self::Result {
let meta = self.meta.clone();
let backend_manager = self.backend_manager.clone();
let zstor = self.zstor.clone();
Box::pin(async move {
let obj_metas = match meta.send(ObjectMetas).await {
Err(e) => {
error!("Could not request object metas from metastore: {}", e);
return;
}
Ok(om) => match om {
Err(e) => {
error!("Could not get object metas from metastore: {}", e);
return;
}
Ok(om) => om,
},
};
for (key, metadata) in obj_metas.into_iter() {
let backend_requests = metadata
.shards()
.iter()
.map(|shard_info| shard_info.zdb())
.cloned()
.collect::<Vec<_>>();
let backends = match backend_manager
.send(RequestBackends {
backend_requests,
interest: StateInterest::Readable,
})
.await
{
Err(e) => {
error!("Failed to request backends: {}", e);
return;
}
Ok(backends) => backends,
};
let must_rebuild = backends.into_iter().any(|b| !matches!(b, Ok(Some(_))));
if must_rebuild {
if let Err(e) = zstor
.send(Rebuild {
file: None,
key: Some(key),
})
.await
{
warn!("Failed to rebuild data: {}", e);
}
}
}
})
}
}

@iwanbk
Copy link
Member Author

iwanbk commented Dec 6, 2024

Avoid duplicated backend checking

I found that 0-stor already have this mechanism for the healthy backend.
For the unhealthy backend, we don't have it.
Added cache unhealthy backend check to the task list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant