mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
fix: retain a newer foreign-holder fence across stale replay
This commit is contained in:
1 parent
5d28c43504
commit
e966deea38
2 files changed
+11
No files matched your search
@@ -99,6 +99,12 @@ func TestAssignmentHolderIdentityFencesPreviouslyHealthySameReplica(t *testing.T
|
||||
if h.view.Projection().Healthy {
|
||||
t.Fatal("same-r1 foreign holder left the old frontend healthy")
|
||||
}
|
||||
stale := holderAssignment(t, "new-host")
|
||||
stale.Epoch = 0
|
||||
h.applyFact(stale)
|
||||
if h.view.Projection().Healthy {
|
||||
t.Fatal("stale foreign replay erased the newer fencing line")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignmentHolderIdentityRefusesCarriedEndpointMismatch(t *testing.T) {
|
||||
|
||||
@@ -235,6 +235,11 @@ func (h *Host) recordOtherLine(f *control.AssignmentFact) {
|
||||
// is the canonical safe deep-copy for proto messages.
|
||||
cp := proto.Clone(f).(*control.AssignmentFact)
|
||||
h.otherMu.Lock()
|
||||
// A stale replay must not erase the newer foreign-holder fence (r2.34).
|
||||
if old := h.lastOther; old != nil && (cp.Epoch < old.Epoch || cp.Epoch == old.Epoch && cp.EndpointVersion < old.EndpointVersion) {
|
||||
h.otherMu.Unlock()
|
||||
return
|
||||
}
|
||||
h.lastOther = cp
|
||||
h.otherMu.Unlock()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user