mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 09:22:55 +00:00
refactor: still_ongoing assert is shared in all paths
This commit is contained in:
@@ -1113,6 +1113,10 @@ pub(super) async fn detach_and_reparent(
|
||||
.is_some_and(|b| b.blocked_by_detach_ancestor()),
|
||||
)
|
||||
};
|
||||
assert!(
|
||||
still_ongoing,
|
||||
"cannot (detach? reparent)? complete if the operation is not still ongoing"
|
||||
);
|
||||
|
||||
let ancestor = if let Some(ancestor) = detached.ancestor_timeline.as_ref() {
|
||||
assert!(
|
||||
@@ -1135,10 +1139,6 @@ pub(super) async fn detach_and_reparent(
|
||||
if let Some(ancestor) = existing {
|
||||
Ancestor::Detached(ancestor, ancestor_lsn)
|
||||
} else {
|
||||
assert!(
|
||||
still_ongoing,
|
||||
"cannot complete if the operation is not still ongoing"
|
||||
);
|
||||
let direct_children =
|
||||
reparented_direct_children(detached, tenant).map_err(Error::from)?;
|
||||
return Ok(DetachingAndReparenting::AlreadyDone(direct_children));
|
||||
@@ -1154,10 +1154,6 @@ pub(super) async fn detach_and_reparent(
|
||||
//
|
||||
// if we crash after this operation, a retry will allow reparenting the remaining timelines as
|
||||
// gc is blocked.
|
||||
assert!(
|
||||
still_ongoing,
|
||||
"to detach or reparent, gc must still be blocked"
|
||||
);
|
||||
|
||||
let (ancestor, ancestor_lsn, was_detached) = match ancestor {
|
||||
Ancestor::NotDetached(ancestor, ancestor_lsn) => {
|
||||
|
||||
Reference in New Issue
Block a user