diff --git a/pageserver/src/tenant/timeline/detach_ancestor.rs b/pageserver/src/tenant/timeline/detach_ancestor.rs index 1f52433e4e..1082ee37d1 100644 --- a/pageserver/src/tenant/timeline/detach_ancestor.rs +++ b/pageserver/src/tenant/timeline/detach_ancestor.rs @@ -1069,7 +1069,7 @@ pub(super) async fn detach_and_reparent( "to detach and reparent, gc must still be blocked" ); - let (ancestor, ancestor_lsn) = match ancestor { + let (ancestor, ancestor_lsn, was_detached) = match ancestor { Ancestor::NotDetached(ancestor, ancestor_lsn) => { // this has to complete before any reparentings because otherwise they would not have // layers on the new parent. @@ -1082,9 +1082,9 @@ pub(super) async fn detach_and_reparent( .await .context("publish layers and detach ancestor")?; - (ancestor, ancestor_lsn) + (ancestor, ancestor_lsn, true) } - Ancestor::Detached(ancestor, ancestor_lsn) => (ancestor, ancestor_lsn), + Ancestor::Detached(ancestor, ancestor_lsn) => (ancestor, ancestor_lsn, false), }; let mut tasks = tokio::task::JoinSet::new(); @@ -1215,7 +1215,7 @@ pub(super) async fn detach_and_reparent( Ok(DetachingAndReparenting::Reparented(reparented)) } else { Ok(DetachingAndReparenting::SomeReparentingFailed { - must_restart: reparented.is_empty(), + must_restart: !reparented.is_empty() || was_detached, }) } }