From 6b68d65880ca2af280bbc974cf450ce4458b918b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 10 Sep 2026 22:32:30 +0200 Subject: [PATCH] Count refused continuity restarts from history too Failed restarts retire to history.cc as soon as they finish, so the give-up counter that read only the live set found zero every time and restarted a release that could not start forever. Seen on yggdrasil during the projection-key migration. Verified with cargo test --lib in rust:1.95-bookworm on yggdrasil: 114 passed. Co-Authored-By: Claude Fable 5.1 --- src/control_plane.rs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/control_plane.rs b/src/control_plane.rs index c34a1b7..6b64531 100644 --- a/src/control_plane.rs +++ b/src/control_plane.rs @@ -3190,21 +3190,30 @@ impl Engine { // Counted against this generation id, so a successful restart -- // which admits a new generation -- starts the count over rather // than carrying old failures forward. + // Failed restarts retire to history the moment they finish, so + // the count must read history: counting only the live set found + // zero every time and restarted a release that could not start + // forever, which is the loop the give-up exists to end. + let is_refused_restart = |transaction: &DeploymentTransaction| { + transaction.target == current.value.target + && transaction.command_kind == CommandKind::Continuity + && transaction.incumbent_generation_id.as_deref() + == Some(current.value.generation_id.as_str()) + && matches!( + transaction.completion, + Some(TransactionCompletion::FailedBeforeFencing { .. }) + | Some(TransactionCompletion::FailedAfterFencing { .. }) + ) + }; let refused_restarts = snapshot .transactions .iter() - .filter(|stored| { - stored.value.target == current.value.target - && stored.value.command_kind == CommandKind::Continuity - && stored.value.incumbent_generation_id.as_deref() - == Some(current.value.generation_id.as_str()) - && matches!( - stored.value.completion, - Some(TransactionCompletion::FailedBeforeFencing { .. }) - | Some(TransactionCompletion::FailedAfterFencing { .. }) - ) - }) - .count(); + .filter(|stored| is_refused_restart(&stored.value)) + .count() + + read_history_transactions(&self.options.state_store) + .iter() + .filter(|transaction| is_refused_restart(transaction)) + .count(); if let Some(blocker) = blocker { // Yielding a *deployment* to continuity is right: the incumbent