mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-29 23:07:21 +00:00
refactor: Ancestor::Delete is not needed
This commit is contained in:
@@ -984,7 +984,6 @@ pub(super) async fn complete(
|
||||
enum Ancestor {
|
||||
NotDetached(Arc<Timeline>, Lsn),
|
||||
Detached(Arc<Timeline>, Lsn),
|
||||
Deleted(TimelineId, Lsn),
|
||||
}
|
||||
|
||||
let (recorded_branchpoint, detach_is_ongoing) = {
|
||||
@@ -1018,7 +1017,7 @@ pub(super) async fn complete(
|
||||
if let Some(ancestor) = existing {
|
||||
Ancestor::Detached(ancestor, ancestor_lsn)
|
||||
} else {
|
||||
Ancestor::Deleted(ancestor_id, ancestor_lsn)
|
||||
return Ok((reparented_direct_children(detached, tenant)?, true));
|
||||
}
|
||||
} else {
|
||||
panic!("bug: complete called on a timeline which has not been detached or which has no live ancestor");
|
||||
@@ -1036,6 +1035,8 @@ pub(super) async fn complete(
|
||||
|
||||
let (ancestor, ancestor_lsn) = 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.
|
||||
detached
|
||||
.remote_client
|
||||
.schedule_adding_existing_layers_to_index_detach_and_wait(
|
||||
@@ -1048,9 +1049,6 @@ pub(super) async fn complete(
|
||||
(ancestor, ancestor_lsn)
|
||||
}
|
||||
Ancestor::Detached(ancestor, ancestor_lsn) => (ancestor, ancestor_lsn),
|
||||
Ancestor::Deleted(..) => {
|
||||
return Ok((reparented_direct_children(detached, tenant)?, true));
|
||||
}
|
||||
};
|
||||
|
||||
assert!(detach_is_ongoing, "to reparent, gc must still be blocked");
|
||||
|
||||
Reference in New Issue
Block a user