T4a-5: wire Host authority-callback to ReplicationVolume (P-refined)

Completes the T4a-5.0 §8C.3 Discovery Bridge resolution (Option
P-refined, landed per architect + QA round-19). Extends the
AssignmentFact wire with master-minted peer set + monotonic
generation, adds a separate host-only decode path that does NOT
touch AssignmentInfo (preserves the TestNoOtherAssignment
InfoConstruction AST fence), and wires Host.streamOnce to drive
ReplicationVolume.UpdateReplicaSet after every self-replica
AssignmentFact.

Guardrails (all four from round-19) honored:
  1. decodeAssignmentFact unchanged; AST fence stays green.
  2. decodeReplicaTargets is SEPARATE and produces replication.
     ReplicaTarget + generation, never AssignmentInfo. Adapter +
     engine packages: zero changes.
  3. Peer set is master-minted only. Host does NOT accumulate or
     derive from other-replica facts (option R rejected).
  4. peer_set_generation mandatory on the wire; monotonic guard in
     ReplicationVolume.UpdateReplicaSet.

Changes:

  core/rpc/proto/control.proto
    NEW message ReplicaDescriptor{replica_id, epoch, endpoint_
    version, data_addr, ctrl_addr}. AssignmentFact gains
    `repeated ReplicaDescriptor peers = 7` (excludes self) and
    `uint64 peer_set_generation = 8` (monotonic, master-minted).

  core/rpc/control/control.pb.go + control_grpc.pb.go
    Regenerated via scripts/genproto.sh.

  core/host/master/services.go
    SubscribeAssignments fills fact.Peers via new collectPeers
    helper (reads Publisher.LastPublished for each non-self slot
    in the volume's accepted topology). Generation derived as
    `(info.Epoch << 32) | info.EndpointVersion` — monotonic
    because publisher's lex-dedupe upstream guarantees strictly-
    increasing (Epoch, EV) pairs and Epoch/EV are durable authority
    facts (survives master restart).

  core/host/volume/subscribe.go
    NEW decodeReplicaTargets(fact) ([]replication.ReplicaTarget,
    uint64) — strict field-copy, same discipline as decode
    AssignmentFact. Produces a different output type so the
    AST fence TestNoOtherAssignmentInfoConstruction continues to
    pass.

  core/host/volume/host.go
    Config gains `ReplicationVolume *replication.ReplicationVolume`
    (nil = T0/observer-only; non-nil = T4a-5 production wire).
    streamOnce self-replica branch calls UpdateReplicaSet(gen,
    targets) AFTER adapter.OnAssignment. Non-blocking log on
    error (best-effort; failure does not stop the assignment
    stream).

  core/replication/volume.go
    UpdateReplicaSet signature break (QA option (a), no shim):
      Before: UpdateReplicaSet(targets []ReplicaTarget) error
      After:  UpdateReplicaSet(generation uint64, targets []ReplicaTarget) error

    Three-way generation rule (T4a-5.0 §9.4, QA corrected sw's
    original MaxUint64 sentinel which would have one-way-poisoned
    the monotonic guard):
      - gen == 0: unversioned apply; peer map mutated;
        lastAppliedGeneration NOT advanced. Test/fake-master only.
      - gen > 0 && gen > lastApplied: apply + advance.
      - gen > 0 && gen <= lastApplied: stale; peer map NOT mutated;
        replayedGens counter increments; debug log emits peer-ID-
        set delta (Q2 binding — IDs only, not full target structs).
        Returns nil (idempotent replay is success).

    Empty peer set (N → 0) flows through the same teardown path as
    any N → M-1 removal. No special branch (Q3 binding).

    New state: lastAppliedGeneration uint64 (mu-guarded);
    replayedGens atomic.Uint64 (stats counter, private; public
    Stats() deferred to T4-end observability pass).

    New helpers (internal): peerIDSet, targetIDSet,
    stringSetEqual, formatIDSet (deterministic brace-form
    rendering of peer-ID sets for log diffs).

  core/replication/volume_test.go
    All 8 existing tests migrated to new signature with gen=0
    (unversioned apply preserves previous functional semantics).
    3 new tests (Q1/Q2/Q3 pins):
      9.  UpdateReplicaSet_Generation_MonotonicGuard — advance
          through gens 1, 2, 3; stale replays at gen=2 and gen=3
          (equal is stale); verify replayedGens counter; forward
          progress at gen=4 works. Exercises Q2 differing-peers
          path via the gen=2 replay with original r1+r2 set.
      10. UpdateReplicaSet_GenerationZero_DoesNotAdvanceGuard —
          gen=5 applied, gen=0 applied (peers mutated, last
          Applied stays at 5), gen=3 rejected as stale. Pins the
          correctness of the gen=0 rule vs. the original
          MaxUint64 sentinel which would have failed this test.
      11. UpdateReplicaSet_EmptyPeerSet_AppliesWithTeardown — Q3
          binding three assertions: PeerCount=0 after empty
          apply, all former peers' executor sessions invalidated,
          next OnLocalWrite succeeds as zero-fanout no-op.

Verification: full 20-package repo suite green (core/host: 124s
including supersede_integration_test; core/host/volume: 31ms
confirming AST fence TestNoOtherAssignmentInfoConstruction still
passes; core/replication: all 17 tests green). G-2 tri-line godoc
on every new public surface.

Closes T4a-5.0 §8C.3 Discovery Bridge. Next: T4a-6 L2 subprocess
integration test.
This commit is contained in:
wzcheng99 committed 2026-04-23 16:50:01 -07:00
1 parent 3597bc40ca
commit db3be2e58c
7 files changed
+706 -104

No files matched your search

@@ -189,6 +189,17 @@ func (s *services) SubscribeAssignments(req *control.SubscribeRequest, stream co
DataAddr: info.DataAddr,
CtrlAddr: info.CtrlAddr,
}
// T4a-5 P-refined: populate the peer set from publisher
// LastPublished queries for every non-self replica slot in
// this volume's topology. peer_set_generation is derived
// from the authoritative line's (Epoch, EndpointVersion)
// so it is monotonic across process lifetimes (the
// publisher's lex-dedupe upstream guarantees strictly-
// increasing (Epoch, EV) pairs within the stream, and the
// same ordering is preserved across master restarts
// because Epoch/EV are durable authority facts).
fact.Peers = s.collectPeers(req.VolumeId, info.ReplicaID)
fact.PeerSetGeneration = (info.Epoch << 32) | uint64(uint32(info.EndpointVersion))
if err := stream.Send(fact); err != nil {
return err
}
@@ -264,6 +275,46 @@ func validateHeartbeat(r *control.HeartbeatReport) error {
return nil
}
// collectPeers builds the AssignmentFact.peers list for a volume
// from the publisher's most-recent authoritative lines. Only
// replicas OTHER than self_replica are included — the primary
// does not ship to itself. Slots with no published line yet are
// skipped (they'll appear in later emissions once their line
// lands; cold-start is therefore benign, not erroneous).
//
// This is the T4a-5 peer-set construction site. It is strictly
// a READ of publisher state — no caching, no derivation, no
// local accumulation (option R rejected in T4a-5.0 discovery
// doc §9.5). Peer membership comes from accepted topology
// (replicaSlotsFor) and per-peer line content comes from the
// publisher's durable LastPublished state — both are
// master-authoritative.
func (s *services) collectPeers(volumeID, selfReplicaID string) []*control.ReplicaDescriptor {
slots := s.host.replicaSlotsFor(volumeID)
if len(slots) == 0 {
return nil
}
pub := s.host.boot.Publisher
peers := make([]*control.ReplicaDescriptor, 0, len(slots))
for _, rid := range slots {
if rid == selfReplicaID {
continue
}
info, ok := pub.LastPublished(volumeID, rid)
if !ok {
continue
}
peers = append(peers, &control.ReplicaDescriptor{
ReplicaId: info.ReplicaID,
Epoch: info.Epoch,
EndpointVersion: info.EndpointVersion,
DataAddr: info.DataAddr,
CtrlAddr: info.CtrlAddr,
})
}
return peers
}
// heartbeatFromWire is the wire -> authority-layer translator.
// Field-copy only. This is the master-side analog of the volume's
// decodeAssignmentFact. Unlike the volume decode path, the master
+26
View File
@@ -10,6 +10,7 @@ import (
"time"
"github.com/seaweedfs/seaweed-block/core/adapter"
"github.com/seaweedfs/seaweed-block/core/replication"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -56,6 +57,19 @@ type Config struct {
// sketch §11.L2 requires. Off by default (so T0 tests keep
// their documented non-healthy projection).
EnableT1Readiness bool
// ReplicationVolume, when non-nil, receives peer-set updates on
// every self-replica AssignmentFact. The Host calls
// UpdateReplicaSet(peer_set_generation, targets) AFTER
// adapter.OnAssignment so identity ingestion and replication
// ingestion progress together but do not cross the decode
// boundary (peers are decoded via subscribe.go:decodeReplicaTargets,
// not via decodeAssignmentFact).
//
// Nil means "no replication fan-out" (T0 observer-only hosts,
// bootstrap before ReplicationVolume is ready). T4a-5 production
// wiring sets this to the per-volume ReplicationVolume.
ReplicationVolume *replication.ReplicationVolume
}
// Host is the composed volume-side block product daemon.
@@ -374,6 +388,18 @@ func (h *Host) streamOnce(ctx context.Context) error {
// SOLE permitted decode path. See subscribe.go.
info := decodeAssignmentFact(fact)
h.adpt.OnAssignment(info)
// T4a-5: peer-set routing. Decoded via the separate host-only
// decodeReplicaTargets path (not through AssignmentInfo), so
// the TestNoOtherAssignmentInfoConstruction AST fence stays
// green. If ReplicationVolume is nil (T0/observer-only
// config), the peer set is ignored on this host.
if h.cfg.ReplicationVolume != nil {
targets, gen := decodeReplicaTargets(fact)
if err := h.cfg.ReplicationVolume.UpdateReplicaSet(gen, targets); err != nil {
h.log.Printf("blockvolume: volume %s replication UpdateReplicaSet failed (gen=%d, peers=%d): %v",
h.cfg.VolumeID, gen, len(targets), err)
}
}
if h.cfg.ReadyMarker != nil && info.Epoch > 0 && h.readyOnce.CompareAndSwap(false, true) {
select {
case h.cfg.ReadyMarker <- info:
@@ -25,6 +25,7 @@ package volume
import (
"github.com/seaweedfs/seaweed-block/core/adapter"
"github.com/seaweedfs/seaweed-block/core/replication"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
)
@@ -48,3 +49,37 @@ func decodeAssignmentFact(f *control.AssignmentFact) adapter.AssignmentInfo {
CtrlAddr: f.CtrlAddr,
}
}
// decodeReplicaTargets is the T4a-5 peer-set decode path. Parallel
// to decodeAssignmentFact but produces replication.ReplicaTarget
// values + the monotonic peer_set_generation — NOT adapter.Assignment
// Info. This preserves the T0 boundary (decodeAssignmentFact
// remains the sole AssignmentInfo constructor; AST fence
// TestNoOtherAssignmentInfoConstruction continues to pass) while
// unlocking primary-side replication fan-out via
// ReplicationVolume.UpdateReplicaSet(generation, targets).
//
// Field-copy only, same discipline as decodeAssignmentFact: no
// derivation, no accumulation, no cache — the peer-set authority
// is master-minted (T4a-5.0 discovery §9.1 guardrail #3).
//
// Master-side contract (v3-phase-15-t4a-5-0-host-callback-discovery
// doc §9.1): f.Peers already excludes the self-replica; no
// further filter is needed here. Callers feed the returned
// targets slice + generation directly into UpdateReplicaSet.
func decodeReplicaTargets(f *control.AssignmentFact) ([]replication.ReplicaTarget, uint64) {
if len(f.Peers) == 0 {
return nil, f.PeerSetGeneration
}
out := make([]replication.ReplicaTarget, 0, len(f.Peers))
for _, p := range f.Peers {
out = append(out, replication.ReplicaTarget{
ReplicaID: p.ReplicaId,
DataAddr: p.DataAddr,
ControlAddr: p.CtrlAddr,
Epoch: p.Epoch,
EndpointVersion: p.EndpointVersion,
})
}
return out, f.PeerSetGeneration
}
+104 -6
View File
@@ -4,7 +4,10 @@ import (
"context"
"fmt"
"log"
"sort"
"strings"
"sync"
"sync/atomic"
"github.com/seaweedfs/seaweed-block/core/storage"
"github.com/seaweedfs/seaweed-block/core/transport"
@@ -35,9 +38,16 @@ type ReplicationVolume struct {
store storage.LogicalStorage // borrowed, NEVER closed by us
newExec executorFactory // test seam; default dials real TCP
mu sync.Mutex // serializes UpdateReplicaSet + OnLocalWrite entry AND fan-out
peers map[string]*ReplicaPeer
closed bool
mu sync.Mutex // serializes UpdateReplicaSet + OnLocalWrite entry AND fan-out
peers map[string]*ReplicaPeer
closed bool
lastAppliedGeneration uint64 // monotonic guard; 0 means "no generation applied yet"
// replayedGens counts UpdateReplicaSet calls dropped as stale
// (generation > 0 && generation <= lastAppliedGeneration). Exposed
// only to same-package tests for now; a public Stats() or
// Prometheus hook is a T4-end observability pass.
replayedGens atomic.Uint64
}
// executorFactory lets tests inject a BlockExecutor constructor that
@@ -72,20 +82,55 @@ func NewReplicationVolume(volumeID string, store storage.LogicalStorage) *Replic
// lineage update on existing peers is a T4c refinement when recovery
// sessions thread through.
//
// Generation rule (T4a-5.0 decision §9.4):
// - generation == 0: unversioned apply. Peer map IS mutated, but
// lastAppliedGeneration is NOT advanced. Intended for test /
// fake-master use only; production master MUST emit >= 1.
// - generation > 0 && generation > lastAppliedGeneration: apply
// + advance lastAppliedGeneration.
// - generation > 0 && generation <= lastAppliedGeneration: stale
// replay. Peer map NOT mutated; replayedGens counter increments;
// debug log emits a peer-ID-set delta diff for forensics. Returns
// nil (idempotent replay is success, not error — consistent with
// Ship's epoch-== silent-drop pattern).
//
// The empty-peer-set case (targets == [] with any generation) flows
// through the same teardown path as N → M-1 removal, just iterated to
// completion. No special branch. Standalone / RF=1 / operator-drained
// volumes are legal authoritative state.
//
// Called by: Host authority-callback path (T4a-5), on every
// assignment event that carries a replica-set delta.
// Owns: peers map mutations under v.mu; *ReplicaPeer lifecycle (New
// on add, Close on remove / lineage bump); the per-peer BlockExecutor
// created via newExec.
// created via newExec; the lastAppliedGeneration monotonic guard.
// Borrows: targets slice — caller retains; we read-only copy the
// fields we need.
func (v *ReplicationVolume) UpdateReplicaSet(targets []ReplicaTarget) error {
func (v *ReplicationVolume) UpdateReplicaSet(generation uint64, targets []ReplicaTarget) error {
v.mu.Lock()
defer v.mu.Unlock()
if v.closed {
return fmt.Errorf("replication: UpdateReplicaSet: volume %s closed", v.volumeID)
}
// Generation guard (T4a-5.0 §9.4 three-way rule).
if generation > 0 && generation <= v.lastAppliedGeneration {
v.replayedGens.Add(1)
// Log peer-ID-set delta for forensics (Q2 binding — IDs only,
// not full target structs). `had` is the current in-memory
// peer ID set; `got` is the incoming set. Equal sets are the
// normal replay case; unequal sets indicate a master-side
// oddity worth a grep.
had := peerIDSet(v.peers)
got := targetIDSet(targets)
if !stringSetEqual(had, got) {
log.Printf("replication: volume %s stale-gen replay (gen=%d, lastApplied=%d) with differing peers — had=%s got=%s",
v.volumeID, generation, v.lastAppliedGeneration,
formatIDSet(had), formatIDSet(got))
}
return nil
}
want := make(map[string]ReplicaTarget, len(targets))
for _, t := range targets {
if t.ReplicaID == "" {
@@ -94,7 +139,8 @@ func (v *ReplicationVolume) UpdateReplicaSet(targets []ReplicaTarget) error {
want[t.ReplicaID] = t
}
// Remove peers no longer in the authoritative set.
// Remove peers no longer in the authoritative set. Same teardown
// path is used for N → 0 (empty targets) — no special branch.
for id, peer := range v.peers {
if _, keep := want[id]; !keep {
_ = peer.Close()
@@ -120,9 +166,61 @@ func (v *ReplicationVolume) UpdateReplicaSet(targets []ReplicaTarget) error {
}
v.peers[id] = peer
}
// Advance the monotonic guard only for real (non-zero) generations.
if generation > 0 {
v.lastAppliedGeneration = generation
}
return nil
}
// peerIDSet extracts the set of peer IDs from the current peers map.
// Caller must hold v.mu.
func peerIDSet(peers map[string]*ReplicaPeer) map[string]struct{} {
out := make(map[string]struct{}, len(peers))
for id := range peers {
out[id] = struct{}{}
}
return out
}
// targetIDSet extracts the set of replica IDs from an incoming targets
// slice.
func targetIDSet(targets []ReplicaTarget) map[string]struct{} {
out := make(map[string]struct{}, len(targets))
for _, t := range targets {
out[t.ReplicaID] = struct{}{}
}
return out
}
// stringSetEqual compares two string sets.
func stringSetEqual(a, b map[string]struct{}) bool {
if len(a) != len(b) {
return false
}
for k := range a {
if _, ok := b[k]; !ok {
return false
}
}
return true
}
// formatIDSet renders a string set in deterministic brace form for
// diff logs: {id1,id2} with IDs sorted ascending. Empty → {}.
func formatIDSet(s map[string]struct{}) string {
if len(s) == 0 {
return "{}"
}
ids := make([]string, 0, len(s))
for id := range s {
ids = append(ids, id)
}
sort.Strings(ids)
return "{" + strings.Join(ids, ",") + "}"
}
// OnLocalWrite fans out one acked local write to every tracked peer.
//
// Contract: OnLocalWrite serializes fan-out in LSN order for a given
+214 -11
View File
@@ -63,7 +63,7 @@ func TestReplicationVolume_UpdateReplicaSet_AddPeer(t *testing.T) {
if v.PeerCount() != 0 {
t.Fatalf("precondition: PeerCount=%d want 0", v.PeerCount())
}
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatalf("UpdateReplicaSet: %v", err)
}
if v.PeerCount() != 1 {
@@ -95,7 +95,7 @@ func TestReplicationVolume_UpdateReplicaSet_RemovePeer_ExecutorTornDown(t *testi
}
// Add.
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
v.mu.Lock()
@@ -108,7 +108,7 @@ func TestReplicationVolume_UpdateReplicaSet_RemovePeer_ExecutorTornDown(t *testi
}
// Remove (empty target set).
if err := v.UpdateReplicaSet([]ReplicaTarget{}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{}); err != nil {
t.Fatalf("remove: %v", err)
}
if v.PeerCount() != 0 {
@@ -121,7 +121,7 @@ func TestReplicationVolume_UpdateReplicaSet_RemovePeer_ExecutorTornDown(t *testi
}
// (c) re-add at same ReplicaID must work cleanly and ship must reach replica.
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatalf("re-add: %v", err)
}
if v.PeerCount() != 1 {
@@ -149,7 +149,7 @@ func TestReplicationVolume_UpdateReplicaSet_LineageBump_RecreatesPeer(t *testing
addr, _ := replicaHarness(t, "r1")
v := volumeHarness(t, "vol1")
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
v.mu.Lock()
@@ -158,7 +158,7 @@ func TestReplicationVolume_UpdateReplicaSet_LineageBump_RecreatesPeer(t *testing
v.mu.Unlock()
// Bump epoch.
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 2, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 2, 1)}); err != nil {
t.Fatal(err)
}
v.mu.Lock()
@@ -181,7 +181,7 @@ func TestReplicationVolume_UpdateReplicaSet_LineageBump_RecreatesPeer(t *testing
func TestReplicationVolume_OnLocalWrite_SinglePeer_BestEffort(t *testing.T) {
addr, replica := replicaHarness(t, "r1")
v := volumeHarness(t, "vol1")
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
@@ -235,7 +235,7 @@ func TestReplicationVolume_OnLocalWrite_PeerErrorDoesNotFailCaller(t *testing.T)
_ = ln.Close()
v := volumeHarness(t, "vol1")
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r-dead", deadAddr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r-dead", deadAddr, 1, 1)}); err != nil {
t.Fatal(err)
}
@@ -274,7 +274,7 @@ func TestReplicationVolume_OnLocalWrite_PeerErrorDoesNotFailCaller(t *testing.T)
func TestReplicationVolume_OnLocalWrite_ConcurrentLSNs_OrderedAtReplica(t *testing.T) {
addr, replica := replicaHarness(t, "r1")
v := volumeHarness(t, "vol1")
if err := v.UpdateReplicaSet([]ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
if err := v.UpdateReplicaSet(0, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
@@ -363,7 +363,7 @@ func TestReplicationVolume_Constructor_DoesNotOwnStore(t *testing.T) {
v := NewReplicationVolume("vol1", store)
// Do some operations, including Close.
_ = v.UpdateReplicaSet([]ReplicaTarget{}) // empty set is valid
_ = v.UpdateReplicaSet(0, []ReplicaTarget{}) // empty set is valid
_ = v.Close()
_ = v.Close() // idempotent
@@ -399,7 +399,7 @@ func TestReplicationVolume_OnLocalWrite_Closed_Errors(t *testing.T) {
t.Fatalf("expected 'closed' error, got: %v", err)
}
err = v.UpdateReplicaSet([]ReplicaTarget{})
err = v.UpdateReplicaSet(0, []ReplicaTarget{})
if err == nil {
t.Fatal("expected error on UpdateReplicaSet post-Close")
}
@@ -428,3 +428,206 @@ func waitForReplicaLBA(t *testing.T, replica *storage.BlockStore, lba uint32, wa
// Silence unused-import warnings in some build configs where the test
// files reference fmt only in the error paths.
var _ = fmt.Sprintf
// --- Test 9: Q1 monotonic-guard pin ---
// TestReplicationVolume_UpdateReplicaSet_Generation_MonotonicGuard —
// Q1/Q2 pin (T4a-5.0 §9.4 rule). Apply a sequence of increasing
// generations, then a stale one (gen <= lastApplied). Stale apply
// must:
// - return nil (idempotent replay is success, not an error)
// - NOT mutate the peer map
// - advance replayedGens counter (Q1 binding)
//
// Also exercises the Q2 "differing peers" log path by making the
// stale-replay set differ from the live set.
func TestReplicationVolume_UpdateReplicaSet_Generation_MonotonicGuard(t *testing.T) {
addr1, _ := replicaHarness(t, "r1")
addr2, _ := replicaHarness(t, "r2")
v := volumeHarness(t, "vol1")
// gen=1 → apply r1
if err := v.UpdateReplicaSet(1, []ReplicaTarget{targetFor("r1", addr1, 1, 1)}); err != nil {
t.Fatal(err)
}
// gen=2 → apply r1+r2
if err := v.UpdateReplicaSet(2, []ReplicaTarget{
targetFor("r1", addr1, 1, 1),
targetFor("r2", addr2, 1, 1),
}); err != nil {
t.Fatal(err)
}
// gen=3 → apply r2 only (r1 removed)
if err := v.UpdateReplicaSet(3, []ReplicaTarget{targetFor("r2", addr2, 1, 1)}); err != nil {
t.Fatal(err)
}
if v.PeerCount() != 1 {
t.Fatalf("after gen=3 PeerCount=%d want 1", v.PeerCount())
}
preReplayed := v.replayedGens.Load()
// Stale replay at gen=2 with the ORIGINAL r1+r2 set. Must not
// mutate peers (still r2 only); must increment replayedGens.
err := v.UpdateReplicaSet(2, []ReplicaTarget{
targetFor("r1", addr1, 1, 1),
targetFor("r2", addr2, 1, 1),
})
if err != nil {
t.Fatalf("stale-gen replay should return nil, got %v", err)
}
if v.PeerCount() != 1 {
t.Fatalf("stale-gen replay mutated peer map: PeerCount=%d want 1", v.PeerCount())
}
if v.replayedGens.Load() != preReplayed+1 {
t.Fatalf("replayedGens counter: got %d want %d", v.replayedGens.Load(), preReplayed+1)
}
// Also stale at gen=3 (equal is stale per the rule: gen <= lastApplied).
if err := v.UpdateReplicaSet(3, []ReplicaTarget{}); err != nil {
t.Fatal(err)
}
if v.PeerCount() != 1 {
t.Fatalf("gen==lastApplied must be stale no-op: PeerCount=%d want 1", v.PeerCount())
}
if v.replayedGens.Load() != preReplayed+2 {
t.Fatalf("replayedGens counter after second replay: got %d want %d",
v.replayedGens.Load(), preReplayed+2)
}
// Forward progress to gen=4 works after stale replays.
if err := v.UpdateReplicaSet(4, []ReplicaTarget{}); err != nil {
t.Fatal(err)
}
if v.PeerCount() != 0 {
t.Fatalf("gen=4 apply should remove all peers: got %d", v.PeerCount())
}
}
// --- Test 10: Q1 unversioned-apply pin ---
// TestReplicationVolume_UpdateReplicaSet_GenerationZero_DoesNotAdvanceGuard
// — gen=0 applies peer mutations but MUST NOT advance lastApplied.
// Pinning this means test-harness uses of gen=0 cannot accidentally
// poison the monotonic guard (the original MaxUint64 sentinel
// hazard that QA caught and this rule replaces).
func TestReplicationVolume_UpdateReplicaSet_GenerationZero_DoesNotAdvanceGuard(t *testing.T) {
addr, _ := replicaHarness(t, "r1")
v := volumeHarness(t, "vol1")
// gen=5 → apply r1. lastApplied=5.
if err := v.UpdateReplicaSet(5, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
v.mu.Lock()
last := v.lastAppliedGeneration
v.mu.Unlock()
if last != 5 {
t.Fatalf("lastApplied after gen=5: got %d want 5", last)
}
// gen=0 → unversioned apply (remove r1). Peer mutation happens
// but lastApplied MUST stay at 5.
if err := v.UpdateReplicaSet(0, []ReplicaTarget{}); err != nil {
t.Fatal(err)
}
if v.PeerCount() != 0 {
t.Fatalf("gen=0 did not mutate peer map: PeerCount=%d want 0", v.PeerCount())
}
v.mu.Lock()
last = v.lastAppliedGeneration
v.mu.Unlock()
if last != 5 {
t.Fatalf("gen=0 advanced lastApplied: got %d want 5 (monotonic guard would be poisoned)", last)
}
// gen=3 now arrives — still stale vs lastApplied=5. Must be
// rejected. If the guard had been poisoned by gen=0 (e.g., reset
// to 0), gen=3 would have been accepted.
preReplayed := v.replayedGens.Load()
if err := v.UpdateReplicaSet(3, []ReplicaTarget{targetFor("r1", addr, 1, 1)}); err != nil {
t.Fatal(err)
}
if v.PeerCount() != 0 {
t.Fatalf("gen=3 (stale vs lastApplied=5) was not rejected: PeerCount=%d", v.PeerCount())
}
if v.replayedGens.Load() != preReplayed+1 {
t.Fatal("gen=3 should have been counted as stale replay")
}
}
// --- Test 11: Q3 empty-peer-set with lifecycle teardown ---
// TestReplicationVolume_UpdateReplicaSet_EmptyPeerSet_AppliesWithTeardown
// — Q3 binding: UpdateReplicaSet(gen, []) MUST go through the normal
// teardown path, NOT a special "clear the map" fast-path. Assertions:
// (a) PeerCount() == 0 after apply
// (b) every formerly-present peer's executor session is invalidated
// (c) next OnLocalWrite succeeds as a zero-fanout no-op
func TestReplicationVolume_UpdateReplicaSet_EmptyPeerSet_AppliesWithTeardown(t *testing.T) {
addr1, _ := replicaHarness(t, "r1")
addr2, _ := replicaHarness(t, "r2")
v := volumeHarness(t, "vol1")
// Wrap newExec to collect per-peer executors so we can assert
// session invalidation.
var execs []*transport.BlockExecutor
var execMu sync.Mutex
v.newExec = func(store storage.LogicalStorage, replicaAddr string) *transport.BlockExecutor {
e := transport.NewBlockExecutor(store, replicaAddr)
execMu.Lock()
execs = append(execs, e)
execMu.Unlock()
return e
}
// Apply gen=1 with r1+r2 → two peers, two executors, two sessions.
if err := v.UpdateReplicaSet(1, []ReplicaTarget{
targetFor("r1", addr1, 1, 1),
targetFor("r2", addr2, 1, 1),
}); err != nil {
t.Fatal(err)
}
// Snapshot the session IDs before teardown.
v.mu.Lock()
sessionID1 := v.peers["r1"].sessionID
sessionID2 := v.peers["r2"].sessionID
v.mu.Unlock()
execMu.Lock()
snapshotExecs := append([]*transport.BlockExecutor(nil), execs...)
execMu.Unlock()
if len(snapshotExecs) < 2 {
t.Fatalf("expected >=2 executors after 2-peer apply, got %d", len(snapshotExecs))
}
// Apply gen=2 with [] → N→0 teardown.
if err := v.UpdateReplicaSet(2, []ReplicaTarget{}); err != nil {
t.Fatal(err)
}
// (a) PeerCount == 0
if v.PeerCount() != 0 {
t.Fatalf("PeerCount after empty-set apply=%d want 0", v.PeerCount())
}
// (b) both sessions invalidated. Scan all executors recorded for
// this volume and confirm neither session is still registered.
for _, e := range snapshotExecs {
if e.HasSession(sessionID1) {
t.Fatal("r1's session not invalidated after empty-set apply")
}
if e.HasSession(sessionID2) {
t.Fatal("r2's session not invalidated after empty-set apply")
}
}
// (c) next OnLocalWrite succeeds as zero-fanout no-op.
data := make([]byte, 4096)
data[0] = 0x7E
err := v.OnLocalWrite(context.Background(), LocalWrite{LBA: 0, Data: data, LSN: 1})
if err != nil {
t.Fatalf("OnLocalWrite after empty-set teardown: %v", err)
}
}
+236 -84
View File
@@ -359,10 +359,104 @@ func (x *SubscribeRequest) GetResumeEpoch() uint64 {
return 0
}
// ReplicaDescriptor — one entry in an AssignmentFact.peers list.
// Carries the authoritative lineage + addressing for a single peer
// replica. Used by primary to configure its replication fan-out
// (see ReplicationVolume.UpdateReplicaSet). Master-minted; hosts
// MUST NOT construct or accumulate these from local observations
// (option R rejected in v3-phase-15-t4a-5-0-host-callback-discovery.md
// §9.5).
type ReplicaDescriptor struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ReplicaId string `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"`
EndpointVersion uint64 `protobuf:"varint,3,opt,name=endpoint_version,json=endpointVersion,proto3" json:"endpoint_version,omitempty"`
DataAddr string `protobuf:"bytes,4,opt,name=data_addr,json=dataAddr,proto3" json:"data_addr,omitempty"`
CtrlAddr string `protobuf:"bytes,5,opt,name=ctrl_addr,json=ctrlAddr,proto3" json:"ctrl_addr,omitempty"`
}
func (x *ReplicaDescriptor) Reset() {
*x = ReplicaDescriptor{}
if protoimpl.UnsafeEnabled {
mi := &file_control_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReplicaDescriptor) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReplicaDescriptor) ProtoMessage() {}
func (x *ReplicaDescriptor) ProtoReflect() protoreflect.Message {
mi := &file_control_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReplicaDescriptor.ProtoReflect.Descriptor instead.
func (*ReplicaDescriptor) Descriptor() ([]byte, []int) {
return file_control_proto_rawDescGZIP(), []int{4}
}
func (x *ReplicaDescriptor) GetReplicaId() string {
if x != nil {
return x.ReplicaId
}
return ""
}
func (x *ReplicaDescriptor) GetEpoch() uint64 {
if x != nil {
return x.Epoch
}
return 0
}
func (x *ReplicaDescriptor) GetEndpointVersion() uint64 {
if x != nil {
return x.EndpointVersion
}
return 0
}
func (x *ReplicaDescriptor) GetDataAddr() string {
if x != nil {
return x.DataAddr
}
return ""
}
func (x *ReplicaDescriptor) GetCtrlAddr() string {
if x != nil {
return x.CtrlAddr
}
return ""
}
// AssignmentFact — master-minted AssignmentInfo fact carried to a
// subscribed volume. Field set mirrors adapter.AssignmentInfo.
// NO intent field. The volume's sole permitted decode site is
// core/host/volume/subscribe.go:decodeAssignmentFact.
// subscribed volume. Identity fields (1-6) mirror
// adapter.AssignmentInfo and MUST be decoded via the sole permitted
// site core/host/volume/subscribe.go:decodeAssignmentFact (guarded
// by the TestNoOtherAssignmentInfoConstruction AST fence).
//
// Peer-set fields (7-8) are consumed via a separate host-only
// decoder decodeReplicaTargets in the same file — they do NOT
// transit through AssignmentInfo or the adapter/engine layers
// (guardrail #2 of T4a-5.0 decision). This keeps the narrow
// identity-truth seam untouched while unlocking the primary-side
// replication fan-out that ReplicationVolume.UpdateReplicaSet needs.
type AssignmentFact struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -374,12 +468,24 @@ type AssignmentFact struct {
EndpointVersion uint64 `protobuf:"varint,4,opt,name=endpoint_version,json=endpointVersion,proto3" json:"endpoint_version,omitempty"`
DataAddr string `protobuf:"bytes,5,opt,name=data_addr,json=dataAddr,proto3" json:"data_addr,omitempty"`
CtrlAddr string `protobuf:"bytes,6,opt,name=ctrl_addr,json=ctrlAddr,proto3" json:"ctrl_addr,omitempty"`
// peers — full authoritative peer set for this volume's current
// line. MAY be empty (legal: standalone / RF=1 / pre-peer
// bootstrap / operator-drained maintenance). self-replica is
// implicitly excluded from peers (the primary does not ship to
// itself).
Peers []*ReplicaDescriptor `protobuf:"bytes,7,rep,name=peers,proto3" json:"peers,omitempty"`
// peer_set_generation — monotonic per-volume counter minted by
// master. Production master MUST emit peer_set_generation >= 1.
// ReplicationVolume.UpdateReplicaSet uses this for stale-replay
// protection; fake-master / test harnesses MAY use 0 for
// unversioned apply (does not advance the monotonic guard).
PeerSetGeneration uint64 `protobuf:"varint,8,opt,name=peer_set_generation,json=peerSetGeneration,proto3" json:"peer_set_generation,omitempty"`
}
func (x *AssignmentFact) Reset() {
*x = AssignmentFact{}
if protoimpl.UnsafeEnabled {
mi := &file_control_proto_msgTypes[4]
mi := &file_control_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -392,7 +498,7 @@ func (x *AssignmentFact) String() string {
func (*AssignmentFact) ProtoMessage() {}
func (x *AssignmentFact) ProtoReflect() protoreflect.Message {
mi := &file_control_proto_msgTypes[4]
mi := &file_control_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -405,7 +511,7 @@ func (x *AssignmentFact) ProtoReflect() protoreflect.Message {
// Deprecated: Use AssignmentFact.ProtoReflect.Descriptor instead.
func (*AssignmentFact) Descriptor() ([]byte, []int) {
return file_control_proto_rawDescGZIP(), []int{4}
return file_control_proto_rawDescGZIP(), []int{5}
}
func (x *AssignmentFact) GetVolumeId() string {
@@ -450,6 +556,20 @@ func (x *AssignmentFact) GetCtrlAddr() string {
return ""
}
func (x *AssignmentFact) GetPeers() []*ReplicaDescriptor {
if x != nil {
return x.Peers
}
return nil
}
func (x *AssignmentFact) GetPeerSetGeneration() uint64 {
if x != nil {
return x.PeerSetGeneration
}
return 0
}
type StatusRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -461,7 +581,7 @@ type StatusRequest struct {
func (x *StatusRequest) Reset() {
*x = StatusRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_control_proto_msgTypes[5]
mi := &file_control_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -474,7 +594,7 @@ func (x *StatusRequest) String() string {
func (*StatusRequest) ProtoMessage() {}
func (x *StatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_control_proto_msgTypes[5]
mi := &file_control_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -487,7 +607,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.
func (*StatusRequest) Descriptor() ([]byte, []int) {
return file_control_proto_rawDescGZIP(), []int{5}
return file_control_proto_rawDescGZIP(), []int{6}
}
func (x *StatusRequest) GetVolumeId() string {
@@ -517,7 +637,7 @@ type StatusResponse struct {
func (x *StatusResponse) Reset() {
*x = StatusResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_control_proto_msgTypes[6]
mi := &file_control_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -530,7 +650,7 @@ func (x *StatusResponse) String() string {
func (*StatusResponse) ProtoMessage() {}
func (x *StatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_control_proto_msgTypes[6]
mi := &file_control_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -543,7 +663,7 @@ func (x *StatusResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
func (*StatusResponse) Descriptor() ([]byte, []int) {
return file_control_proto_rawDescGZIP(), []int{6}
return file_control_proto_rawDescGZIP(), []int{7}
}
func (x *StatusResponse) GetVolumeId() string {
@@ -652,7 +772,18 @@ var file_control_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x49, 0x64, 0x12, 0x21, 0x0a,
0x0c, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20,
0x01, 0x28, 0x04, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68,
0x22, 0xc7, 0x01, 0x0a, 0x0e, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x46,
0x22, 0xad, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x44, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63,
0x61, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c,
0x69, 0x63, 0x61, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65,
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x61,
0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x41,
0x64, 0x64, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x74, 0x72, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x74, 0x72, 0x6c, 0x41, 0x64, 0x64, 0x72,
0x22, 0xb9, 0x02, 0x0a, 0x0e, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x46,
0x61, 0x63, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x49, 0x64,
0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02,
@@ -664,56 +795,63 @@ var file_control_proto_rawDesc = []byte{
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1b, 0x0a,
0x09, 0x63, 0x74, 0x72, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x63, 0x74, 0x72, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x22, 0x2c, 0x0a, 0x0d, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x76,
0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x0e, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x76,
0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c,
0x69, 0x63, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68,
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x29, 0x0a,
0x10, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x73, 0x69,
0x67, 0x6e, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x73, 0x73, 0x69,
0x67, 0x6e, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73,
0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18,
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x75, 0x70,
0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x19,
0x6c, 0x61, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65,
0x5f, 0x73, 0x74, 0x75, 0x63, 0x6b, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
0x16, 0x6c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65,
0x53, 0x74, 0x75, 0x63, 0x6b, 0x41, 0x74, 0x32, 0x78, 0x0a, 0x12, 0x4f, 0x62, 0x73, 0x65, 0x72,
0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x62, 0x0a,
0x0f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74,
0x12, 0x28, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f,
0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74,
0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x25, 0x2e, 0x73, 0x65, 0x61,
0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e,
0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x41, 0x63,
0x6b, 0x32, 0x81, 0x01, 0x0a, 0x11, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x14, 0x53, 0x75, 0x62, 0x73, 0x63,
0x72, 0x69, 0x62, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12,
0x29, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x65, 0x61,
0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e,
0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x46,
0x61, 0x63, 0x74, 0x30, 0x01, 0x32, 0x77, 0x0a, 0x0f, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72,
0x79, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x2e,
0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e,
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66,
0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3d,
0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x61,
0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2f, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x2d, 0x62,
0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x08, 0x63, 0x74, 0x72, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x40, 0x0a, 0x05, 0x70, 0x65,
0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x65, 0x61, 0x77,
0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x44, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x13,
0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x70, 0x65, 0x65, 0x72, 0x53,
0x65, 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2c, 0x0a, 0x0d,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a,
0x09, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x0e, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a,
0x09, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f,
0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12,
0x29, 0x0a, 0x10, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73,
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x73,
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75,
0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f,
0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x73,
0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x39,
0x0a, 0x19, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e,
0x63, 0x65, 0x5f, 0x73, 0x74, 0x75, 0x63, 0x6b, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x16, 0x6c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e,
0x63, 0x65, 0x53, 0x74, 0x75, 0x63, 0x6b, 0x41, 0x74, 0x32, 0x78, 0x0a, 0x12, 0x4f, 0x62, 0x73,
0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0x62, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65,
0x61, 0x74, 0x12, 0x28, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62,
0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61,
0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x25, 0x2e, 0x73,
0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63,
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74,
0x41, 0x63, 0x6b, 0x32, 0x81, 0x01, 0x0a, 0x11, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65,
0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x14, 0x53, 0x75, 0x62,
0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
0x73, 0x12, 0x29, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x75, 0x62, 0x73,
0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73,
0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63,
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x46, 0x61, 0x63, 0x74, 0x30, 0x01, 0x32, 0x77, 0x0a, 0x0f, 0x45, 0x76, 0x69, 0x64, 0x65,
0x6e, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x11, 0x51, 0x75,
0x65, 0x72, 0x79, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
0x26, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65,
0x64, 0x66, 0x73, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73,
0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2f, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64,
0x2d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f,
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -728,32 +866,34 @@ func file_control_proto_rawDescGZIP() []byte {
return file_control_proto_rawDescData
}
var file_control_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_control_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_control_proto_goTypes = []interface{}{
(*HeartbeatReport)(nil), // 0: seaweedfs.block.control.HeartbeatReport
(*HeartbeatSlot)(nil), // 1: seaweedfs.block.control.HeartbeatSlot
(*HeartbeatAck)(nil), // 2: seaweedfs.block.control.HeartbeatAck
(*SubscribeRequest)(nil), // 3: seaweedfs.block.control.SubscribeRequest
(*AssignmentFact)(nil), // 4: seaweedfs.block.control.AssignmentFact
(*StatusRequest)(nil), // 5: seaweedfs.block.control.StatusRequest
(*StatusResponse)(nil), // 6: seaweedfs.block.control.StatusResponse
(*timestamp.Timestamp)(nil), // 7: google.protobuf.Timestamp
(*ReplicaDescriptor)(nil), // 4: seaweedfs.block.control.ReplicaDescriptor
(*AssignmentFact)(nil), // 5: seaweedfs.block.control.AssignmentFact
(*StatusRequest)(nil), // 6: seaweedfs.block.control.StatusRequest
(*StatusResponse)(nil), // 7: seaweedfs.block.control.StatusResponse
(*timestamp.Timestamp)(nil), // 8: google.protobuf.Timestamp
}
var file_control_proto_depIdxs = []int32{
7, // 0: seaweedfs.block.control.HeartbeatReport.sent_at:type_name -> google.protobuf.Timestamp
8, // 0: seaweedfs.block.control.HeartbeatReport.sent_at:type_name -> google.protobuf.Timestamp
1, // 1: seaweedfs.block.control.HeartbeatReport.slots:type_name -> seaweedfs.block.control.HeartbeatSlot
7, // 2: seaweedfs.block.control.HeartbeatAck.accepted_at:type_name -> google.protobuf.Timestamp
0, // 3: seaweedfs.block.control.ObservationService.ReportHeartbeat:input_type -> seaweedfs.block.control.HeartbeatReport
3, // 4: seaweedfs.block.control.AssignmentService.SubscribeAssignments:input_type -> seaweedfs.block.control.SubscribeRequest
5, // 5: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:input_type -> seaweedfs.block.control.StatusRequest
2, // 6: seaweedfs.block.control.ObservationService.ReportHeartbeat:output_type -> seaweedfs.block.control.HeartbeatAck
4, // 7: seaweedfs.block.control.AssignmentService.SubscribeAssignments:output_type -> seaweedfs.block.control.AssignmentFact
6, // 8: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:output_type -> seaweedfs.block.control.StatusResponse
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
8, // 2: seaweedfs.block.control.HeartbeatAck.accepted_at:type_name -> google.protobuf.Timestamp
4, // 3: seaweedfs.block.control.AssignmentFact.peers:type_name -> seaweedfs.block.control.ReplicaDescriptor
0, // 4: seaweedfs.block.control.ObservationService.ReportHeartbeat:input_type -> seaweedfs.block.control.HeartbeatReport
3, // 5: seaweedfs.block.control.AssignmentService.SubscribeAssignments:input_type -> seaweedfs.block.control.SubscribeRequest
6, // 6: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:input_type -> seaweedfs.block.control.StatusRequest
2, // 7: seaweedfs.block.control.ObservationService.ReportHeartbeat:output_type -> seaweedfs.block.control.HeartbeatAck
5, // 8: seaweedfs.block.control.AssignmentService.SubscribeAssignments:output_type -> seaweedfs.block.control.AssignmentFact
7, // 9: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:output_type -> seaweedfs.block.control.StatusResponse
7, // [7:10] is the sub-list for method output_type
4, // [4:7] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_control_proto_init() }
@@ -811,7 +951,7 @@ func file_control_proto_init() {
}
}
file_control_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AssignmentFact); i {
switch v := v.(*ReplicaDescriptor); i {
case 0:
return &v.state
case 1:
@@ -823,7 +963,7 @@ func file_control_proto_init() {
}
}
file_control_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatusRequest); i {
switch v := v.(*AssignmentFact); i {
case 0:
return &v.state
case 1:
@@ -835,6 +975,18 @@ func file_control_proto_init() {
}
}
file_control_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatusRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_control_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatusResponse); i {
case 0:
return &v.state
@@ -853,7 +1005,7 @@ func file_control_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_control_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumMessages: 8,
NumExtensions: 0,
NumServices: 3,
},
+40 -3
View File
@@ -98,10 +98,33 @@ message SubscribeRequest {
uint64 resume_epoch = 3; // delivery hint only; does NOT influence authority
}
// ReplicaDescriptor — one entry in an AssignmentFact.peers list.
// Carries the authoritative lineage + addressing for a single peer
// replica. Used by primary to configure its replication fan-out
// (see ReplicationVolume.UpdateReplicaSet). Master-minted; hosts
// MUST NOT construct or accumulate these from local observations
// (option R rejected in v3-phase-15-t4a-5-0-host-callback-discovery.md
// §9.5).
message ReplicaDescriptor {
string replica_id = 1;
uint64 epoch = 2;
uint64 endpoint_version = 3;
string data_addr = 4;
string ctrl_addr = 5;
}
// AssignmentFact — master-minted AssignmentInfo fact carried to a
// subscribed volume. Field set mirrors adapter.AssignmentInfo.
// NO intent field. The volume's sole permitted decode site is
// core/host/volume/subscribe.go:decodeAssignmentFact.
// subscribed volume. Identity fields (1-6) mirror
// adapter.AssignmentInfo and MUST be decoded via the sole permitted
// site core/host/volume/subscribe.go:decodeAssignmentFact (guarded
// by the TestNoOtherAssignmentInfoConstruction AST fence).
//
// Peer-set fields (7-8) are consumed via a separate host-only
// decoder decodeReplicaTargets in the same file — they do NOT
// transit through AssignmentInfo or the adapter/engine layers
// (guardrail #2 of T4a-5.0 decision). This keeps the narrow
// identity-truth seam untouched while unlocking the primary-side
// replication fan-out that ReplicationVolume.UpdateReplicaSet needs.
message AssignmentFact {
string volume_id = 1;
string replica_id = 2;
@@ -109,6 +132,20 @@ message AssignmentFact {
uint64 endpoint_version = 4;
string data_addr = 5;
string ctrl_addr = 6;
// peers — full authoritative peer set for this volume's current
// line. MAY be empty (legal: standalone / RF=1 / pre-peer
// bootstrap / operator-drained maintenance). self-replica is
// implicitly excluded from peers (the primary does not ship to
// itself).
repeated ReplicaDescriptor peers = 7;
// peer_set_generation — monotonic per-volume counter minted by
// master. Production master MUST emit peer_set_generation >= 1.
// ReplicationVolume.UpdateReplicaSet uses this for stale-replay
// protection; fake-master / test harnesses MAY use 0 for
// unversioned apply (does not advance the monotonic guard).
uint64 peer_set_generation = 8;
}
message StatusRequest {