mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
seaweed-block: a controller Reassign names the line it was decided against
The rebalance and failover asks carry ExpectCurrent, as the controller's endpoint refresh already does, so the publisher refuses one whose line moved while it waited in the queue. A refused ask ends without a publication and the next intake decides again against the new line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b85a870c03
commit
183aee800c
1 file changed
+24
-15
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user