plumbing: collect timelines index parts

This commit is contained in:
Joonas Koivunen
2024-07-23 14:22:34 +00:00
parent 46ca6f17c5
commit 92deb0dfd7
2 changed files with 15 additions and 3 deletions

View File

@@ -1003,7 +1003,7 @@ impl Tenant {
.remove(&timeline_id)
.expect("just put it in above");
shared_state_builder.record_loading_timeline(&index_part);
shared_state_builder.record_loading_timeline(&timeline_id, &index_part);
// TODO again handle early failure
self.load_remote_timeline(

View File

@@ -236,12 +236,24 @@ impl Attempt {
}
#[derive(Default)]
pub(crate) struct SharedStateBuilder {}
pub(crate) struct SharedStateBuilder {
inprogress: std::collections::HashSet<TimelineId>,
}
impl SharedStateBuilder {
/// While loading, visit a timelines persistent [`crate::tenant::IndexPart`] and record if it is being
/// detached.
pub(crate) fn record_loading_timeline(&mut self, _index_part: &crate::tenant::IndexPart) {}
pub(crate) fn record_loading_timeline(
&mut self,
timeline_id: &TimelineId,
index_part: &crate::tenant::IndexPart,
) {
if index_part.ongoing_detach_ancestor.is_some() {
// if the loading a timeline fails, tenant loading must fail as it does right now, or
// something more elaborate needs to be done with this tracking
self.inprogress.insert(*timeline_id);
}
}
/// Merge the loaded not yet deleting in-progress to the existing datastructure.
pub(crate) fn build(self, _target: &SharedState) {}