fix(master): a fenced failover's fence is pending from the attempt; the unsupported gate heals it

The operator's fencing round may fence survivors above the line whatever
it decides, and an allowed decision may still fail to publish: the fence
is now pending from the attempt until a line reaches its epoch. The
unsupported gate continues the line's own primary at e+1 on a pending
fence before any candidate check, as the supported gate does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-25 17:28:56 -08:00
1 parent 7903ffaeb1
commit 17004151bf
2 files changed
+22 -1

No files matched your search

@@ -139,11 +139,14 @@ func (h *Host) fencedMoveEvidence(volumeID, target, profile string, slots []life
if plain.AckProfile == "" {
plain.AckProfile = profile
}
// Pending from the attempt on: the round may fence survivors above the
// line whatever it decides, and an allowed decision may still fail to
// publish. It is forgotten once a line reaches that epoch.
h.noteFencePending(volumeID, current.Epoch+1)
fenced, allowed := h.fencedDecision(volumeID, current, plain, len(candidates))
if allowed[target] {
return promotionEvidenceFor(fenced, target), nil
}
h.noteFencePending(volumeID, current.Epoch+1)
others := make([]string, 0, len(allowed))
for r := range allowed {
others = append(others, r)
@@ -525,6 +525,17 @@ func (h *Host) applyUnsupportedPromotionEvidenceGate(placements []lifecycle.Plac
// and every start counts toward flap history (#128). The
// promotion rules below are unchanged.
h.recordCurrentBootFact(placement.VolumeID)
// A fencing round fenced survivors above this line and nothing was
// published (e.g. the operator's refused failover): continue the
// line's own primary at e+1 when it is back and answers ready,
// before any candidate check, as the supported gate does.
if line, ok := h.Publisher().VolumeAuthorityLine(placement.VolumeID); ok && line.Assigned &&
h.pendingFence(placement.VolumeID, line.Epoch) && h.freshPrimaryAcceptable(placement.VolumeID, line.ReplicaID) {
if heal, healed := h.healAfterFailedFence(placement.VolumeID, line); healed {
directAsks = append(directAsks, heal)
continue
}
}
if len(placement.Slots) < 2 || !placementIsConcreteExistingReplica(placement) || !unsupportedReasonsAllowPromotionProbe(evidence.Reasons) {
continue
}
@@ -1066,6 +1077,13 @@ func (h *Host) recordCurrentBootFact(volumeID string) {
// freshCurrentSlot returns the replica's own fresh heartbeat slot from
// the observation store (server facts folded in).
// freshPrimaryAcceptable: the replica has a fresh heartbeat slot that is
// reachable, eligible and not withdrawn.
func (h *Host) freshPrimaryAcceptable(volumeID, replicaID string) bool {
s, ok := h.freshCurrentSlot(volumeID, replicaID)
return ok && s.Reachable && s.Eligible && !s.Withdrawn
}
func (h *Host) freshCurrentSlot(volumeID, replicaID string) (authority.ReplicaCandidate, bool) {
if h.obs == nil {
return authority.ReplicaCandidate{}, false