master: re-probe only on a ready AND placeable newer current fact

Review of #130 r5 (one P2): the recovery re-probe triggered on the
newer heartbeat's ReadyForPrimary bit alone. A newer engine-ready but
ineligible, withdrawn or unreachable heartbeat, with the frontend now
ready, led to a re-probe that returned the current primary ready, so
the gate skipped its placeability check and preserved an excluded
primary.

The trigger is now the whole fresh verdict: the newer fact must be
ready and placeable (reachable, eligible, not withdrawn). An excluded
newer fact causes no re-probe, so the first verdict and the gate's
fresh placeability/grace check decide, and the failover stands.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-15 12:42:50 -08:00
1 parent 67dedbe047
commit e5f0c4728e
1 file changed
+8 -4
@@ -482,9 +482,13 @@ func (h *Host) probePromotionCandidates(volumeID string, current authority.Autho
// the current primary's own fresh heartbeat advanced to ready (a newer
// fact, or a new incarnation) while the probe ran, its "not ready"
// verdict may predate a finished recovery, so the probe is run once
// more and that fresh result is used. A heartbeat alone is never taken
// as frontend readiness: the fresh probe still decides, so a frontend
// that is still unready keeps a legitimate failover.
// more and that fresh result is used. The trigger is the whole fresh
// verdict, never the single ReadyForPrimary bit: the newer fact must be
// ready AND placeable (reachable, eligible, not withdrawn), so frontend
// readiness can never preserve a primary the newest fact excludes. A
// heartbeat alone is never taken as frontend readiness either: the fresh
// probe still decides, so a frontend that is still unready keeps a
// legitimate failover.
func (h *Host) probePromotionCandidatesCurrent(volumeID string, current authority.AuthorityBasis, candidates []authority.ReplicaCandidate) (PromotionProbeResult, bool) {
before, beforeOK := h.freshCurrentSlot(volumeID, current.ReplicaID)
result, ok := h.probePromotionCandidates(volumeID, current, candidates)
@@ -492,7 +496,7 @@ func (h *Host) probePromotionCandidatesCurrent(volumeID string, current authorit
return result, ok
}
after, afterOK := h.freshCurrentSlot(volumeID, current.ReplicaID)
if !afterOK || !after.ReadyForPrimary {
if !afterOK || !after.ReadyForPrimary || !after.Reachable || !after.Eligible || after.Withdrawn {
return result, ok
}
if beforeOK && !after.ObservedAt.After(before.ObservedAt) && after.Incarnation == before.Incarnation {