From 85171f71fa4dcc426f208ec29a3edb883d2142ef Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 25 Nov 2026 03:26:59 -0800 Subject: [PATCH] replication, master: read the epoch row after the sync; the HTTP evidence provider is test-only LocalPrimaryEvidence synced after reading the table, so a row appended in between was paired with a newer end. Sync first, then read the table. The workload-plan HTTP provider has no production caller since the probe round; it moves to a test file so the round is the one way to evidence. Co-Authored-By: Claude Opus 5.5 --- .../core/host/master/probe_round_host.go | 8 ++++++++ ...ion_probe.go => promotion_probe_http_test.go} | 16 +++++++--------- seaweed-block/core/replication/volume.go | 5 ++++- 3 files changed, 19 insertions(+), 10 deletions(-) rename seaweed-block/core/host/master/{promotion_probe.go => promotion_probe_http_test.go} (97%) diff --git a/seaweed-block/core/host/master/probe_round_host.go b/seaweed-block/core/host/master/probe_round_host.go index b7b26eef98..80cbbfbcd8 100644 --- a/seaweed-block/core/host/master/probe_round_host.go +++ b/seaweed-block/core/host/master/probe_round_host.go @@ -85,3 +85,11 @@ func (s *services) AnswerProbe(ctx context.Context, a *control.ProbeAnswer) (*co s.host.probeHub.deliver(a) return &control.ProbeAck{}, nil } + +func cloneRequiredLSNMap(in map[string]uint64) map[string]uint64 { + out := make(map[string]uint64, len(in)) + for k, v := range in { + out[k] = v + } + return out +} diff --git a/seaweed-block/core/host/master/promotion_probe.go b/seaweed-block/core/host/master/promotion_probe_http_test.go similarity index 97% rename from seaweed-block/core/host/master/promotion_probe.go rename to seaweed-block/core/host/master/promotion_probe_http_test.go index 6354df9c86..ed76a668d4 100644 --- a/seaweed-block/core/host/master/promotion_probe.go +++ b/seaweed-block/core/host/master/promotion_probe_http_test.go @@ -1,11 +1,15 @@ package master +// A test-only promotion evidence provider that reads the replicas' HTTP +// status. Production evidence comes only from the probe round +// (NewRoundPromotionEvidenceProvider); this stays for the tests that drive +// the gate from a workload plan. + import ( "context" "encoding/hex" "encoding/json" "fmt" - "github.com/seaweedfs/seaweed-block/core/storage" "net" "net/http" "net/url" @@ -13,6 +17,8 @@ import ( "strings" "time" + "github.com/seaweedfs/seaweed-block/core/storage" + "github.com/seaweedfs/seaweed-block/core/authority" "github.com/seaweedfs/seaweed-block/core/frontend/durable" "github.com/seaweedfs/seaweed-block/core/host/volume" @@ -242,11 +248,3 @@ func isLocalhostOrLoopbackHost(host string) bool { ip := net.ParseIP(host) return ip != nil && ip.IsLoopback() } - -func cloneRequiredLSNMap(in map[string]uint64) map[string]uint64 { - out := make(map[string]uint64, len(in)) - for k, v := range in { - out[k] = v - } - return out -} diff --git a/seaweed-block/core/replication/volume.go b/seaweed-block/core/replication/volume.go index bef9542096..153fec7871 100644 --- a/seaweed-block/core/replication/volume.go +++ b/seaweed-block/core/replication/volume.go @@ -256,8 +256,11 @@ func (v *ReplicationVolume) EpochTableStatus() EpochTableStatus { // LocalPrimaryEvidence is this volume's epoch table and durable end, as a // primary line's target checks them before adopting the role. func (v *ReplicationVolume) LocalPrimaryEvidence() (EpochTableStatus, uint64, error) { - st := v.EpochTableStatus() + // Sync first, then read the table: a row appended in between is then + // read with an end that already covers it (never an old row with a + // newer end). end, err := v.store.Sync() + st := v.EpochTableStatus() return st, end, err }