From e966deea38360bc7d60edede7ab685f97de3d054 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 01:01:17 -0800 Subject: [PATCH] fix: retain a newer foreign-holder fence across stale replay --- seaweed-block/core/host/volume/assignment_holder_test.go | 6 ++++++ seaweed-block/core/host/volume/host.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/seaweed-block/core/host/volume/assignment_holder_test.go b/seaweed-block/core/host/volume/assignment_holder_test.go index 1359ea8ed5..943c3b72a6 100644 --- a/seaweed-block/core/host/volume/assignment_holder_test.go +++ b/seaweed-block/core/host/volume/assignment_holder_test.go @@ -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) { diff --git a/seaweed-block/core/host/volume/host.go b/seaweed-block/core/host/volume/host.go index 259e9eae14..1d1591b2c9 100644 --- a/seaweed-block/core/host/volume/host.go +++ b/seaweed-block/core/host/volume/host.go @@ -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() }