fix: retain a newer foreign-holder fence across stale replay

This commit is contained in:
pingqiu committed 2026-11-22 01:01:17 -08:00
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) {
+5
View File
@@ -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()
}