diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index fdd6434e49..a24d718f16 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -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( diff --git a/pageserver/src/tenant/timeline/detach_ancestor.rs b/pageserver/src/tenant/timeline/detach_ancestor.rs index 849596ea8c..822c8c7bb5 100644 --- a/pageserver/src/tenant/timeline/detach_ancestor.rs +++ b/pageserver/src/tenant/timeline/detach_ancestor.rs @@ -236,12 +236,24 @@ impl Attempt { } #[derive(Default)] -pub(crate) struct SharedStateBuilder {} +pub(crate) struct SharedStateBuilder { + inprogress: std::collections::HashSet, +} 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) {}