From dfdf40916fe6ab0896ba01ad3e341e6f4a0c0ab4 Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Fri, 19 Jul 2024 14:42:16 +0000 Subject: [PATCH] rename complete_detaching_from_ancestor it hasn't meant completing in a while now :) --- pageserver/src/tenant/mgr.rs | 2 +- pageserver/src/tenant/timeline.rs | 17 +++++++++++------ .../src/tenant/timeline/detach_ancestor.rs | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pageserver/src/tenant/mgr.rs b/pageserver/src/tenant/mgr.rs index 8da2ce84e6..e3a827cbe8 100644 --- a/pageserver/src/tenant/mgr.rs +++ b/pageserver/src/tenant/mgr.rs @@ -2025,7 +2025,7 @@ impl TenantManager { let timeline = tenant.get_timeline(timeline_id, true)?; let (resp, reparented_all) = timeline - .complete_detaching_timeline_ancestor(&tenant, prepared, ctx) + .detach_from_ancestor_and_reparent(&tenant, prepared, ctx) .await?; let mut slot_guard = slot_guard.into_inner(); diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 543324228b..5e7bf72784 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -4746,18 +4746,23 @@ impl Timeline { detach_ancestor::prepare(self, tenant, options, ctx).await } - /// Completes the ancestor detach. This method is to be called while holding the - /// TenantManager's tenant slot, so during this method we cannot be deleted nor can any - /// timeline be deleted. After this method returns successfully, tenant must be reloaded. + /// Second step of detach from ancestor; detaches the `self` from it's current ancestor and + /// reparents any reparentable children of previous ancestor. + /// + /// This method is to be called while + /// holding the TenantManager's tenant slot, so during this method we cannot be deleted nor can + /// any timeline be deleted. After this method returns successfully, tenant must be reloaded. + /// + /// Final step will be to complete after optionally resetting the tenant. /// /// Pageserver receiving a SIGKILL during this operation is not supported (yet). - pub(crate) async fn complete_detaching_timeline_ancestor( + pub(crate) async fn detach_from_ancestor_and_reparent( self: &Arc, tenant: &crate::tenant::Tenant, prepared: detach_ancestor::PreparedTimelineDetach, ctx: &RequestContext, - ) -> Result<(Vec, bool), anyhow::Error> { - detach_ancestor::complete(self, tenant, prepared, ctx).await + ) -> Result { + detach_ancestor::detach_and_reparent(self, tenant, prepared, ctx).await } /// Switch aux file policy and schedule upload to the index part. diff --git a/pageserver/src/tenant/timeline/detach_ancestor.rs b/pageserver/src/tenant/timeline/detach_ancestor.rs index efc760afec..5b9201dfa4 100644 --- a/pageserver/src/tenant/timeline/detach_ancestor.rs +++ b/pageserver/src/tenant/timeline/detach_ancestor.rs @@ -970,8 +970,8 @@ async fn remote_copy( .map_err(CopyFailed) } -/// See [`Timeline::complete_detaching_timeline_ancestor`]. -pub(super) async fn complete( +/// See [`Timeline::detach_from_ancestor_and_reparent`]. +pub(super) async fn detach_and_reparent( detached: &Arc, tenant: &Tenant, prepared: PreparedTimelineDetach,