diff --git a/seaweed-block/core/host/master/planned_move.go b/seaweed-block/core/host/master/planned_move.go index b764c1e990..88469beda2 100644 --- a/seaweed-block/core/host/master/planned_move.go +++ b/seaweed-block/core/host/master/planned_move.go @@ -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) diff --git a/seaweed-block/core/host/master/product_loop.go b/seaweed-block/core/host/master/product_loop.go index 6b8a53ecdb..c5802f5d0d 100644 --- a/seaweed-block/core/host/master/product_loop.go +++ b/seaweed-block/core/host/master/product_loop.go @@ -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