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 }