diff --git a/seaweed-block/core/authority/controller.go b/seaweed-block/core/authority/controller.go index 2318ee74f4..e3fb480786 100644 --- a/seaweed-block/core/authority/controller.go +++ b/seaweed-block/core/authority/controller.go @@ -566,13 +566,14 @@ func (c *TopologyController) decideVolume( return AssignmentAsk{}, "the current primary is acceptable; rebalance target " + target.ReplicaID + " has no planned-move evidence", false } return AssignmentAsk{ - VolumeID: vol.VolumeID, - ReplicaID: target.ReplicaID, - DataAddr: target.DataAddr, - CtrlAddr: target.CtrlAddr, - Intent: IntentReassign, - Evidence: plannedEvidence(target.PromotionEvidence), - Incarnation: target.Incarnation, + VolumeID: vol.VolumeID, + ReplicaID: target.ReplicaID, + DataAddr: target.DataAddr, + CtrlAddr: target.CtrlAddr, + Intent: IntentReassign, + Evidence: plannedEvidence(target.PromotionEvidence), + Incarnation: target.Incarnation, + ExpectCurrent: expectedLineOf(currentLine), }, "rebalance", true } return AssignmentAsk{}, "the current primary is acceptable", false @@ -599,13 +600,14 @@ func (c *TopologyController) decideVolume( // its target (one decider): no evidence, no promotion. if best.PromotionEvidence.Kind == adapter.PrimaryKindPromotion { return AssignmentAsk{ - VolumeID: vol.VolumeID, - ReplicaID: best.ReplicaID, - DataAddr: best.DataAddr, - CtrlAddr: best.CtrlAddr, - Intent: IntentReassign, - Evidence: best.PromotionEvidence, - Incarnation: best.Incarnation, + VolumeID: vol.VolumeID, + ReplicaID: best.ReplicaID, + DataAddr: best.DataAddr, + CtrlAddr: best.CtrlAddr, + Intent: IntentReassign, + Evidence: best.PromotionEvidence, + Incarnation: best.Incarnation, + ExpectCurrent: expectedLineOf(currentLine), }, "failover", true } why = "failover target " + best.ReplicaID + " has no promotion evidence" @@ -639,10 +641,17 @@ func refreshAsk(volumeID string, current ReplicaCandidate, line AuthorityBasis) CtrlAddr: current.CtrlAddr, Intent: IntentRefreshEndpoint, Incarnation: current.Incarnation, - ExpectCurrent: &ExpectedLine{ReplicaID: line.ReplicaID, Epoch: line.Epoch, DataAddr: line.DataAddr, CtrlAddr: line.CtrlAddr}, + ExpectCurrent: expectedLineOf(line), } } +// expectedLineOf conditions an ask on the line it was decided against: a +// publication that lands while the ask waits in the queue (an operator's +// failback) refuses it instead of being overwritten. +func expectedLineOf(line AuthorityBasis) *ExpectedLine { + return &ExpectedLine{ReplicaID: line.ReplicaID, Epoch: line.Epoch, DataAddr: line.DataAddr, CtrlAddr: line.CtrlAddr} +} + func volumeIncludesReplica(vol VolumeTopologySnapshot, replicaID string) bool { for _, slot := range vol.Slots { if slot.ReplicaID == replicaID {