From 4a7e00dc9952109f3838f49b3b6004dbc928e56c Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:16:43 -0800 Subject: [PATCH 1/7] volume, master: recovery watchdog declarations and controls (RED) #128 rule 6 (claude05's rulings 21:07Z): declarations with the decision stubbed, plus the controls. - proto: HeartbeatSlot.unhealthy_reason (13); StatusResponse .unhealthy_replicas (9) with ReplicaUnhealthy (regenerated with the checked-in generator versions; the gRPC file is unchanged). - authority: SlotFact/HeartbeatSlot.UnhealthyReason (raw fact). - volume: the recovery watchdog type and Host wiring (primary assignment, supporting admission, heartbeat Eligible/UnhealthyReason, /status UnhealthyReason and CatchUp), --recover-timeout on blockvolume (default 30s, logged at start); its decision is stubbed here. - controls: a primary-assigned not-ready replica past the timeout reports Eligible=false + recovery_timeout; ready clears it and disarms the watchdog, a new primary epoch re-arms it; the G1 latch reports role_admission_failed; /status shows the reason and a supporting replica's catch-up state; the master promotes nobody without a qualified peer and shows the reason in volume status and as replica_unhealthy / replica_unhealthy_cleared events. Controls that pass on both sides: a supporting replica is never flagged; an unhealthy primary fails over at once to a qualified peer. Refs #128 Co-Authored-By: Claude Opus 5.5 --- seaweed-block/cmd/blockvolume/main.go | 4 + .../core/authority/observation_types.go | 3 + .../core/authority/observation_wire.go | 2 + .../master/recovery_watchdog_master_test.go | 144 +++++ seaweed-block/core/host/volume/host.go | 21 +- .../core/host/volume/projection_bridge.go | 26 + .../core/host/volume/recovery_watchdog.go | 149 +++++ .../host/volume/recovery_watchdog_test.go | 142 +++++ .../core/host/volume/status_server.go | 27 +- seaweed-block/core/rpc/control/control.pb.go | 571 +++++++++++------- seaweed-block/core/rpc/proto/control.proto | 14 + 11 files changed, 867 insertions(+), 236 deletions(-) create mode 100644 seaweed-block/core/host/master/recovery_watchdog_master_test.go create mode 100644 seaweed-block/core/host/volume/recovery_watchdog.go create mode 100644 seaweed-block/core/host/volume/recovery_watchdog_test.go diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index a9f7f86182..85807fc542 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -42,6 +42,8 @@ type flags struct { dataAddr string ctrlAddr string hbInterval time.Duration + // recoverTimeout: #128 rule 6 recovery watchdog. + recoverTimeout time.Duration // printReadyLine: test-only flag — emits one structured JSON // line to stdout on the FIRST received assignment with // Epoch > 0. L2 subprocess smoke uses this to assert route @@ -148,6 +150,7 @@ func parseFlags(args []string) (flags, error) { fs.StringVar(&f.dataAddr, "data-addr", "", "data-path address (required)") fs.StringVar(&f.ctrlAddr, "ctrl-addr", "", "control-path address (required)") fs.DurationVar(&f.hbInterval, "heartbeat-interval", 2*time.Second, "heartbeat send interval") + fs.DurationVar(&f.recoverTimeout, "recover-timeout", volume.DefaultRecoverTimeout, "how long a primary-assigned replica may stay not promotion-ready before it reports itself unhealthy (recovery_timeout) so the master can fail over") fs.BoolVar(&f.printReadyLine, "t0-print-ready", false, "internal test-only: emit one structured JSON line on stdout on first assignment") fs.BoolVar(&f.enableT1Readiness, "t1-readiness", false, "enable readiness bridge (HealthyPathExecutor) so adapter projection reaches Healthy") fs.StringVar(&f.statusAddr, "status-addr", "", "address for the status HTTP endpoint (e.g. 127.0.0.1:0); empty disables") @@ -488,6 +491,7 @@ func run(f flags) int { DataAddr: f.dataAddr, CtrlAddr: f.ctrlAddr, HeartbeatInterval: f.hbInterval, + RecoverTimeout: f.recoverTimeout, ReadyMarker: readyCh, EnableT1Readiness: f.enableT1Readiness, }) diff --git a/seaweed-block/core/authority/observation_types.go b/seaweed-block/core/authority/observation_types.go index 772d38c69d..8e1b2371af 100644 --- a/seaweed-block/core/authority/observation_types.go +++ b/seaweed-block/core/authority/observation_types.go @@ -57,6 +57,9 @@ type SlotFact struct { // Incarnation identifies the reporting volume process (new on // every process start); raw fact, empty from older binaries. Incarnation string + // UnhealthyReason is the slot's explicit unhealthy report (reported + // with Eligible=false); raw fact, empty when healthy. + UnhealthyReason string // ObservedAt/ExpiresAt are store-owned per-slot freshness // markers. They let one Kubernetes node run multiple // blockvolume processes that each report a different slot diff --git a/seaweed-block/core/authority/observation_wire.go b/seaweed-block/core/authority/observation_wire.go index ce81811e5b..70fd594fc7 100644 --- a/seaweed-block/core/authority/observation_wire.go +++ b/seaweed-block/core/authority/observation_wire.go @@ -57,6 +57,7 @@ type HeartbeatSlot struct { Withdrawn bool EvidenceScore uint64 Incarnation string + UnhealthyReason string // LocalRoleClaim is the V2 "I think I am" role flag, mapped // one-to-one into the V3 Observation shape without // reinterpretation. Two servers each sending LocalRolePrimary @@ -95,6 +96,7 @@ func HeartbeatToObservation(msg HeartbeatMessage) (Observation, error) { Withdrawn: s.Withdrawn, EvidenceScore: s.EvidenceScore, Incarnation: s.Incarnation, + UnhealthyReason: s.UnhealthyReason, LocalRoleClaim: s.LocalRoleClaim, }) } diff --git a/seaweed-block/core/host/master/recovery_watchdog_master_test.go b/seaweed-block/core/host/master/recovery_watchdog_master_test.go new file mode 100644 index 0000000000..3991e98d4d --- /dev/null +++ b/seaweed-block/core/host/master/recovery_watchdog_master_test.go @@ -0,0 +1,144 @@ +package master + +import ( + "context" + "testing" + "time" + + "google.golang.org/protobuf/types/known/timestamppb" + + "github.com/seaweedfs/seaweed-block/core/authority" + control "github.com/seaweedfs/seaweed-block/core/rpc/control" +) + +// #128 rule 6 on the master: an explicit unhealthy slot (Eligible=false +// plus a reason) fails over at once to a qualified peer, promotes nobody +// without one, and surfaces the reason in volume status and as events. +// Heartbeats go through the real ReportHeartbeat wire path. + +type wireSlot struct { + incarnation string + ready bool + unhealthy string // non-empty: Eligible=false with this reason +} + +func reportRF3(t *testing.T, svc *services, r1, r2, r3 wireSlot) { + t.Helper() + for i, s := range []struct { + server, replica string + slot wireSlot + }{ + {"node-a", "r1", r1}, {"node-b", "r2", r2}, {"node-c", "r3", r3}, + } { + _, err := svc.ReportHeartbeat(context.Background(), &control.HeartbeatReport{ + ServerId: s.server, SentAt: timestamppb.Now(), Reachable: true, Eligible: true, + Slots: []*control.HeartbeatSlot{{ + VolumeId: "vol-rf3", + ReplicaId: s.replica, + DataAddr: "127.0.0.1:19" + string(rune('1'+i)) + "01", + CtrlAddr: "127.0.0.1:19" + string(rune('1'+i)) + "02", + Reachable: true, + ReadyForPrimary: s.slot.ready, + Eligible: s.slot.unhealthy == "", + EvidenceScore: uint64(30 - i), + Incarnation: s.slot.incarnation, + UnhealthyReason: s.slot.unhealthy, + }}, + }) + if err != nil { + t.Fatalf("ReportHeartbeat %s: %v", s.server, err) + } + } +} + +func watchdogMaster(t *testing.T) (*Host, *services) { + t.Helper() + h := newTestMasterWithControllerConfig(t, t.TempDir(), authority.TopologyControllerConfig{ + ExpectedSlotsPerVolume: 3, PrimaryBootGrace: time.Minute, + }) + seedRF3PlacementForServersWithAddrs(t, h, "vol-rf3", "node-a", "node-b", "node-c") + svc := newServices(h) + reportRF3(t, svc, wireSlot{"r1-a", true, ""}, wireSlot{"r2-a", true, ""}, wireSlot{"r3-a", true, ""}) + if _, err := h.RunLifecycleProductTick(); err != nil { + t.Fatalf("initial product tick: %v", err) + } + if line := waitAuthorityLine(t, h.Publisher(), "vol-rf3"); line.ReplicaID != "r1" { + t.Fatalf("initial line=%+v want r1", line) + } + return h, svc +} + +func unhealthyReplicas(t *testing.T, svc *services) map[string]string { + t.Helper() + resp, err := svc.QueryVolumeStatus(context.Background(), &control.StatusRequest{VolumeId: "vol-rf3"}) + if err != nil { + t.Fatalf("QueryVolumeStatus: %v", err) + } + out := map[string]string{} + for _, u := range resp.GetUnhealthyReplicas() { + out[u.GetReplicaId()] = u.GetReason() + } + return out +} + +func timelineEvents(t *testing.T, svc *services) []*control.ClusterEvent { + t.Helper() + tl, err := svc.GetVolumeTimeline(context.Background(), &control.GetVolumeTimelineRequest{VolumeId: "vol-rf3"}) + if err != nil { + t.Fatalf("timeline: %v", err) + } + return tl.GetEvents() +} + +// No qualified peer: nobody is promoted; the reason is in volume status +// and the timeline; a later ready report clears both. +func TestRecoveryWatchdog_MasterNoQualifiedPeerPromotesNobody(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + + reportRF3(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, wireSlot{"r2-a", false, ""}, wireSlot{"r3-a", false, ""}) + if _, err := h.RunLifecycleProductTick(); err != nil { + t.Fatalf("product tick: %v", err) + } + time.Sleep(150 * time.Millisecond) + if line, _ := h.Publisher().VolumeAuthorityLine("vol-rf3"); line.ReplicaID != "r1" || line.Epoch != 1 { + t.Fatalf("no qualified peer: line=%+v want r1@1 unchanged", line) + } + if got := unhealthyReplicas(t, svc); got["r1"] != "recovery_timeout" || len(got) != 1 { + t.Fatalf("volume status unhealthy replicas=%v; want r1=recovery_timeout", got) + } + if !timelineHasEvent(timelineEvents(t, svc), "replica_unhealthy", "recovery_timeout") { + t.Fatalf("timeline has no replica_unhealthy/recovery_timeout event") + } + + reportRF3(t, svc, wireSlot{"r1-b", true, ""}, wireSlot{"r2-a", false, ""}, wireSlot{"r3-a", false, ""}) + if got := unhealthyReplicas(t, svc); len(got) != 0 { + t.Fatalf("after a ready report: unhealthy replicas=%v; want none", got) + } + cleared := false + for _, e := range timelineEvents(t, svc) { + if e.GetEventType() == "replica_unhealthy_cleared" && e.GetReplicaId() == "r1" && e.GetOldValue() == "recovery_timeout" { + cleared = true + } + } + if !cleared { + t.Fatalf("timeline has no replica_unhealthy_cleared event for r1") + } +} + +// A qualified peer exists: the unhealthy primary fails over at once, even +// though it is a restarted incarnation that would otherwise be in its +// boot grace. +func TestRecoveryWatchdog_MasterUnhealthyFailsOverToQualifiedPeer(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + h.SetPromotionEvidenceProvider(&switchProbe{}) // r1 not ready, r2 ready with evidence + + reportRF3(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, wireSlot{"r2-a", true, ""}, wireSlot{"r3-a", false, ""}) + if _, err := h.RunLifecycleProductTick(); err != nil { + t.Fatalf("product tick: %v", err) + } + if line := waitAuthorityReplica(t, h.Publisher(), "vol-rf3", "r2"); line.Epoch != 2 { + t.Fatalf("unhealthy primary with a qualified peer: line=%+v want r2@2", line) + } +} diff --git a/seaweed-block/core/host/volume/host.go b/seaweed-block/core/host/volume/host.go index e7adbee4d8..27bdaa3f13 100644 --- a/seaweed-block/core/host/volume/host.go +++ b/seaweed-block/core/host/volume/host.go @@ -41,6 +41,11 @@ type Config struct { // Zero picks the default (2s). HeartbeatInterval time.Duration + // RecoverTimeout bounds how long a primary-assigned replica may stay + // not promotion-ready before it reports an explicit unhealthy fact + // (#128 rule 6). Zero picks DefaultRecoverTimeout. + RecoverTimeout time.Duration + // Logger receives structured startup + loop-event logs. // Nil falls through to the default log package logger. Logger *log.Logger @@ -95,6 +100,8 @@ type Host struct { // incarnation is new on every process start and reported in every // heartbeat, so the master can tell a restart from a long silence. incarnation string + // wd is the recovery watchdog (#128 rule 6). + wd *recoveryWatchdog cfg Config log *log.Logger @@ -249,6 +256,8 @@ func New(cfg Config) (*Host, error) { asnCli: control.NewAssignmentServiceClient(conn), } h.incarnation = newIncarnation() + h.wd = newRecoveryWatchdog(cfg.RecoverTimeout) + h.log.Printf("blockvolume: volume %s recovery watchdog: a primary assignment must become promotion-ready within %s", cfg.VolumeID, h.wd.timeout) if cfg.ReplicationVolume != nil { h.setReplicationLocked(cfg.ReplicationVolume) } @@ -575,6 +584,8 @@ func (h *Host) runHeartbeat(ctx context.Context) { // buildReport collects local slot facts into a wire HeartbeatReport. // T0 single-volume-per-process simplicity: one replica slot. func (h *Host) buildReport() *control.HeartbeatReport { + ready := h.readyForPrimaryFact() + unhealthy := h.unhealthyReason(ready) return &control.HeartbeatReport{ ServerId: h.cfg.ServerID, SentAt: timestamppb.Now(), @@ -588,9 +599,10 @@ func (h *Host) buildReport() *control.HeartbeatReport { CtrlAddr: h.cfg.CtrlAddr, Frontends: h.frontendTargetsSnapshot(), Reachable: true, - ReadyForPrimary: h.readyForPrimaryFact(), - Eligible: true, + ReadyForPrimary: ready, + Eligible: unhealthy == "", // an explicit unhealthy slot is ineligible Incarnation: h.incarnation, + UnhealthyReason: unhealthy, }, }, } @@ -726,6 +738,7 @@ func (h *Host) streamOnce(ctx context.Context) error { // installed, admitting local-only writes with zero fan-out. func (h *Host) applyFact(fact *control.AssignmentFact) { if fact.ReplicaId != h.cfg.ReplicaID { + h.wd.notPrimary() // Another replica is authoritative for this volume line. Record that // line first so AdapterProjectionView can keep this replica frontend- // unhealthy even if its local engine is otherwise caught up. @@ -745,6 +758,7 @@ func (h *Host) applyFact(fact *control.AssignmentFact) { return } h.adpt.OnAssignment(info) + h.wd.supportingAdmitted(info.Epoch) h.log.Printf("blockvolume: volume %s admitted as SUPPORTING replica %s at epoch=%d EV=%d behind primary %s; frontend remains gated", h.cfg.VolumeID, info.ReplicaID, info.Epoch, info.EndpointVersion, fact.ReplicaId) // Supporting replicas need durable lineage latching for promotion-readiness, @@ -758,6 +772,9 @@ func (h *Host) applyFact(fact *control.AssignmentFact) { return } + // The recovery watchdog runs from the primary assignment, before any + // admission step can fail (#128 rule 6). + h.wd.primaryAssigned(fact.Epoch) if blocked, reason := h.localReadinessBlock(); blocked { h.storeLocalReadinessReplayFact(fact) h.log.Printf("blockvolume: volume %s local readiness blocked (%s); NOT applying primary assignment %s@%d to adapter", diff --git a/seaweed-block/core/host/volume/projection_bridge.go b/seaweed-block/core/host/volume/projection_bridge.go index d5eb60b405..9d780fe7e3 100644 --- a/seaweed-block/core/host/volume/projection_bridge.go +++ b/seaweed-block/core/host/volume/projection_bridge.go @@ -1,6 +1,8 @@ package volume import ( + "time" + "github.com/seaweedfs/seaweed-block/core/engine" "github.com/seaweedfs/seaweed-block/core/frontend" control "github.com/seaweedfs/seaweed-block/core/rpc/control" @@ -156,6 +158,30 @@ func (v *AdapterProjectionView) roleAdmissionReason() string { return "" } +// unhealthyReason is the host's explicit unhealthy report (#128 rule 6), +// or "" when the probe does not provide one. +func (v *AdapterProjectionView) unhealthyReason() string { + if v == nil || v.probe == nil { + return "" + } + if p, ok := v.probe.(interface{ UnhealthyReason() string }); ok { + return p.UnhealthyReason() + } + return "" +} + +// catchUpSince is when the host was admitted as a supporting replica at +// its current epoch; zero when not supporting or not provided. +func (v *AdapterProjectionView) catchUpSince() time.Time { + if v == nil || v.probe == nil { + return time.Time{} + } + if p, ok := v.probe.(interface{ CatchUpSince() time.Time }); ok { + return p.CatchUpSince() + } + return time.Time{} +} + func (v *AdapterProjectionView) isSupersededLine(epoch, endpointVersion uint64) bool { return v != nil && v.probe != nil && diff --git a/seaweed-block/core/host/volume/recovery_watchdog.go b/seaweed-block/core/host/volume/recovery_watchdog.go new file mode 100644 index 0000000000..6c0cb384b5 --- /dev/null +++ b/seaweed-block/core/host/volume/recovery_watchdog.go @@ -0,0 +1,149 @@ +package volume + +import ( + "sync" + "time" +) + +// Recovery watchdog (#128 rule 6). +// +// A replica that holds the PRIMARY assignment but whose local recovery +// has not produced the engine's promotion-ready fact within the recover +// timeout reports an explicit unhealthy fact (Eligible=false plus a typed +// reason) instead of staying silently not-ready, so the master fails over +// at once to a peer that passes the promotion evidence gate, or, with no +// qualifying peer, promotes nobody and surfaces the reason. +// +// - Scope: only a primary-assigned replica is flagged. A supporting +// replica in a long catch-up is not; its catch-up state (elapsed, +// lag) is visible in /status instead. +// - The timeout runs from the primary assignment in this incarnation +// (a new primary epoch restarts it). +// - recovery_timeout latches until a fresh promotion-ready fact clears +// it (Eligible=true, reason empty). An epoch that already moved +// stays moved: the master decides that, not the volume. +// - It watches recovery after a primary assignment only: once the +// replica has been promotion-ready in that assignment, the watchdog +// is disarmed until the next primary epoch (a running primary that +// later degrades is not a boot-recovery stall). +// - role_admission_failed reports the G1 role-admission latch of a +// primary-assigned replica, for as long as the latch holds. +// +// wal_corrupt and io_error need typed failures out of the durable +// recovery path; they are a tracked follow-up. + +const ( + UnhealthyRecoveryTimeout = "recovery_timeout" + UnhealthyRoleAdmission = "role_admission_failed" + + // DefaultRecoverTimeout matches blockmaster's default freshness + // window. + DefaultRecoverTimeout = 30 * time.Second +) + +// A nil *recoveryWatchdog (a Host built without New, as some tests do) +// is inert: no reason is ever reported. +type recoveryWatchdog struct { + mu sync.Mutex + timeout time.Duration + now func() time.Time + + primarySince time.Time // zero unless this replica holds the primary assignment + primaryEpoch uint64 + supportingSince time.Time // zero unless admitted as a supporting replica + supportingEpoch uint64 + timedOut bool // recovery_timeout latched until a ready fact + readySeen bool // promotion-ready once in this primary assignment: disarmed +} + +func newRecoveryWatchdog(timeout time.Duration) *recoveryWatchdog { + if timeout <= 0 { + timeout = DefaultRecoverTimeout + } + return &recoveryWatchdog{timeout: timeout, now: time.Now} +} + +// primaryAssigned records a primary assignment for this replica. A new +// epoch restarts the timeout. +func (w *recoveryWatchdog) primaryAssigned(epoch uint64) { + if w == nil { + return + } + w.mu.Lock() + defer w.mu.Unlock() + if w.primarySince.IsZero() || epoch != w.primaryEpoch { + w.primarySince, w.primaryEpoch, w.timedOut, w.readySeen = w.now(), epoch, false, false + } + w.supportingSince, w.supportingEpoch = time.Time{}, 0 +} + +// notPrimary records that another replica holds the primary assignment. +func (w *recoveryWatchdog) notPrimary() { + if w == nil { + return + } + w.mu.Lock() + defer w.mu.Unlock() + w.primarySince, w.primaryEpoch, w.timedOut, w.readySeen = time.Time{}, 0, false, false +} + +// supportingAdmitted records this replica's admission as a supporting +// replica at epoch; a new epoch restarts its catch-up clock. +func (w *recoveryWatchdog) supportingAdmitted(epoch uint64) { + if w == nil { + return + } + w.mu.Lock() + defer w.mu.Unlock() + w.primarySince, w.primaryEpoch, w.timedOut, w.readySeen = time.Time{}, 0, false, false + if w.supportingSince.IsZero() || epoch != w.supportingEpoch { + w.supportingSince, w.supportingEpoch = w.now(), epoch + } +} + +// reason returns the slot's explicit unhealthy reason given whether it +// is promotion-ready now and whether the G1 latch holds. fired is true +// on the call that latched recovery_timeout. +func (w *recoveryWatchdog) reason(ready, roleAdmissionFailed bool) (reason string, fired bool) { + return "", false // RED: no decision yet +} + +// catchUpSince is when this replica was admitted as a supporting replica +// at its current epoch; zero when it is not supporting. +func (w *recoveryWatchdog) catchUpSince() time.Time { + return time.Time{} // RED +} + +// UnhealthyReason is the slot's explicit unhealthy reason now (#128 +// rule 6), the same value its heartbeat reports; empty when healthy. +func (h *Host) UnhealthyReason() string { + return h.unhealthyReason(h.readyForPrimaryFact()) +} + +func (h *Host) unhealthyReason(ready bool) string { + if h == nil || h.wd == nil { + return "" + } + failed, _ := h.RoleAdmissionFailure() + reason, fired := h.wd.reason(ready, failed) + if fired { + h.log.Printf("blockvolume: volume %s primary assignment epoch=%d not promotion-ready after %s: reporting unhealthy (%s)", + h.cfg.VolumeID, h.wd.epoch(), h.wd.timeout, UnhealthyRecoveryTimeout) + } + return reason +} + +func (w *recoveryWatchdog) epoch() uint64 { + w.mu.Lock() + defer w.mu.Unlock() + return w.primaryEpoch +} + +// CatchUpSince is when this replica was admitted as a supporting replica +// at its current epoch; zero when it is not supporting. +func (h *Host) CatchUpSince() time.Time { + if h == nil || h.wd == nil { + return time.Time{} + } + return h.wd.catchUpSince() +} diff --git a/seaweed-block/core/host/volume/recovery_watchdog_test.go b/seaweed-block/core/host/volume/recovery_watchdog_test.go new file mode 100644 index 0000000000..7c920663b0 --- /dev/null +++ b/seaweed-block/core/host/volume/recovery_watchdog_test.go @@ -0,0 +1,142 @@ +package volume + +import ( + "testing" + "time" + + control "github.com/seaweedfs/seaweed-block/core/rpc/control" +) + +// #128 rule 6: a primary-assigned replica that is not promotion-ready +// within its recover timeout reports an explicit unhealthy fact. + +type fakeClock struct{ t time.Time } + +func (c *fakeClock) now() time.Time { return c.t } +func (c *fakeClock) advance(d time.Duration) { c.t = c.t.Add(d) } + +func watchdogHost(t *testing.T, timeout time.Duration) (*Host, *fakeClock) { + t.Helper() + h := newTestVolumeHost(t) + clk := &fakeClock{t: time.Unix(1000, 0)} + h.wd = newRecoveryWatchdog(timeout) + h.wd.now = clk.now + return h, clk +} + +func selfPrimaryFact(epoch uint64) *control.AssignmentFact { + return &control.AssignmentFact{ + VolumeId: "v1", ReplicaId: "r1", Epoch: epoch, EndpointVersion: 1, + DataAddr: "127.0.0.1:9201", CtrlAddr: "127.0.0.1:9101", + } +} + +func reportSlot(t *testing.T, h *Host) *control.HeartbeatSlot { + t.Helper() + rep := h.buildReport() + if len(rep.Slots) != 1 { + t.Fatalf("report slots: %d", len(rep.Slots)) + } + return rep.Slots[0] +} + +// The heartbeat of a primary-assigned, not-ready replica turns explicit +// unhealthy (Eligible=false, recovery_timeout) once the timeout elapses. +func TestRecoveryWatchdog_PrimaryNotReadyPastTimeoutReportsUnhealthy(t *testing.T) { + h, clk := watchdogHost(t, 30*time.Second) + h.applyFact(selfPrimaryFact(1)) + + clk.advance(29 * time.Second) + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" || s.ReadyForPrimary { + t.Fatalf("inside the recover timeout: %+v; want eligible, no reason, not ready", s) + } + clk.advance(2 * time.Second) + if s := reportSlot(t, h); s.Eligible || s.UnhealthyReason != UnhealthyRecoveryTimeout { + t.Fatalf("past the recover timeout: eligible=%t reason=%q; want ineligible, %s", s.Eligible, s.UnhealthyReason, UnhealthyRecoveryTimeout) + } + if got := h.UnhealthyReason(); got != UnhealthyRecoveryTimeout { + t.Fatalf("UnhealthyReason()=%q", got) + } +} + +// A supporting replica in a long catch-up is never flagged. +func TestRecoveryWatchdog_SupportingReplicaNotFlagged(t *testing.T) { + h, clk := watchdogHost(t, 30*time.Second) + h.applyFact(selfPrimaryFact(1)) + h.applyFact(&control.AssignmentFact{ // another replica is now primary + VolumeId: "v1", ReplicaId: "r2", Epoch: 2, EndpointVersion: 1, + DataAddr: "127.0.0.1:9301", CtrlAddr: "127.0.0.1:9302", + }) + h.wd.supportingAdmitted(2) + clk.advance(time.Hour) + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" { + t.Fatalf("supporting replica after an hour: %+v; want eligible, no reason", s) + } +} + +// recovery_timeout latches until a fresh ready fact clears it; once +// ready in this assignment the watchdog is disarmed; a new primary epoch +// re-arms it with a fresh clock. +func TestRecoveryWatchdog_ReadyClearsAndDisarmsNewEpochRearms(t *testing.T) { + w := newRecoveryWatchdog(10 * time.Second) + clk := &fakeClock{t: time.Unix(1000, 0)} + w.now = clk.now + + w.primaryAssigned(1) + clk.advance(11 * time.Second) + if r, fired := w.reason(false, false); r != UnhealthyRecoveryTimeout || !fired { + t.Fatalf("past timeout: %q fired=%t", r, fired) + } + if r, fired := w.reason(false, false); r != UnhealthyRecoveryTimeout || fired { + t.Fatalf("latched: %q fired=%t; want the reason, fired only once", r, fired) + } + if r, _ := w.reason(true, false); r != "" { + t.Fatalf("ready: %q; want cleared", r) + } + if r, _ := w.reason(false, false); r != "" { + t.Fatalf("unready again in the same assignment: %q; want disarmed", r) + } + + w.primaryAssigned(2) // new primary epoch: fresh clock + clk.advance(9 * time.Second) + if r, _ := w.reason(false, false); r != "" { + t.Fatalf("new epoch inside timeout: %q", r) + } + clk.advance(2 * time.Second) + if r, _ := w.reason(false, false); r != UnhealthyRecoveryTimeout { + t.Fatalf("new epoch past timeout: %q", r) + } +} + +// The G1 role-admission latch of a primary-assigned replica is reported +// at once; it never applies to a replica without the primary assignment. +func TestRecoveryWatchdog_RoleAdmissionFailure(t *testing.T) { + w := newRecoveryWatchdog(time.Hour) + if r, _ := w.reason(false, true); r != "" { + t.Fatalf("not primary-assigned: %q", r) + } + w.primaryAssigned(1) + if r, _ := w.reason(false, true); r != UnhealthyRoleAdmission { + t.Fatalf("primary-assigned with the G1 latch: %q; want %s", r, UnhealthyRoleAdmission) + } +} + +// /status carries the unhealthy reason, and a supporting replica's +// catch-up state. +func TestRecoveryWatchdog_StatusShowsReasonAndCatchUp(t *testing.T) { + h, clk := watchdogHost(t, time.Second) + h.applyFact(selfPrimaryFact(1)) + clk.advance(2 * time.Second) + s := NewStatusServer(h.view) + if got := s.statusProjection().UnhealthyReason; got != UnhealthyRecoveryTimeout { + t.Fatalf("/status UnhealthyReason=%q; want %s", got, UnhealthyRecoveryTimeout) + } + + h2 := newTestVolumeHost(t) + h2.wd.supportingAdmitted(3) + time.Sleep(20 * time.Millisecond) + st := NewStatusServer(h2.view).statusProjection() + if st.UnhealthyReason != "" || st.CatchUp == nil || st.CatchUp.ElapsedMs < 20 { + t.Fatalf("supporting replica /status: reason=%q catchUp=%+v; want no reason and catch-up elapsed >= 20ms", st.UnhealthyReason, st.CatchUp) + } +} diff --git a/seaweed-block/core/host/volume/status_server.go b/seaweed-block/core/host/volume/status_server.go index 2f9df2b7db..10d885c5c5 100644 --- a/seaweed-block/core/host/volume/status_server.go +++ b/seaweed-block/core/host/volume/status_server.go @@ -163,6 +163,22 @@ type StatusProjection struct { // RoleAdmissionFailure (G1) explains a not-Healthy projection caused // by a failed role call on the replica listener; empty otherwise. RoleAdmissionFailure string `json:",omitempty"` + // UnhealthyReason is the slot's explicit unhealthy report (#128 rule + // 6), the value its heartbeat carries; empty when healthy. + UnhealthyReason string `json:",omitempty"` + // CatchUp shows a supporting replica's catch-up progress while it is + // not yet replica_ready; it is visible without being an alert. + CatchUp *CatchUpStatus `json:",omitempty"` +} + +// CatchUpStatus is a supporting replica's catch-up state. +type CatchUpStatus struct { + // ElapsedMs is the time since this replica was admitted as a + // supporting replica at its current epoch. + ElapsedMs int64 + // LagLSN is the engine's H-R (primary head minus this replica's + // durable frontier) as last observed; 0 when unknown or caught up. + LagLSN uint64 } // NewStatusServer wires a server to one volume host's view. @@ -413,13 +429,22 @@ func (s *StatusServer) statusProjection() StatusProjection { case ep.Mode == engine.ModeDegraded || ep.Mode == engine.ModeIdle: replicationRole = ReplicationRoleNotReady } - return StatusProjection{ + out := StatusProjection{ Projection: p, FrontendPrimaryReady: p.Healthy && !superseded && !supportingReady, AuthorityRole: authorityRole, ReplicationRole: replicationRole, RoleAdmissionFailure: s.view.roleAdmissionReason(), + UnhealthyReason: s.view.unhealthyReason(), } + if since := s.view.catchUpSince(); !since.IsZero() && replicationRole != ReplicationRoleReady { + cu := &CatchUpStatus{ElapsedMs: time.Since(since).Milliseconds()} + if ep.H > ep.R { + cu.LagLSN = ep.H - ep.R + } + out.CatchUp = cu + } + return out } func (s *StatusServer) supportingReplicaReady(selfEpoch, selfEV uint64) bool { diff --git a/seaweed-block/core/rpc/control/control.pb.go b/seaweed-block/core/rpc/control/control.pb.go index 07c7d6d899..f0aec7594d 100644 --- a/seaweed-block/core/rpc/control/control.pb.go +++ b/seaweed-block/core/rpc/control/control.pb.go @@ -144,6 +144,12 @@ type HeartbeatSlot struct { // every process start. Raw observation fact: the controller uses it // only to bound a restarted primary's boot grace. Incarnation string `protobuf:"bytes,12,opt,name=incarnation,proto3" json:"incarnation,omitempty"` + // unhealthy_reason is an explicit unhealthy report for this slot + // (#128 rule 6): recovery_timeout when a primary-assigned replica did + // not become promotion-ready within its recover timeout, or + // role_admission_failed for the G1 latch. Set together with + // eligible=false; empty when healthy. + UnhealthyReason string `protobuf:"bytes,13,opt,name=unhealthy_reason,json=unhealthyReason,proto3" json:"unhealthy_reason,omitempty"` } func (x *HeartbeatSlot) Reset() { @@ -262,6 +268,13 @@ func (x *HeartbeatSlot) GetIncarnation() string { return "" } +func (x *HeartbeatSlot) GetUnhealthyReason() string { + if x != nil { + return x.UnhealthyReason + } + return "" +} + // FrontendTarget — read-only frontend publication fact reported by // a blockvolume process. This is an observation/status fact only: // CSI may consume it to publish an already-running target, but @@ -809,6 +822,9 @@ type StatusResponse struct { LastUnsupportedReason string `protobuf:"bytes,6,opt,name=last_unsupported_reason,json=lastUnsupportedReason,proto3" json:"last_unsupported_reason,omitempty"` LastConvergenceStuckAt string `protobuf:"bytes,7,opt,name=last_convergence_stuck_at,json=lastConvergenceStuckAt,proto3" json:"last_convergence_stuck_at,omitempty"` Frontends []*FrontendTarget `protobuf:"bytes,8,rep,name=frontends,proto3" json:"frontends,omitempty"` + // unhealthy_replicas lists the volume's replicas whose fresh + // heartbeat carries an explicit unhealthy reason (#128 rule 6). + UnhealthyReplicas []*ReplicaUnhealthy `protobuf:"bytes,9,rep,name=unhealthy_replicas,json=unhealthyReplicas,proto3" json:"unhealthy_replicas,omitempty"` } func (x *StatusResponse) Reset() { @@ -899,6 +915,68 @@ func (x *StatusResponse) GetFrontends() []*FrontendTarget { return nil } +func (x *StatusResponse) GetUnhealthyReplicas() []*ReplicaUnhealthy { + if x != nil { + return x.UnhealthyReplicas + } + return nil +} + +type ReplicaUnhealthy 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"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *ReplicaUnhealthy) Reset() { + *x = ReplicaUnhealthy{} + if protoimpl.UnsafeEnabled { + mi := &file_control_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReplicaUnhealthy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicaUnhealthy) ProtoMessage() {} + +func (x *ReplicaUnhealthy) ProtoReflect() protoreflect.Message { + mi := &file_control_proto_msgTypes[10] + 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 ReplicaUnhealthy.ProtoReflect.Descriptor instead. +func (*ReplicaUnhealthy) Descriptor() ([]byte, []int) { + return file_control_proto_rawDescGZIP(), []int{10} +} + +func (x *ReplicaUnhealthy) GetReplicaId() string { + if x != nil { + return x.ReplicaId + } + return "" +} + +func (x *ReplicaUnhealthy) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + type GetClusterStatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -908,7 +986,7 @@ type GetClusterStatusRequest struct { func (x *GetClusterStatusRequest) Reset() { *x = GetClusterStatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[10] + mi := &file_control_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -921,7 +999,7 @@ func (x *GetClusterStatusRequest) String() string { func (*GetClusterStatusRequest) ProtoMessage() {} func (x *GetClusterStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[10] + mi := &file_control_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -934,7 +1012,7 @@ func (x *GetClusterStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClusterStatusRequest.ProtoReflect.Descriptor instead. func (*GetClusterStatusRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{10} + return file_control_proto_rawDescGZIP(), []int{11} } type ListVolumesRequest struct { @@ -946,7 +1024,7 @@ type ListVolumesRequest struct { func (x *ListVolumesRequest) Reset() { *x = ListVolumesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[11] + mi := &file_control_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -959,7 +1037,7 @@ func (x *ListVolumesRequest) String() string { func (*ListVolumesRequest) ProtoMessage() {} func (x *ListVolumesRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[11] + mi := &file_control_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -972,7 +1050,7 @@ func (x *ListVolumesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListVolumesRequest.ProtoReflect.Descriptor instead. func (*ListVolumesRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{11} + return file_control_proto_rawDescGZIP(), []int{12} } type GetVolumeStatusRequest struct { @@ -986,7 +1064,7 @@ type GetVolumeStatusRequest struct { func (x *GetVolumeStatusRequest) Reset() { *x = GetVolumeStatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[12] + mi := &file_control_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -999,7 +1077,7 @@ func (x *GetVolumeStatusRequest) String() string { func (*GetVolumeStatusRequest) ProtoMessage() {} func (x *GetVolumeStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[12] + mi := &file_control_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1012,7 +1090,7 @@ func (x *GetVolumeStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVolumeStatusRequest.ProtoReflect.Descriptor instead. func (*GetVolumeStatusRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{12} + return file_control_proto_rawDescGZIP(), []int{13} } func (x *GetVolumeStatusRequest) GetVolumeId() string { @@ -1033,7 +1111,7 @@ type GetVolumeTimelineRequest struct { func (x *GetVolumeTimelineRequest) Reset() { *x = GetVolumeTimelineRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[13] + mi := &file_control_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1046,7 +1124,7 @@ func (x *GetVolumeTimelineRequest) String() string { func (*GetVolumeTimelineRequest) ProtoMessage() {} func (x *GetVolumeTimelineRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[13] + mi := &file_control_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1059,7 +1137,7 @@ func (x *GetVolumeTimelineRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVolumeTimelineRequest.ProtoReflect.Descriptor instead. func (*GetVolumeTimelineRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{13} + return file_control_proto_rawDescGZIP(), []int{14} } func (x *GetVolumeTimelineRequest) GetVolumeId() string { @@ -1080,7 +1158,7 @@ type WatchClusterEventsRequest struct { func (x *WatchClusterEventsRequest) Reset() { *x = WatchClusterEventsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[14] + mi := &file_control_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1093,7 +1171,7 @@ func (x *WatchClusterEventsRequest) String() string { func (*WatchClusterEventsRequest) ProtoMessage() {} func (x *WatchClusterEventsRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[14] + mi := &file_control_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1106,7 +1184,7 @@ func (x *WatchClusterEventsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WatchClusterEventsRequest.ProtoReflect.Descriptor instead. func (*WatchClusterEventsRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{14} + return file_control_proto_rawDescGZIP(), []int{15} } func (x *WatchClusterEventsRequest) GetSinceEventId() string { @@ -1131,7 +1209,7 @@ type ObservationCondition struct { func (x *ObservationCondition) Reset() { *x = ObservationCondition{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[15] + mi := &file_control_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1144,7 +1222,7 @@ func (x *ObservationCondition) String() string { func (*ObservationCondition) ProtoMessage() {} func (x *ObservationCondition) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[15] + mi := &file_control_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1157,7 +1235,7 @@ func (x *ObservationCondition) ProtoReflect() protoreflect.Message { // Deprecated: Use ObservationCondition.ProtoReflect.Descriptor instead. func (*ObservationCondition) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{15} + return file_control_proto_rawDescGZIP(), []int{16} } func (x *ObservationCondition) GetType() string { @@ -1214,7 +1292,7 @@ type ClusterStatusResponse struct { func (x *ClusterStatusResponse) Reset() { *x = ClusterStatusResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[16] + mi := &file_control_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1227,7 +1305,7 @@ func (x *ClusterStatusResponse) String() string { func (*ClusterStatusResponse) ProtoMessage() {} func (x *ClusterStatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[16] + mi := &file_control_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1240,7 +1318,7 @@ func (x *ClusterStatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ClusterStatusResponse.ProtoReflect.Descriptor instead. func (*ClusterStatusResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{16} + return file_control_proto_rawDescGZIP(), []int{17} } func (x *ClusterStatusResponse) GetSchemaVersion() string { @@ -1329,7 +1407,7 @@ type NodeEvidence struct { func (x *NodeEvidence) Reset() { *x = NodeEvidence{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[17] + mi := &file_control_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1342,7 +1420,7 @@ func (x *NodeEvidence) String() string { func (*NodeEvidence) ProtoMessage() {} func (x *NodeEvidence) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[17] + mi := &file_control_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1355,7 +1433,7 @@ func (x *NodeEvidence) ProtoReflect() protoreflect.Message { // Deprecated: Use NodeEvidence.ProtoReflect.Descriptor instead. func (*NodeEvidence) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{17} + return file_control_proto_rawDescGZIP(), []int{18} } func (x *NodeEvidence) GetNodeName() string { @@ -1479,7 +1557,7 @@ type VolumeEvidence struct { func (x *VolumeEvidence) Reset() { *x = VolumeEvidence{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[18] + mi := &file_control_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1492,7 +1570,7 @@ func (x *VolumeEvidence) String() string { func (*VolumeEvidence) ProtoMessage() {} func (x *VolumeEvidence) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[18] + mi := &file_control_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1505,7 +1583,7 @@ func (x *VolumeEvidence) ProtoReflect() protoreflect.Message { // Deprecated: Use VolumeEvidence.ProtoReflect.Descriptor instead. func (*VolumeEvidence) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{18} + return file_control_proto_rawDescGZIP(), []int{19} } func (x *VolumeEvidence) GetVolumeId() string { @@ -1679,7 +1757,7 @@ type ReplicaEvidence struct { func (x *ReplicaEvidence) Reset() { *x = ReplicaEvidence{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[19] + mi := &file_control_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1692,7 +1770,7 @@ func (x *ReplicaEvidence) String() string { func (*ReplicaEvidence) ProtoMessage() {} func (x *ReplicaEvidence) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[19] + mi := &file_control_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1705,7 +1783,7 @@ func (x *ReplicaEvidence) ProtoReflect() protoreflect.Message { // Deprecated: Use ReplicaEvidence.ProtoReflect.Descriptor instead. func (*ReplicaEvidence) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{19} + return file_control_proto_rawDescGZIP(), []int{20} } func (x *ReplicaEvidence) GetReplicaId() string { @@ -1880,7 +1958,7 @@ type ClusterEvent struct { func (x *ClusterEvent) Reset() { *x = ClusterEvent{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[20] + mi := &file_control_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1893,7 +1971,7 @@ func (x *ClusterEvent) String() string { func (*ClusterEvent) ProtoMessage() {} func (x *ClusterEvent) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[20] + mi := &file_control_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1906,7 +1984,7 @@ func (x *ClusterEvent) ProtoReflect() protoreflect.Message { // Deprecated: Use ClusterEvent.ProtoReflect.Descriptor instead. func (*ClusterEvent) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{20} + return file_control_proto_rawDescGZIP(), []int{21} } func (x *ClusterEvent) GetEventId() string { @@ -2027,7 +2105,7 @@ type ListVolumesResponse struct { func (x *ListVolumesResponse) Reset() { *x = ListVolumesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[21] + mi := &file_control_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2040,7 +2118,7 @@ func (x *ListVolumesResponse) String() string { func (*ListVolumesResponse) ProtoMessage() {} func (x *ListVolumesResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[21] + mi := &file_control_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2053,7 +2131,7 @@ func (x *ListVolumesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListVolumesResponse.ProtoReflect.Descriptor instead. func (*ListVolumesResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{21} + return file_control_proto_rawDescGZIP(), []int{22} } func (x *ListVolumesResponse) GetSchemaVersion() string { @@ -2091,7 +2169,7 @@ type VolumeTimelineResponse struct { func (x *VolumeTimelineResponse) Reset() { *x = VolumeTimelineResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[22] + mi := &file_control_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2104,7 +2182,7 @@ func (x *VolumeTimelineResponse) String() string { func (*VolumeTimelineResponse) ProtoMessage() {} func (x *VolumeTimelineResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[22] + mi := &file_control_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2117,7 +2195,7 @@ func (x *VolumeTimelineResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use VolumeTimelineResponse.ProtoReflect.Descriptor instead. func (*VolumeTimelineResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{22} + return file_control_proto_rawDescGZIP(), []int{23} } func (x *VolumeTimelineResponse) GetSchemaVersion() string { @@ -2167,7 +2245,7 @@ type CreateVolumeRequest struct { func (x *CreateVolumeRequest) Reset() { *x = CreateVolumeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[23] + mi := &file_control_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2180,7 +2258,7 @@ func (x *CreateVolumeRequest) String() string { func (*CreateVolumeRequest) ProtoMessage() {} func (x *CreateVolumeRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[23] + mi := &file_control_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2193,7 +2271,7 @@ func (x *CreateVolumeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateVolumeRequest.ProtoReflect.Descriptor instead. func (*CreateVolumeRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{23} + return file_control_proto_rawDescGZIP(), []int{24} } func (x *CreateVolumeRequest) GetVolumeId() string { @@ -2278,7 +2356,7 @@ type CreateVolumeResponse struct { func (x *CreateVolumeResponse) Reset() { *x = CreateVolumeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[24] + mi := &file_control_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2291,7 +2369,7 @@ func (x *CreateVolumeResponse) String() string { func (*CreateVolumeResponse) ProtoMessage() {} func (x *CreateVolumeResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[24] + mi := &file_control_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2304,7 +2382,7 @@ func (x *CreateVolumeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateVolumeResponse.ProtoReflect.Descriptor instead. func (*CreateVolumeResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{24} + return file_control_proto_rawDescGZIP(), []int{25} } func (x *CreateVolumeResponse) GetVolumeId() string { @@ -2381,7 +2459,7 @@ type DeleteVolumeRequest struct { func (x *DeleteVolumeRequest) Reset() { *x = DeleteVolumeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[25] + mi := &file_control_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2394,7 +2472,7 @@ func (x *DeleteVolumeRequest) String() string { func (*DeleteVolumeRequest) ProtoMessage() {} func (x *DeleteVolumeRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[25] + mi := &file_control_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2407,7 +2485,7 @@ func (x *DeleteVolumeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteVolumeRequest.ProtoReflect.Descriptor instead. func (*DeleteVolumeRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{25} + return file_control_proto_rawDescGZIP(), []int{26} } func (x *DeleteVolumeRequest) GetVolumeId() string { @@ -2426,7 +2504,7 @@ type DeleteVolumeResponse struct { func (x *DeleteVolumeResponse) Reset() { *x = DeleteVolumeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[26] + mi := &file_control_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2439,7 +2517,7 @@ func (x *DeleteVolumeResponse) String() string { func (*DeleteVolumeResponse) ProtoMessage() {} func (x *DeleteVolumeResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[26] + mi := &file_control_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2452,7 +2530,7 @@ func (x *DeleteVolumeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteVolumeResponse.ProtoReflect.Descriptor instead. func (*DeleteVolumeResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{26} + return file_control_proto_rawDescGZIP(), []int{27} } type FailbackRequest struct { @@ -2476,7 +2554,7 @@ type FailbackRequest struct { func (x *FailbackRequest) Reset() { *x = FailbackRequest{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[27] + mi := &file_control_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2489,7 +2567,7 @@ func (x *FailbackRequest) String() string { func (*FailbackRequest) ProtoMessage() {} func (x *FailbackRequest) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[27] + mi := &file_control_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2502,7 +2580,7 @@ func (x *FailbackRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use FailbackRequest.ProtoReflect.Descriptor instead. func (*FailbackRequest) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{27} + return file_control_proto_rawDescGZIP(), []int{28} } func (x *FailbackRequest) GetVolumeId() string { @@ -2599,7 +2677,7 @@ type FailbackResponse struct { func (x *FailbackResponse) Reset() { *x = FailbackResponse{} if protoimpl.UnsafeEnabled { - mi := &file_control_proto_msgTypes[28] + mi := &file_control_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2612,7 +2690,7 @@ func (x *FailbackResponse) String() string { func (*FailbackResponse) ProtoMessage() {} func (x *FailbackResponse) ProtoReflect() protoreflect.Message { - mi := &file_control_proto_msgTypes[28] + mi := &file_control_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2625,7 +2703,7 @@ func (x *FailbackResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use FailbackResponse.ProtoReflect.Descriptor instead. func (*FailbackResponse) Descriptor() ([]byte, []int) { - return file_control_proto_rawDescGZIP(), []int{28} + return file_control_proto_rawDescGZIP(), []int{29} } func (x *FailbackResponse) GetFailbackStarted() bool { @@ -2698,7 +2776,7 @@ var file_control_proto_rawDesc = []byte{ 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x53, 0x6c, 0x6f, 0x74, - 0x52, 0x05, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x22, 0xc3, 0x03, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x72, + 0x52, 0x05, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x22, 0xee, 0x03, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x53, 0x6c, 0x6f, 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, @@ -2726,94 +2804,107 @@ var file_control_proto_rawDesc = []byte{ 0x6c, 0x2e, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x09, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x6e, 0x63, 0x61, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x69, 0x6e, 0x63, 0x61, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa8, 0x01, - 0x0a, 0x0e, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, - 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, - 0x12, 0x10, 0x0a, 0x03, 0x69, 0x71, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x69, - 0x71, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x71, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6e, 0x71, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x03, 0x6c, 0x75, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x73, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6e, 0x73, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x67, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x72, - 0x74, 0x62, 0x65, 0x61, 0x74, 0x41, 0x63, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x22, 0x69, 0x0a, 0x0f, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x41, 0x63, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, - 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x71, 0x0a, 0x10, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 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, 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, 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, - 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, 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, - 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, 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, 0xe3, 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, 0x12, 0x45, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x09, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x73, 0x22, + 0x52, 0x0b, 0x69, 0x6e, 0x63, 0x61, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, + 0x10, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x79, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0xa8, 0x01, 0x0a, 0x0e, 0x46, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x69, + 0x71, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x69, 0x71, 0x6e, 0x12, 0x10, 0x0a, + 0x03, 0x6e, 0x71, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6e, 0x71, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x6c, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6c, 0x75, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x73, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x6e, 0x73, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, + 0x6f, 0x72, 0x74, 0x22, 0x67, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, + 0x41, 0x63, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x69, 0x0a, 0x0f, + 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x6b, 0x12, + 0x3b, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x19, 0x0a, 0x08, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x71, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 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, 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, 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, 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, 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, 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, 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, 0xbd, 0x03, 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, 0x12, 0x45, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x73, + 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x09, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x73, 0x12, 0x58, 0x0a, 0x12, 0x75, 0x6e, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x55, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x79, 0x52, 0x11, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x52, 0x65, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x73, 0x22, 0x49, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x55, + 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 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, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, @@ -3282,7 +3373,7 @@ func file_control_proto_rawDescGZIP() []byte { return file_control_proto_rawDescData } -var file_control_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_control_proto_msgTypes = make([]protoimpl.MessageInfo, 30) var file_control_proto_goTypes = []interface{}{ (*HeartbeatReport)(nil), // 0: seaweedfs.block.control.HeartbeatReport (*HeartbeatSlot)(nil), // 1: seaweedfs.block.control.HeartbeatSlot @@ -3294,79 +3385,81 @@ var file_control_proto_goTypes = []interface{}{ (*AssignmentFact)(nil), // 7: seaweedfs.block.control.AssignmentFact (*StatusRequest)(nil), // 8: seaweedfs.block.control.StatusRequest (*StatusResponse)(nil), // 9: seaweedfs.block.control.StatusResponse - (*GetClusterStatusRequest)(nil), // 10: seaweedfs.block.control.GetClusterStatusRequest - (*ListVolumesRequest)(nil), // 11: seaweedfs.block.control.ListVolumesRequest - (*GetVolumeStatusRequest)(nil), // 12: seaweedfs.block.control.GetVolumeStatusRequest - (*GetVolumeTimelineRequest)(nil), // 13: seaweedfs.block.control.GetVolumeTimelineRequest - (*WatchClusterEventsRequest)(nil), // 14: seaweedfs.block.control.WatchClusterEventsRequest - (*ObservationCondition)(nil), // 15: seaweedfs.block.control.ObservationCondition - (*ClusterStatusResponse)(nil), // 16: seaweedfs.block.control.ClusterStatusResponse - (*NodeEvidence)(nil), // 17: seaweedfs.block.control.NodeEvidence - (*VolumeEvidence)(nil), // 18: seaweedfs.block.control.VolumeEvidence - (*ReplicaEvidence)(nil), // 19: seaweedfs.block.control.ReplicaEvidence - (*ClusterEvent)(nil), // 20: seaweedfs.block.control.ClusterEvent - (*ListVolumesResponse)(nil), // 21: seaweedfs.block.control.ListVolumesResponse - (*VolumeTimelineResponse)(nil), // 22: seaweedfs.block.control.VolumeTimelineResponse - (*CreateVolumeRequest)(nil), // 23: seaweedfs.block.control.CreateVolumeRequest - (*CreateVolumeResponse)(nil), // 24: seaweedfs.block.control.CreateVolumeResponse - (*DeleteVolumeRequest)(nil), // 25: seaweedfs.block.control.DeleteVolumeRequest - (*DeleteVolumeResponse)(nil), // 26: seaweedfs.block.control.DeleteVolumeResponse - (*FailbackRequest)(nil), // 27: seaweedfs.block.control.FailbackRequest - (*FailbackResponse)(nil), // 28: seaweedfs.block.control.FailbackResponse - (*timestamp.Timestamp)(nil), // 29: google.protobuf.Timestamp + (*ReplicaUnhealthy)(nil), // 10: seaweedfs.block.control.ReplicaUnhealthy + (*GetClusterStatusRequest)(nil), // 11: seaweedfs.block.control.GetClusterStatusRequest + (*ListVolumesRequest)(nil), // 12: seaweedfs.block.control.ListVolumesRequest + (*GetVolumeStatusRequest)(nil), // 13: seaweedfs.block.control.GetVolumeStatusRequest + (*GetVolumeTimelineRequest)(nil), // 14: seaweedfs.block.control.GetVolumeTimelineRequest + (*WatchClusterEventsRequest)(nil), // 15: seaweedfs.block.control.WatchClusterEventsRequest + (*ObservationCondition)(nil), // 16: seaweedfs.block.control.ObservationCondition + (*ClusterStatusResponse)(nil), // 17: seaweedfs.block.control.ClusterStatusResponse + (*NodeEvidence)(nil), // 18: seaweedfs.block.control.NodeEvidence + (*VolumeEvidence)(nil), // 19: seaweedfs.block.control.VolumeEvidence + (*ReplicaEvidence)(nil), // 20: seaweedfs.block.control.ReplicaEvidence + (*ClusterEvent)(nil), // 21: seaweedfs.block.control.ClusterEvent + (*ListVolumesResponse)(nil), // 22: seaweedfs.block.control.ListVolumesResponse + (*VolumeTimelineResponse)(nil), // 23: seaweedfs.block.control.VolumeTimelineResponse + (*CreateVolumeRequest)(nil), // 24: seaweedfs.block.control.CreateVolumeRequest + (*CreateVolumeResponse)(nil), // 25: seaweedfs.block.control.CreateVolumeResponse + (*DeleteVolumeRequest)(nil), // 26: seaweedfs.block.control.DeleteVolumeRequest + (*DeleteVolumeResponse)(nil), // 27: seaweedfs.block.control.DeleteVolumeResponse + (*FailbackRequest)(nil), // 28: seaweedfs.block.control.FailbackRequest + (*FailbackResponse)(nil), // 29: seaweedfs.block.control.FailbackResponse + (*timestamp.Timestamp)(nil), // 30: google.protobuf.Timestamp } var file_control_proto_depIdxs = []int32{ - 29, // 0: seaweedfs.block.control.HeartbeatReport.sent_at:type_name -> google.protobuf.Timestamp + 30, // 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 2, // 2: seaweedfs.block.control.HeartbeatSlot.frontends:type_name -> seaweedfs.block.control.FrontendTarget - 29, // 3: seaweedfs.block.control.HeartbeatAck.accepted_at:type_name -> google.protobuf.Timestamp - 29, // 4: seaweedfs.block.control.ClusterEventAck.accepted_at:type_name -> google.protobuf.Timestamp + 30, // 3: seaweedfs.block.control.HeartbeatAck.accepted_at:type_name -> google.protobuf.Timestamp + 30, // 4: seaweedfs.block.control.ClusterEventAck.accepted_at:type_name -> google.protobuf.Timestamp 6, // 5: seaweedfs.block.control.AssignmentFact.peers:type_name -> seaweedfs.block.control.ReplicaDescriptor 2, // 6: seaweedfs.block.control.StatusResponse.frontends:type_name -> seaweedfs.block.control.FrontendTarget - 29, // 7: seaweedfs.block.control.ClusterStatusResponse.captured_at:type_name -> google.protobuf.Timestamp - 17, // 8: seaweedfs.block.control.ClusterStatusResponse.nodes:type_name -> seaweedfs.block.control.NodeEvidence - 18, // 9: seaweedfs.block.control.ClusterStatusResponse.volumes:type_name -> seaweedfs.block.control.VolumeEvidence - 15, // 10: seaweedfs.block.control.ClusterStatusResponse.conditions:type_name -> seaweedfs.block.control.ObservationCondition - 20, // 11: seaweedfs.block.control.ClusterStatusResponse.events:type_name -> seaweedfs.block.control.ClusterEvent - 29, // 12: seaweedfs.block.control.NodeEvidence.last_heartbeat_at:type_name -> google.protobuf.Timestamp - 15, // 13: seaweedfs.block.control.NodeEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition - 19, // 14: seaweedfs.block.control.VolumeEvidence.replicas:type_name -> seaweedfs.block.control.ReplicaEvidence - 15, // 15: seaweedfs.block.control.VolumeEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition - 15, // 16: seaweedfs.block.control.ReplicaEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition - 29, // 17: seaweedfs.block.control.ClusterEvent.event_time:type_name -> google.protobuf.Timestamp - 29, // 18: seaweedfs.block.control.ListVolumesResponse.captured_at:type_name -> google.protobuf.Timestamp - 18, // 19: seaweedfs.block.control.ListVolumesResponse.volumes:type_name -> seaweedfs.block.control.VolumeEvidence - 29, // 20: seaweedfs.block.control.VolumeTimelineResponse.captured_at:type_name -> google.protobuf.Timestamp - 20, // 21: seaweedfs.block.control.VolumeTimelineResponse.events:type_name -> seaweedfs.block.control.ClusterEvent - 0, // 22: seaweedfs.block.control.ObservationService.ReportHeartbeat:input_type -> seaweedfs.block.control.HeartbeatReport - 20, // 23: seaweedfs.block.control.ObservationService.ReportClusterEvent:input_type -> seaweedfs.block.control.ClusterEvent - 5, // 24: seaweedfs.block.control.AssignmentService.SubscribeAssignments:input_type -> seaweedfs.block.control.SubscribeRequest - 8, // 25: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:input_type -> seaweedfs.block.control.StatusRequest - 10, // 26: seaweedfs.block.control.ClusterEvidenceService.GetClusterStatus:input_type -> seaweedfs.block.control.GetClusterStatusRequest - 11, // 27: seaweedfs.block.control.ClusterEvidenceService.ListVolumes:input_type -> seaweedfs.block.control.ListVolumesRequest - 12, // 28: seaweedfs.block.control.ClusterEvidenceService.GetVolumeStatus:input_type -> seaweedfs.block.control.GetVolumeStatusRequest - 13, // 29: seaweedfs.block.control.ClusterEvidenceService.GetVolumeTimeline:input_type -> seaweedfs.block.control.GetVolumeTimelineRequest - 14, // 30: seaweedfs.block.control.ClusterEvidenceService.WatchClusterEvents:input_type -> seaweedfs.block.control.WatchClusterEventsRequest - 23, // 31: seaweedfs.block.control.LifecycleService.CreateVolume:input_type -> seaweedfs.block.control.CreateVolumeRequest - 25, // 32: seaweedfs.block.control.LifecycleService.DeleteVolume:input_type -> seaweedfs.block.control.DeleteVolumeRequest - 27, // 33: seaweedfs.block.control.FailbackService.ExecuteFailback:input_type -> seaweedfs.block.control.FailbackRequest - 3, // 34: seaweedfs.block.control.ObservationService.ReportHeartbeat:output_type -> seaweedfs.block.control.HeartbeatAck - 4, // 35: seaweedfs.block.control.ObservationService.ReportClusterEvent:output_type -> seaweedfs.block.control.ClusterEventAck - 7, // 36: seaweedfs.block.control.AssignmentService.SubscribeAssignments:output_type -> seaweedfs.block.control.AssignmentFact - 9, // 37: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:output_type -> seaweedfs.block.control.StatusResponse - 16, // 38: seaweedfs.block.control.ClusterEvidenceService.GetClusterStatus:output_type -> seaweedfs.block.control.ClusterStatusResponse - 21, // 39: seaweedfs.block.control.ClusterEvidenceService.ListVolumes:output_type -> seaweedfs.block.control.ListVolumesResponse - 18, // 40: seaweedfs.block.control.ClusterEvidenceService.GetVolumeStatus:output_type -> seaweedfs.block.control.VolumeEvidence - 22, // 41: seaweedfs.block.control.ClusterEvidenceService.GetVolumeTimeline:output_type -> seaweedfs.block.control.VolumeTimelineResponse - 20, // 42: seaweedfs.block.control.ClusterEvidenceService.WatchClusterEvents:output_type -> seaweedfs.block.control.ClusterEvent - 24, // 43: seaweedfs.block.control.LifecycleService.CreateVolume:output_type -> seaweedfs.block.control.CreateVolumeResponse - 26, // 44: seaweedfs.block.control.LifecycleService.DeleteVolume:output_type -> seaweedfs.block.control.DeleteVolumeResponse - 28, // 45: seaweedfs.block.control.FailbackService.ExecuteFailback:output_type -> seaweedfs.block.control.FailbackResponse - 34, // [34:46] is the sub-list for method output_type - 22, // [22:34] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 10, // 7: seaweedfs.block.control.StatusResponse.unhealthy_replicas:type_name -> seaweedfs.block.control.ReplicaUnhealthy + 30, // 8: seaweedfs.block.control.ClusterStatusResponse.captured_at:type_name -> google.protobuf.Timestamp + 18, // 9: seaweedfs.block.control.ClusterStatusResponse.nodes:type_name -> seaweedfs.block.control.NodeEvidence + 19, // 10: seaweedfs.block.control.ClusterStatusResponse.volumes:type_name -> seaweedfs.block.control.VolumeEvidence + 16, // 11: seaweedfs.block.control.ClusterStatusResponse.conditions:type_name -> seaweedfs.block.control.ObservationCondition + 21, // 12: seaweedfs.block.control.ClusterStatusResponse.events:type_name -> seaweedfs.block.control.ClusterEvent + 30, // 13: seaweedfs.block.control.NodeEvidence.last_heartbeat_at:type_name -> google.protobuf.Timestamp + 16, // 14: seaweedfs.block.control.NodeEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition + 20, // 15: seaweedfs.block.control.VolumeEvidence.replicas:type_name -> seaweedfs.block.control.ReplicaEvidence + 16, // 16: seaweedfs.block.control.VolumeEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition + 16, // 17: seaweedfs.block.control.ReplicaEvidence.conditions:type_name -> seaweedfs.block.control.ObservationCondition + 30, // 18: seaweedfs.block.control.ClusterEvent.event_time:type_name -> google.protobuf.Timestamp + 30, // 19: seaweedfs.block.control.ListVolumesResponse.captured_at:type_name -> google.protobuf.Timestamp + 19, // 20: seaweedfs.block.control.ListVolumesResponse.volumes:type_name -> seaweedfs.block.control.VolumeEvidence + 30, // 21: seaweedfs.block.control.VolumeTimelineResponse.captured_at:type_name -> google.protobuf.Timestamp + 21, // 22: seaweedfs.block.control.VolumeTimelineResponse.events:type_name -> seaweedfs.block.control.ClusterEvent + 0, // 23: seaweedfs.block.control.ObservationService.ReportHeartbeat:input_type -> seaweedfs.block.control.HeartbeatReport + 21, // 24: seaweedfs.block.control.ObservationService.ReportClusterEvent:input_type -> seaweedfs.block.control.ClusterEvent + 5, // 25: seaweedfs.block.control.AssignmentService.SubscribeAssignments:input_type -> seaweedfs.block.control.SubscribeRequest + 8, // 26: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:input_type -> seaweedfs.block.control.StatusRequest + 11, // 27: seaweedfs.block.control.ClusterEvidenceService.GetClusterStatus:input_type -> seaweedfs.block.control.GetClusterStatusRequest + 12, // 28: seaweedfs.block.control.ClusterEvidenceService.ListVolumes:input_type -> seaweedfs.block.control.ListVolumesRequest + 13, // 29: seaweedfs.block.control.ClusterEvidenceService.GetVolumeStatus:input_type -> seaweedfs.block.control.GetVolumeStatusRequest + 14, // 30: seaweedfs.block.control.ClusterEvidenceService.GetVolumeTimeline:input_type -> seaweedfs.block.control.GetVolumeTimelineRequest + 15, // 31: seaweedfs.block.control.ClusterEvidenceService.WatchClusterEvents:input_type -> seaweedfs.block.control.WatchClusterEventsRequest + 24, // 32: seaweedfs.block.control.LifecycleService.CreateVolume:input_type -> seaweedfs.block.control.CreateVolumeRequest + 26, // 33: seaweedfs.block.control.LifecycleService.DeleteVolume:input_type -> seaweedfs.block.control.DeleteVolumeRequest + 28, // 34: seaweedfs.block.control.FailbackService.ExecuteFailback:input_type -> seaweedfs.block.control.FailbackRequest + 3, // 35: seaweedfs.block.control.ObservationService.ReportHeartbeat:output_type -> seaweedfs.block.control.HeartbeatAck + 4, // 36: seaweedfs.block.control.ObservationService.ReportClusterEvent:output_type -> seaweedfs.block.control.ClusterEventAck + 7, // 37: seaweedfs.block.control.AssignmentService.SubscribeAssignments:output_type -> seaweedfs.block.control.AssignmentFact + 9, // 38: seaweedfs.block.control.EvidenceService.QueryVolumeStatus:output_type -> seaweedfs.block.control.StatusResponse + 17, // 39: seaweedfs.block.control.ClusterEvidenceService.GetClusterStatus:output_type -> seaweedfs.block.control.ClusterStatusResponse + 22, // 40: seaweedfs.block.control.ClusterEvidenceService.ListVolumes:output_type -> seaweedfs.block.control.ListVolumesResponse + 19, // 41: seaweedfs.block.control.ClusterEvidenceService.GetVolumeStatus:output_type -> seaweedfs.block.control.VolumeEvidence + 23, // 42: seaweedfs.block.control.ClusterEvidenceService.GetVolumeTimeline:output_type -> seaweedfs.block.control.VolumeTimelineResponse + 21, // 43: seaweedfs.block.control.ClusterEvidenceService.WatchClusterEvents:output_type -> seaweedfs.block.control.ClusterEvent + 25, // 44: seaweedfs.block.control.LifecycleService.CreateVolume:output_type -> seaweedfs.block.control.CreateVolumeResponse + 27, // 45: seaweedfs.block.control.LifecycleService.DeleteVolume:output_type -> seaweedfs.block.control.DeleteVolumeResponse + 29, // 46: seaweedfs.block.control.FailbackService.ExecuteFailback:output_type -> seaweedfs.block.control.FailbackResponse + 35, // [35:47] is the sub-list for method output_type + 23, // [23:35] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name } func init() { file_control_proto_init() } @@ -3496,7 +3589,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetClusterStatusRequest); i { + switch v := v.(*ReplicaUnhealthy); i { case 0: return &v.state case 1: @@ -3508,7 +3601,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListVolumesRequest); i { + switch v := v.(*GetClusterStatusRequest); i { case 0: return &v.state case 1: @@ -3520,7 +3613,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetVolumeStatusRequest); i { + switch v := v.(*ListVolumesRequest); i { case 0: return &v.state case 1: @@ -3532,7 +3625,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetVolumeTimelineRequest); i { + switch v := v.(*GetVolumeStatusRequest); i { case 0: return &v.state case 1: @@ -3544,7 +3637,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchClusterEventsRequest); i { + switch v := v.(*GetVolumeTimelineRequest); i { case 0: return &v.state case 1: @@ -3556,7 +3649,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObservationCondition); i { + switch v := v.(*WatchClusterEventsRequest); i { case 0: return &v.state case 1: @@ -3568,7 +3661,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClusterStatusResponse); i { + switch v := v.(*ObservationCondition); i { case 0: return &v.state case 1: @@ -3580,7 +3673,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeEvidence); i { + switch v := v.(*ClusterStatusResponse); i { case 0: return &v.state case 1: @@ -3592,7 +3685,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VolumeEvidence); i { + switch v := v.(*NodeEvidence); i { case 0: return &v.state case 1: @@ -3604,7 +3697,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplicaEvidence); i { + switch v := v.(*VolumeEvidence); i { case 0: return &v.state case 1: @@ -3616,7 +3709,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClusterEvent); i { + switch v := v.(*ReplicaEvidence); i { case 0: return &v.state case 1: @@ -3628,7 +3721,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListVolumesResponse); i { + switch v := v.(*ClusterEvent); i { case 0: return &v.state case 1: @@ -3640,7 +3733,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VolumeTimelineResponse); i { + switch v := v.(*ListVolumesResponse); i { case 0: return &v.state case 1: @@ -3652,7 +3745,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateVolumeRequest); i { + switch v := v.(*VolumeTimelineResponse); i { case 0: return &v.state case 1: @@ -3664,7 +3757,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateVolumeResponse); i { + switch v := v.(*CreateVolumeRequest); i { case 0: return &v.state case 1: @@ -3676,7 +3769,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteVolumeRequest); i { + switch v := v.(*CreateVolumeResponse); i { case 0: return &v.state case 1: @@ -3688,7 +3781,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteVolumeResponse); i { + switch v := v.(*DeleteVolumeRequest); i { case 0: return &v.state case 1: @@ -3700,7 +3793,7 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FailbackRequest); i { + switch v := v.(*DeleteVolumeResponse); i { case 0: return &v.state case 1: @@ -3712,6 +3805,18 @@ func file_control_proto_init() { } } file_control_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FailbackRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_control_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FailbackResponse); i { case 0: return &v.state @@ -3730,7 +3835,7 @@ func file_control_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_control_proto_rawDesc, NumEnums: 0, - NumMessages: 29, + NumMessages: 30, NumExtensions: 0, NumServices: 6, }, diff --git a/seaweed-block/core/rpc/proto/control.proto b/seaweed-block/core/rpc/proto/control.proto index 79f4fa8c94..8841d72118 100644 --- a/seaweed-block/core/rpc/proto/control.proto +++ b/seaweed-block/core/rpc/proto/control.proto @@ -126,6 +126,12 @@ message HeartbeatSlot { // every process start. Raw observation fact: the controller uses it // only to bound a restarted primary's boot grace. string incarnation = 12; + // unhealthy_reason is an explicit unhealthy report for this slot + // (#128 rule 6): recovery_timeout when a primary-assigned replica did + // not become promotion-ready within its recover timeout, or + // role_admission_failed for the G1 latch. Set together with + // eligible=false; empty when healthy. + string unhealthy_reason = 13; } // FrontendTarget — read-only frontend publication fact reported by @@ -225,6 +231,14 @@ message StatusResponse { string last_unsupported_reason = 6; string last_convergence_stuck_at = 7; repeated FrontendTarget frontends = 8; + // unhealthy_replicas lists the volume's replicas whose fresh + // heartbeat carries an explicit unhealthy reason (#128 rule 6). + repeated ReplicaUnhealthy unhealthy_replicas = 9; +} + +message ReplicaUnhealthy { + string replica_id = 1; + string reason = 2; } message GetClusterStatusRequest { From 81575168cc73d2f374ecfa5968c3c837531494d1 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:20:13 -0800 Subject: [PATCH 2/7] volume, master: recovery watchdog reports an explicit unhealthy fact (#128 rule 6) Volume: a replica holding the PRIMARY assignment that has not produced the engine's promotion-ready fact within --recover-timeout (default 30s, from the primary assignment in this incarnation) reports Eligible=false with unhealthy_reason=recovery_timeout instead of staying silently not-ready. The G1 role-admission latch of a primary-assigned replica reports role_admission_failed. A fresh ready fact clears it (Eligible=true, reason empty) and disarms the watchdog until the next primary epoch. Supporting replicas are never flagged; /status shows their catch-up state (elapsed, lag). Master: an explicit unhealthy slot is ineligible, so it gets no boot grace and fails over at once to a peer that passes the promotion evidence gate; with no qualified peer nobody is promoted. The reason is listed in QueryVolumeStatus (unhealthy_replicas) and recorded as replica_unhealthy / replica_unhealthy_cleared events when a slot's stored reason changes. wal_corrupt and io_error need typed failures from the durable recovery path: tracked as a follow-up issue. Lock order: the watchdog has its own mutex and calls nothing while holding it; the master's transition check reads the observation store before and after ingest and appends to the event ring, holding neither. Refs #128 Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/host/master/services.go | 65 +++++++++++++++++++ .../core/host/volume/recovery_watchdog.go | 33 +++++++++- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/seaweed-block/core/host/master/services.go b/seaweed-block/core/host/master/services.go index e1746e17cc..800b71377a 100644 --- a/seaweed-block/core/host/master/services.go +++ b/seaweed-block/core/host/master/services.go @@ -10,6 +10,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/adapter" "github.com/seaweedfs/seaweed-block/core/authority" "github.com/seaweedfs/seaweed-block/core/lifecycle" + "github.com/seaweedfs/seaweed-block/core/ops" control "github.com/seaweedfs/seaweed-block/core/rpc/control" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -130,9 +131,11 @@ func (s *services) ReportHeartbeat(ctx context.Context, r *control.HeartbeatRepo return nil, err } msg := heartbeatFromWire(r) + before := s.host.slotUnhealthyReasons(msg) if err := s.host.obs.IngestHeartbeat(msg); err != nil { return nil, fmt.Errorf("ingest: %w", err) } + s.host.recordUnhealthyTransitions(msg, before) return &control.HeartbeatAck{ AcceptedAt: timestamppb.Now(), Sequence: s.seq.Add(1), @@ -345,6 +348,7 @@ func (s *services) QueryVolumeStatus(ctx context.Context, req *control.StatusReq } replicaIDs = primaryFirstReplicaIDs(replicaIDs, line.ReplicaID) resp.Frontends = statusFrontendsForAssignedVolume(s.host.obs, req.VolumeId, replicaIDs, line.Assigned) + resp.UnhealthyReplicas = statusUnhealthyReplicas(s.host.obs, req.VolumeId, replicaIDs) } if ev, ok := ctrl.LastUnsupported(req.VolumeId); ok { resp.LastUnsupportedReason = ev.Reason @@ -660,6 +664,7 @@ func heartbeatFromWire(r *control.HeartbeatReport) authority.HeartbeatMessage { Withdrawn: s.Withdrawn, EvidenceScore: s.EvidenceScore, Incarnation: s.Incarnation, + UnhealthyReason: s.UnhealthyReason, LocalRoleClaim: authority.LocalRoleClaim(s.LocalRoleClaim), }) } @@ -712,3 +717,63 @@ func frontendTargetsToWire(in []authority.FrontendTargetFact) []*control.Fronten } return out } + +// statusUnhealthyReplicas lists the replicas whose fresh slot fact +// carries an explicit unhealthy reason (#128 rule 6). +func statusUnhealthyReplicas(obs *authority.ObservationHost, volumeID string, replicaIDs []string) []*control.ReplicaUnhealthy { + if obs == nil { + return nil + } + var out []*control.ReplicaUnhealthy + for _, replicaID := range replicaIDs { + if slot, ok := obs.Store().SlotFact(volumeID, replicaID); ok && slot.UnhealthyReason != "" { + out = append(out, &control.ReplicaUnhealthy{ReplicaId: replicaID, Reason: slot.UnhealthyReason}) + } + } + return out +} + +// slotUnhealthyReasons returns the stored unhealthy reason of every slot +// the heartbeat reports, before it is ingested. +func (h *Host) slotUnhealthyReasons(msg authority.HeartbeatMessage) map[string]string { + if h.obs == nil { + return nil + } + out := make(map[string]string, len(msg.Slots)) + for _, s := range msg.Slots { + prev, _ := h.obs.Store().SlotFact(s.VolumeID, s.ReplicaID) + out[s.VolumeID+"/"+s.ReplicaID] = prev.UnhealthyReason + } + return out +} + +// recordUnhealthyTransitions records an event when a slot's stored +// unhealthy reason changed with this heartbeat: set, changed, or cleared +// (#128 rule 6). It compares stored facts, so an ingest the store +// refused records nothing. +func (h *Host) recordUnhealthyTransitions(msg authority.HeartbeatMessage, before map[string]string) { + if h.obs == nil { + return + } + for _, s := range msg.Slots { + cur, _ := h.obs.Store().SlotFact(s.VolumeID, s.ReplicaID) + prev := before[s.VolumeID+"/"+s.ReplicaID] + if cur.UnhealthyReason == prev { + continue + } + if cur.UnhealthyReason == "" { + h.events.append(ops.ClusterEvent{ + VolumeID: s.VolumeID, ReplicaID: s.ReplicaID, + Type: "replica_unhealthy_cleared", Severity: "info", + Message: "replica reported healthy again", OldValue: prev, + }) + continue + } + h.events.append(ops.ClusterEvent{ + VolumeID: s.VolumeID, ReplicaID: s.ReplicaID, + Type: "replica_unhealthy", Severity: "warning", + Message: "replica reported an explicit unhealthy fact: " + cur.UnhealthyReason, + Reason: cur.UnhealthyReason, OldValue: prev, NewValue: cur.UnhealthyReason, + }) + } +} diff --git a/seaweed-block/core/host/volume/recovery_watchdog.go b/seaweed-block/core/host/volume/recovery_watchdog.go index 6c0cb384b5..7d4e31fbbd 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog.go +++ b/seaweed-block/core/host/volume/recovery_watchdog.go @@ -105,13 +105,42 @@ func (w *recoveryWatchdog) supportingAdmitted(epoch uint64) { // is promotion-ready now and whether the G1 latch holds. fired is true // on the call that latched recovery_timeout. func (w *recoveryWatchdog) reason(ready, roleAdmissionFailed bool) (reason string, fired bool) { - return "", false // RED: no decision yet + if w == nil { + return "", false + } + w.mu.Lock() + defer w.mu.Unlock() + if w.primarySince.IsZero() { + return "", false + } + if ready { + w.timedOut, w.readySeen = false, true + return "", false + } + if roleAdmissionFailed { + return UnhealthyRoleAdmission, false + } + if w.readySeen { + return "", false + } + if !w.timedOut && w.now().Sub(w.primarySince) >= w.timeout { + w.timedOut, fired = true, true + } + if w.timedOut { + return UnhealthyRecoveryTimeout, fired + } + return "", false } // catchUpSince is when this replica was admitted as a supporting replica // at its current epoch; zero when it is not supporting. func (w *recoveryWatchdog) catchUpSince() time.Time { - return time.Time{} // RED + if w == nil { + return time.Time{} + } + w.mu.Lock() + defer w.mu.Unlock() + return w.supportingSince } // UnhealthyReason is the slot's explicit unhealthy reason now (#128 From 845bdc0a63d6c457a81d6d7bca612be850514953 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:25:46 -0800 Subject: [PATCH 3/7] volume, master: watchdog disarm and incarnation re-arm controls claude05 accepted the disarm rule (21:24Z): after a fresh ready fact clears it, the watchdog stays disarmed until the next primary epoch or a new process incarnation. Tests: - ready, then not ready an hour later on the same incarnation (and the same assignment replayed): no recovery_timeout; - a restarted process (new incarnation, same primary epoch) is re-armed and reports recovery_timeout past the timeout, while the old process stays disarmed; - master: a running primary that degrades on the same incarnation (no unhealthy reason) follows the normal failover rules to the qualified peer, and nothing is listed as unhealthy. Doc only otherwise: the watchdog comment names the incarnation re-arm. Refs #128 Co-Authored-By: Claude Opus 5.5 --- .../master/recovery_watchdog_master_test.go | 21 +++++++++ .../core/host/volume/recovery_watchdog.go | 6 ++- .../host/volume/recovery_watchdog_test.go | 46 +++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/seaweed-block/core/host/master/recovery_watchdog_master_test.go b/seaweed-block/core/host/master/recovery_watchdog_master_test.go index 3991e98d4d..da6b623b28 100644 --- a/seaweed-block/core/host/master/recovery_watchdog_master_test.go +++ b/seaweed-block/core/host/master/recovery_watchdog_master_test.go @@ -142,3 +142,24 @@ func TestRecoveryWatchdog_MasterUnhealthyFailsOverToQualifiedPeer(t *testing.T) t.Fatalf("unhealthy primary with a qualified peer: line=%+v want r2@2", line) } } + +// A running primary that was ready and later reports not ready on the +// same incarnation (no unhealthy reason) follows the normal failover +// rules: no boot grace for that incarnation, so it fails over to the +// qualified peer, and nothing is listed as unhealthy (claude05, 21:24Z). +func TestRecoveryWatchdog_MasterLaterDegradationFollowsNormalRules(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + h.SetPromotionEvidenceProvider(&switchProbe{}) // r1 not ready, r2 ready with evidence + + reportRF3(t, svc, wireSlot{"r1-a", false, ""}, wireSlot{"r2-a", true, ""}, wireSlot{"r3-a", false, ""}) + if _, err := h.RunLifecycleProductTick(); err != nil { + t.Fatalf("product tick: %v", err) + } + if line := waitAuthorityReplica(t, h.Publisher(), "vol-rf3", "r2"); line.Epoch != 2 { + t.Fatalf("degraded running primary with a qualified peer: line=%+v want r2@2", line) + } + if got := unhealthyReplicas(t, svc); len(got) != 0 { + t.Fatalf("unhealthy replicas=%v; want none (no explicit unhealthy fact)", got) + } +} diff --git a/seaweed-block/core/host/volume/recovery_watchdog.go b/seaweed-block/core/host/volume/recovery_watchdog.go index 7d4e31fbbd..88118d2511 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog.go +++ b/seaweed-block/core/host/volume/recovery_watchdog.go @@ -24,8 +24,10 @@ import ( // stays moved: the master decides that, not the volume. // - It watches recovery after a primary assignment only: once the // replica has been promotion-ready in that assignment, the watchdog -// is disarmed until the next primary epoch (a running primary that -// later degrades is not a boot-recovery stall). +// is disarmed until the next primary epoch or a new process +// incarnation (its state is per process). A running primary that +// later degrades is not a boot-recovery stall: it goes through the +// normal controller/gate failover. // - role_admission_failed reports the G1 role-admission latch of a // primary-assigned replica, for as long as the latch holds. // diff --git a/seaweed-block/core/host/volume/recovery_watchdog_test.go b/seaweed-block/core/host/volume/recovery_watchdog_test.go index 7c920663b0..a86f8ae553 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog_test.go +++ b/seaweed-block/core/host/volume/recovery_watchdog_test.go @@ -140,3 +140,49 @@ func TestRecoveryWatchdog_StatusShowsReasonAndCatchUp(t *testing.T) { t.Fatalf("supporting replica /status: reason=%q catchUp=%+v; want no reason and catch-up elapsed >= 20ms", st.UnhealthyReason, st.CatchUp) } } + +// Once ready in this assignment, a later not-ready on the same +// incarnation is a running primary degrading, not a boot-recovery stall: +// no recovery_timeout, however long it lasts (claude05, 21:24Z). +func TestRecoveryWatchdog_ReadyThenLaterNotReadyReportsNoTimeout(t *testing.T) { + h, clk := watchdogHost(t, 10*time.Second) + h.applyFact(selfPrimaryFact(1)) + clk.advance(time.Second) + if r := h.unhealthyReason(true); r != "" { + t.Fatalf("ready: %q", r) + } + clk.advance(time.Hour) + if r := h.unhealthyReason(false); r != "" { + t.Fatalf("not ready an hour after being ready, same incarnation: %q; want no recovery_timeout", r) + } + h.applyFact(selfPrimaryFact(1)) // the same assignment replayed: still disarmed + clk.advance(time.Hour) + if r := h.unhealthyReason(false); r != "" { + t.Fatalf("same assignment replayed: %q; want still disarmed", r) + } +} + +// A new process incarnation re-arms the watchdog: its state is per +// process, so a restarted primary that stays not-ready past the timeout +// reports recovery_timeout even for the same primary epoch. +func TestRecoveryWatchdog_NewIncarnationRearms(t *testing.T) { + old, clk := watchdogHost(t, 10*time.Second) + old.applyFact(selfPrimaryFact(1)) + if r := old.unhealthyReason(true); r != "" { + t.Fatalf("old process ready: %q", r) + } + + restarted, clk2 := watchdogHost(t, 10*time.Second) // new process, same replica + if restarted.incarnation == old.incarnation { + t.Fatalf("restarted process kept incarnation %q", old.incarnation) + } + restarted.applyFact(selfPrimaryFact(1)) // same primary epoch + clk2.advance(11 * time.Second) + if s := reportSlot(t, restarted); s.Eligible || s.UnhealthyReason != UnhealthyRecoveryTimeout { + t.Fatalf("restarted process past timeout: eligible=%t reason=%q; want ineligible, %s", s.Eligible, s.UnhealthyReason, UnhealthyRecoveryTimeout) + } + clk.advance(time.Hour) + if r := old.unhealthyReason(false); r != "" { + t.Fatalf("old process stays disarmed: %q", r) + } +} From 31db16dbb38f196ae504a6af1551dbcb89dac4a3 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:36:25 -0800 Subject: [PATCH 4/7] volume, master: watchdog review controls (RED) Controls for codex01's AMEND on #134 (three P2s), with the API shape only (the watchdog takes the promotion fact's epoch; the store can return accepted health transitions; the master Host has healthMu), the behavior still as in 845bdc0: - real host: ready at epoch 2, the epoch-3 primary assignment refused at admission (peer-set install fails): the engine still ready at epoch 2 must not disarm epoch 3, which times out; a genuine epoch-3 ready fact clears it; - real host: a ready primary whose epoch-3 role call fails (G1 latch) must report role_admission_failed despite its old ready fact; a successful redelivery clears it; - master: a second heartbeat landing between the first one's ingest and its event bookkeeping must leave both events, in accepted order; - master: expiry during an ingest that reports unhealthy again must not fabricate a clear; - control: a refused older heartbeat records nothing. Refs #128 Co-Authored-By: Claude Opus 5.5 --- .../core/authority/observation_host.go | 11 ++ .../core/authority/observation_store.go | 56 +++++++++- seaweed-block/core/host/master/host.go | 1 + .../master/recovery_watchdog_master_test.go | 93 ++++++++++++++++ seaweed-block/core/host/volume/host.go | 18 ++- .../core/host/volume/recovery_watchdog.go | 28 +++-- .../host/volume/recovery_watchdog_test.go | 105 +++++++++++++++--- 7 files changed, 281 insertions(+), 31 deletions(-) diff --git a/seaweed-block/core/authority/observation_host.go b/seaweed-block/core/authority/observation_host.go index c65e63a4b5..8748df39f0 100644 --- a/seaweed-block/core/authority/observation_host.go +++ b/seaweed-block/core/authority/observation_host.go @@ -153,6 +153,17 @@ func (h *ObservationHost) IngestHeartbeat(msg HeartbeatMessage) error { return h.Ingest(obs) } +// IngestHeartbeatWithHealthTransitions is IngestHeartbeat returning the +// accepted slot health transitions (ObservationStore +// .IngestWithHealthTransitions). +func (h *ObservationHost) IngestHeartbeatWithHealthTransitions(msg HeartbeatMessage) ([]SlotHealthTransition, error) { + obs, err := HeartbeatToObservation(msg) + if err != nil { + return nil, err + } + return h.store.IngestWithHealthTransitions(obs) +} + // LastBuild returns the most recent BuildResult produced by the // rebuild loop, if any. Safe for concurrent readers; returns a // value copy. diff --git a/seaweed-block/core/authority/observation_store.go b/seaweed-block/core/authority/observation_store.go index 67d995246d..96fb5320f4 100644 --- a/seaweed-block/core/authority/observation_store.go +++ b/seaweed-block/core/authority/observation_store.go @@ -220,11 +220,35 @@ var ErrInvalidObservation = errors.New("observation_store: invalid observation") // stale ingest). No error is returned for that case; it's a // routine ordering event, not a bug. func (s *ObservationStore) Ingest(obs Observation) error { + _, err := s.ingest(obs) + return err +} + +// SlotHealthTransition is a slot whose explicit unhealthy reason changed +// with an accepted observation: Old is the reason in the same server's +// previously stored fact for that slot (whether or not it had expired; +// "" when there was none), New the reason just stored. +type SlotHealthTransition struct { + VolumeID string + ReplicaID string + Old string + New string +} + +// IngestWithHealthTransitions ingests like Ingest and returns, derived +// from the accepted mutation itself under the store lock, every slot +// whose unhealthy reason changed. A refused (older) observation returns +// none, and expiry never produces one: only an accepted report does. +func (s *ObservationStore) IngestWithHealthTransitions(obs Observation) ([]SlotHealthTransition, error) { + return s.ingest(obs) +} + +func (s *ObservationStore) ingest(obs Observation) ([]SlotHealthTransition, error) { if obs.ServerID == "" { - return ErrInvalidObservation + return nil, ErrInvalidObservation } if obs.ObservedAt.IsZero() { - return ErrInvalidObservation + return nil, ErrInvalidObservation } // Always compute ExpiresAt from store config — do not trust @@ -237,8 +261,10 @@ func (s *ObservationStore) Ingest(obs Observation) error { } var fn func() + var transitions []SlotHealthTransition s.mu.Lock() - if prev, ok := s.observations[obs.ServerID]; ok { + prev, hadPrev := s.observations[obs.ServerID] + if hadPrev { if prev.ObservedAt.After(obs.ObservedAt) { // Out-of-order ingest: keep the newer one already // stored. No mutation fired. @@ -251,8 +277,28 @@ func (s *ObservationStore) Ingest(obs Observation) error { // distinct from "silently dropped". s.supersededCount++ s.mu.Unlock() - return nil + return nil, nil } + } + // Health transitions, from this accepted report against the same + // server's previously stored fact for each slot it carries. + for _, slot := range obs.Slots { + old := "" + if hadPrev { + for _, p := range prev.Slots { + if slotKey(p) == slotKey(slot) { + old = p.UnhealthyReason + break + } + } + } + if old != slot.UnhealthyReason { + transitions = append(transitions, SlotHealthTransition{ + VolumeID: slot.VolumeID, ReplicaID: slot.ReplicaID, Old: old, New: slot.UnhealthyReason, + }) + } + } + if hadPrev { obs.Slots = mergeServerSlots(prev.Slots, obs.Slots) } s.observations[obs.ServerID] = obs @@ -263,7 +309,7 @@ func (s *ObservationStore) Ingest(obs Observation) error { if fn != nil { fn() } - return nil + return transitions, nil } func mergeServerSlots(prev []SlotFact, next []SlotFact) []SlotFact { diff --git a/seaweed-block/core/host/master/host.go b/seaweed-block/core/host/master/host.go index 06a2cc816d..47e670b187 100644 --- a/seaweed-block/core/host/master/host.go +++ b/seaweed-block/core/host/master/host.go @@ -94,6 +94,7 @@ type LifecycleStores struct { // is: New -> Start -> (serve requests) -> Close. type Host struct { cfg Config + healthMu sync.Mutex // orders replica health events with their accepted heartbeats (#128 rule 6) log *log.Logger boot *bootstrap.DurableAuthorityBootstrap ctrl *authority.TopologyController diff --git a/seaweed-block/core/host/master/recovery_watchdog_master_test.go b/seaweed-block/core/host/master/recovery_watchdog_master_test.go index da6b623b28..f22265d797 100644 --- a/seaweed-block/core/host/master/recovery_watchdog_master_test.go +++ b/seaweed-block/core/host/master/recovery_watchdog_master_test.go @@ -2,6 +2,8 @@ package master import ( "context" + "sync" + "sync/atomic" "testing" "time" @@ -163,3 +165,94 @@ func TestRecoveryWatchdog_MasterLaterDegradationFollowsNormalRules(t *testing.T) t.Fatalf("unhealthy replicas=%v; want none (no explicit unhealthy fact)", got) } } + +func reportR1(t *testing.T, svc *services, slot wireSlot, sentAt time.Time) { + t.Helper() + _, err := svc.ReportHeartbeat(context.Background(), &control.HeartbeatReport{ + ServerId: "node-a", SentAt: timestamppb.New(sentAt), Reachable: true, Eligible: true, + Slots: []*control.HeartbeatSlot{{ + VolumeId: "vol-rf3", ReplicaId: "r1", DataAddr: "127.0.0.1:19101", CtrlAddr: "127.0.0.1:19102", + Reachable: true, ReadyForPrimary: slot.ready, Eligible: slot.unhealthy == "", + EvidenceScore: 30, Incarnation: slot.incarnation, UnhealthyReason: slot.unhealthy, + }}, + }) + if err != nil { + t.Errorf("ReportHeartbeat r1: %v", err) + } +} + +func r1HealthEvents(t *testing.T, svc *services) []string { + t.Helper() + var out []string + for _, e := range timelineEvents(t, svc) { + if e.GetReplicaId() == "r1" && (e.GetEventType() == "replica_unhealthy" || e.GetEventType() == "replica_unhealthy_cleared") { + out = append(out, e.GetEventType()) + } + } + return out +} + +// onFirstMutation runs fn once, right after the next accepted store +// mutation (inside that ingest, after the store lock is released). +func onFirstMutation(h *Host, fn func()) { + var once sync.Once + h.ObservationHost().Store().SetOnMutation(func() { once.Do(fn) }) +} + +// Review of #134 (P2 3): a second heartbeat lands between the first +// one's ingest and its event bookkeeping. Both transitions must be +// recorded, in accepted order: unhealthy, then cleared. +func TestRecoveryWatchdog_MasterConcurrentHeartbeatsKeepBothTransitions(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + + t0 := time.Now() + done := make(chan struct{}) + onFirstMutation(h, func() { + go func() { + reportR1(t, svc, wireSlot{"r1-b", true, ""}, t0.Add(time.Millisecond)) // healthy, newer + close(done) + }() + select { // let it run now if nothing blocks it + case <-done: + case <-time.After(300 * time.Millisecond): + } + }) + reportR1(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, t0) // unhealthy + <-done + got := r1HealthEvents(t, svc) + if len(got) != 2 || got[0] != "replica_unhealthy" || got[1] != "replica_unhealthy_cleared" { + t.Fatalf("r1 health events=%v; want [replica_unhealthy replica_unhealthy_cleared]", got) + } +} + +// Review of #134 (P2 3): the stored unhealthy fact expires during an +// ingest that reports unhealthy again. No clear may be fabricated. +func TestRecoveryWatchdog_MasterExpiryFabricatesNoClear(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + var offset atomic.Int64 + h.ObservationHost().SetNowForTest(func() time.Time { return time.Now().Add(time.Duration(offset.Load())) }) + + t0 := time.Now() + reportR1(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, t0) + onFirstMutation(h, func() { offset.Store(int64(time.Hour)) }) // everything expires mid-ingest + reportR1(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, t0.Add(time.Millisecond)) + for _, ev := range r1HealthEvents(t, svc) { + if ev == "replica_unhealthy_cleared" { + t.Fatalf("r1 health events=%v: a clear was fabricated by expiry", r1HealthEvents(t, svc)) + } + } +} + +// Control: an older heartbeat the store refuses records nothing. +func TestRecoveryWatchdog_MasterRejectedHeartbeatRecordsNothing(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + t0 := time.Now() + reportR1(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, t0) + reportR1(t, svc, wireSlot{"r1-b", true, ""}, t0.Add(-time.Second)) // older: refused + if got := r1HealthEvents(t, svc); len(got) != 1 || got[0] != "replica_unhealthy" { + t.Fatalf("r1 health events=%v; want only [replica_unhealthy]", got) + } +} diff --git a/seaweed-block/core/host/volume/host.go b/seaweed-block/core/host/volume/host.go index 27bdaa3f13..b4fe87ade3 100644 --- a/seaweed-block/core/host/volume/host.go +++ b/seaweed-block/core/host/volume/host.go @@ -12,6 +12,7 @@ import ( "time" "github.com/seaweedfs/seaweed-block/core/adapter" + "github.com/seaweedfs/seaweed-block/core/engine" "github.com/seaweedfs/seaweed-block/core/replication" control "github.com/seaweedfs/seaweed-block/core/rpc/control" "google.golang.org/grpc" @@ -584,8 +585,8 @@ func (h *Host) runHeartbeat(ctx context.Context) { // buildReport collects local slot facts into a wire HeartbeatReport. // T0 single-volume-per-process simplicity: one replica slot. func (h *Host) buildReport() *control.HeartbeatReport { - ready := h.readyForPrimaryFact() - unhealthy := h.unhealthyReason(ready) + fact, ready := h.promotionReady() + unhealthy := h.unhealthyReason(fact, ready) return &control.HeartbeatReport{ ServerId: h.cfg.ServerID, SentAt: timestamppb.Now(), @@ -625,14 +626,21 @@ func newIncarnation() string { // a valid candidate fact even though it remains frontend-unhealthy until // authority moves. func (h *Host) readyForPrimaryFact() bool { + _, ready := h.promotionReady() + return ready +} + +// promotionReady returns the engine's promotion fact and whether it +// counts as ready (ready, and its line not superseded). +func (h *Host) promotionReady() (engine.PromotionReadyFact, bool) { if h == nil || h.view == nil { - return false + return engine.PromotionReadyFact{}, false } fact := h.view.PromotionReadyFact() if !fact.Ready { - return false + return fact, false } - return !h.view.isSupersededLine(fact.Epoch, fact.EndpointVersion) + return fact, !h.view.isSupersededLine(fact.Epoch, fact.EndpointVersion) } // runSubscribe maintains a SubscribeAssignments stream. Reconnects diff --git a/seaweed-block/core/host/volume/recovery_watchdog.go b/seaweed-block/core/host/volume/recovery_watchdog.go index 88118d2511..a19b7e2a80 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog.go +++ b/seaweed-block/core/host/volume/recovery_watchdog.go @@ -3,6 +3,8 @@ package volume import ( "sync" "time" + + "github.com/seaweedfs/seaweed-block/core/engine" ) // Recovery watchdog (#128 rule 6). @@ -29,7 +31,11 @@ import ( // later degrades is not a boot-recovery stall: it goes through the // normal controller/gate failover. // - role_admission_failed reports the G1 role-admission latch of a -// primary-assigned replica, for as long as the latch holds. +// primary-assigned replica, for as long as the latch holds, whatever +// an older engine-ready fact says. +// - Only a ready fact for the watched primary epoch clears or disarms: +// an engine still ready at an older epoch (its new assignment not +// admitted) does not. // // wal_corrupt and io_error need typed failures out of the durable // recovery path; they are a tracked follow-up. @@ -104,9 +110,12 @@ func (w *recoveryWatchdog) supportingAdmitted(epoch uint64) { } // reason returns the slot's explicit unhealthy reason given whether it -// is promotion-ready now and whether the G1 latch holds. fired is true -// on the call that latched recovery_timeout. -func (w *recoveryWatchdog) reason(ready, roleAdmissionFailed bool) (reason string, fired bool) { +// is promotion-ready now, at which epoch that readiness is, and whether +// the G1 latch holds. Readiness counts only for the watched primary +// epoch, compared under the lock, so an assignment that advanced while +// the fact was read is not cleared by it. fired is true on the call that +// latched recovery_timeout. +func (w *recoveryWatchdog) reason(ready bool, readyEpoch uint64, roleAdmissionFailed bool) (reason string, fired bool) { if w == nil { return "", false } @@ -115,7 +124,7 @@ func (w *recoveryWatchdog) reason(ready, roleAdmissionFailed bool) (reason strin if w.primarySince.IsZero() { return "", false } - if ready { + if ready { // RED: old order, epoch ignored w.timedOut, w.readySeen = false, true return "", false } @@ -148,15 +157,18 @@ func (w *recoveryWatchdog) catchUpSince() time.Time { // UnhealthyReason is the slot's explicit unhealthy reason now (#128 // rule 6), the same value its heartbeat reports; empty when healthy. func (h *Host) UnhealthyReason() string { - return h.unhealthyReason(h.readyForPrimaryFact()) + fact, ready := h.promotionReady() + return h.unhealthyReason(fact, ready) } -func (h *Host) unhealthyReason(ready bool) string { +// unhealthyReason evaluates the watchdog with the promotion fact (its +// epoch binds readiness to the watched assignment) and the G1 latch. +func (h *Host) unhealthyReason(fact engine.PromotionReadyFact, ready bool) string { if h == nil || h.wd == nil { return "" } failed, _ := h.RoleAdmissionFailure() - reason, fired := h.wd.reason(ready, failed) + reason, fired := h.wd.reason(ready, fact.Epoch, failed) if fired { h.log.Printf("blockvolume: volume %s primary assignment epoch=%d not promotion-ready after %s: reporting unhealthy (%s)", h.cfg.VolumeID, h.wd.epoch(), h.wd.timeout, UnhealthyRecoveryTimeout) diff --git a/seaweed-block/core/host/volume/recovery_watchdog_test.go b/seaweed-block/core/host/volume/recovery_watchdog_test.go index a86f8ae553..02a580b2c8 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog_test.go +++ b/seaweed-block/core/host/volume/recovery_watchdog_test.go @@ -1,9 +1,11 @@ package volume import ( + "errors" "testing" "time" + "github.com/seaweedfs/seaweed-block/core/engine" control "github.com/seaweedfs/seaweed-block/core/rpc/control" ) @@ -84,26 +86,26 @@ func TestRecoveryWatchdog_ReadyClearsAndDisarmsNewEpochRearms(t *testing.T) { w.primaryAssigned(1) clk.advance(11 * time.Second) - if r, fired := w.reason(false, false); r != UnhealthyRecoveryTimeout || !fired { + if r, fired := w.reason(false, 0, false); r != UnhealthyRecoveryTimeout || !fired { t.Fatalf("past timeout: %q fired=%t", r, fired) } - if r, fired := w.reason(false, false); r != UnhealthyRecoveryTimeout || fired { + if r, fired := w.reason(false, 0, false); r != UnhealthyRecoveryTimeout || fired { t.Fatalf("latched: %q fired=%t; want the reason, fired only once", r, fired) } - if r, _ := w.reason(true, false); r != "" { + if r, _ := w.reason(true, 1, false); r != "" { t.Fatalf("ready: %q; want cleared", r) } - if r, _ := w.reason(false, false); r != "" { + if r, _ := w.reason(false, 0, false); r != "" { t.Fatalf("unready again in the same assignment: %q; want disarmed", r) } w.primaryAssigned(2) // new primary epoch: fresh clock clk.advance(9 * time.Second) - if r, _ := w.reason(false, false); r != "" { + if r, _ := w.reason(false, 0, false); r != "" { t.Fatalf("new epoch inside timeout: %q", r) } clk.advance(2 * time.Second) - if r, _ := w.reason(false, false); r != UnhealthyRecoveryTimeout { + if r, _ := w.reason(false, 0, false); r != UnhealthyRecoveryTimeout { t.Fatalf("new epoch past timeout: %q", r) } } @@ -112,11 +114,11 @@ func TestRecoveryWatchdog_ReadyClearsAndDisarmsNewEpochRearms(t *testing.T) { // at once; it never applies to a replica without the primary assignment. func TestRecoveryWatchdog_RoleAdmissionFailure(t *testing.T) { w := newRecoveryWatchdog(time.Hour) - if r, _ := w.reason(false, true); r != "" { + if r, _ := w.reason(false, 0, true); r != "" { t.Fatalf("not primary-assigned: %q", r) } w.primaryAssigned(1) - if r, _ := w.reason(false, true); r != UnhealthyRoleAdmission { + if r, _ := w.reason(false, 0, true); r != UnhealthyRoleAdmission { t.Fatalf("primary-assigned with the G1 latch: %q; want %s", r, UnhealthyRoleAdmission) } } @@ -148,16 +150,16 @@ func TestRecoveryWatchdog_ReadyThenLaterNotReadyReportsNoTimeout(t *testing.T) { h, clk := watchdogHost(t, 10*time.Second) h.applyFact(selfPrimaryFact(1)) clk.advance(time.Second) - if r := h.unhealthyReason(true); r != "" { + if r := h.unhealthyReason(readyAt(1), true); r != "" { t.Fatalf("ready: %q", r) } clk.advance(time.Hour) - if r := h.unhealthyReason(false); r != "" { + if r := h.unhealthyReason(readyAt(1), false); r != "" { t.Fatalf("not ready an hour after being ready, same incarnation: %q; want no recovery_timeout", r) } h.applyFact(selfPrimaryFact(1)) // the same assignment replayed: still disarmed clk.advance(time.Hour) - if r := h.unhealthyReason(false); r != "" { + if r := h.unhealthyReason(readyAt(1), false); r != "" { t.Fatalf("same assignment replayed: %q; want still disarmed", r) } } @@ -168,7 +170,7 @@ func TestRecoveryWatchdog_ReadyThenLaterNotReadyReportsNoTimeout(t *testing.T) { func TestRecoveryWatchdog_NewIncarnationRearms(t *testing.T) { old, clk := watchdogHost(t, 10*time.Second) old.applyFact(selfPrimaryFact(1)) - if r := old.unhealthyReason(true); r != "" { + if r := old.unhealthyReason(readyAt(1), true); r != "" { t.Fatalf("old process ready: %q", r) } @@ -182,7 +184,84 @@ func TestRecoveryWatchdog_NewIncarnationRearms(t *testing.T) { t.Fatalf("restarted process past timeout: eligible=%t reason=%q; want ineligible, %s", s.Eligible, s.UnhealthyReason, UnhealthyRecoveryTimeout) } clk.advance(time.Hour) - if r := old.unhealthyReason(false); r != "" { + if r := old.unhealthyReason(readyAt(1), false); r != "" { t.Fatalf("old process stays disarmed: %q", r) } } + +func readyAt(epoch uint64) engine.PromotionReadyFact { + return engine.PromotionReadyFact{Ready: true, Epoch: epoch, EndpointVersion: 1} +} + +// readyView makes the host's promotion fact controllable through *ready. +func readyView(h *Host, volumeID, replicaID string, ready *engine.PromotionReadyFact) { + h.view = NewAdapterProjectionView(stubProjector{ + p: engine.ReplicaProjection{Mode: engine.ModeHealthy, Epoch: ready.Epoch, EndpointVersion: 1}, + ready: ready, + }, volumeID, replicaID, h) +} + +// Review of #134 (P2 1), real host: ready at epoch 2, then the epoch-3 +// primary assignment is refused at admission (peer-set install fails), +// so the engine is still ready at epoch 2 only. That must not disarm the +// epoch-3 watchdog: it times out; a genuine epoch-3 ready fact clears it. +func TestRecoveryWatchdog_OldEpochReadyDoesNotDisarmNewAssignment(t *testing.T) { + h, a, repl := newStubbedHost(t, "vol1", "rB", &orderingRecorder{}) + clk := &fakeClock{t: time.Unix(1000, 0)} + h.wd = newRecoveryWatchdog(10 * time.Second) + h.wd.now = clk.now + ready := &engine.PromotionReadyFact{Ready: true, Epoch: 2, EndpointVersion: 1, ReplicaID: "rB"} + readyView(h, "vol1", "rB", ready) + + h.applyFact(selfFact(2)) + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" { + t.Fatalf("ready primary at epoch 2: %+v", s) + } + + repl.returnErr = errors.New("injected: peer set install failed") + h.applyFact(selfFact(3)) // refused: the adapter stays at epoch 2 + if a.callCount.Load() != 1 { + t.Fatal("fixture: the epoch-3 assignment was adopted") + } + clk.advance(11 * time.Second) + if s := reportSlot(t, h); s.Eligible || s.UnhealthyReason != UnhealthyRecoveryTimeout { + t.Fatalf("epoch 3 never admitted, engine ready only at epoch 2: eligible=%t reason=%q; want %s", s.Eligible, s.UnhealthyReason, UnhealthyRecoveryTimeout) + } + + *ready = engine.PromotionReadyFact{Ready: true, Epoch: 3, EndpointVersion: 1, ReplicaID: "rB"} + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" { + t.Fatalf("genuine epoch-3 ready fact: eligible=%t reason=%q; want cleared", s.Eligible, s.UnhealthyReason) + } +} + +// Review of #134 (P2 2), real host: a previously ready primary whose +// epoch-3 role call fails (G1 latch) reports role_admission_failed even +// though its engine is still ready at epoch 2; redelivery with a working +// role call clears the latch. +func TestRecoveryWatchdog_G1LatchWinsOverOldReady(t *testing.T) { + h, _, _ := newStubbedHost(t, "vol1", "rB", &orderingRecorder{}) + h.wd = newRecoveryWatchdog(time.Hour) + ready := &engine.PromotionReadyFact{Ready: true, Epoch: 2, EndpointVersion: 1, ReplicaID: "rB"} + readyView(h, "vol1", "rB", ready) + fencer := &switchFencer{} + if err := h.SetSelfFence(fencer); err != nil { + t.Fatal(err) + } + h.applyFact(selfFact(2)) + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" { + t.Fatalf("ready primary at epoch 2: %+v", s) + } + + fencer.fail.Store(true) + h.applyFact(selfFact(3)) // role call fails: G1 latch + if s := reportSlot(t, h); s.Eligible || s.UnhealthyReason != UnhealthyRoleAdmission { + t.Fatalf("G1 latch with an old ready fact: eligible=%t reason=%q; want %s", s.Eligible, s.UnhealthyReason, UnhealthyRoleAdmission) + } + + fencer.fail.Store(false) + h.applyFact(selfFact(3)) // redelivery succeeds + *ready = engine.PromotionReadyFact{Ready: true, Epoch: 3, EndpointVersion: 1, ReplicaID: "rB"} + if s := reportSlot(t, h); !s.Eligible || s.UnhealthyReason != "" { + t.Fatalf("after successful redelivery and an epoch-3 ready fact: eligible=%t reason=%q; want cleared", s.Eligible, s.UnhealthyReason) + } +} From 774dee54034305260c1faecc0968c3914f0ef99f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:39:10 -0800 Subject: [PATCH 5/7] volume, master: bind watchdog readiness to the watched epoch, G1 first; derive health events from the accepted ingest codex01's AMEND on #134 (three P2s; the disarm policy is unchanged): 1. Only a ready fact for the watched primary epoch clears or disarms the watchdog. The full promotion fact is passed and its epoch is compared with the watched epoch under the watchdog lock, so an engine still ready at an older epoch (its new assignment refused at admission) cannot disarm the new assignment, and an assignment that advances while the fact is read is not cleared by it. 2. The G1 role-admission latch of a primary-assigned replica is checked before readiness: it reports role_admission_failed for as long as it holds, whatever an older engine-ready fact says. 3. Health events come from the accepted store mutation itself: ObservationStore.IngestWithHealthTransitions returns, under the store lock, each slot whose unhealthy reason the accepted report changed against the same server's previously stored fact. A refused report yields none and expiry never fabricates a clear. The master ingests and records those events under healthMu, so events follow accepted order across concurrent heartbeats. Lock order: healthMu -> store.mu (released inside ingest) -> event ring; nothing else takes healthMu, and neither the store nor the ring calls back into the host. The watchdog keeps its own mutex and calls nothing while holding it. Refs #128 Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/host/master/services.go | 57 +++++++------------ .../core/host/volume/recovery_watchdog.go | 8 +-- 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/seaweed-block/core/host/master/services.go b/seaweed-block/core/host/master/services.go index 800b71377a..756ede4815 100644 --- a/seaweed-block/core/host/master/services.go +++ b/seaweed-block/core/host/master/services.go @@ -131,11 +131,9 @@ func (s *services) ReportHeartbeat(ctx context.Context, r *control.HeartbeatRepo return nil, err } msg := heartbeatFromWire(r) - before := s.host.slotUnhealthyReasons(msg) - if err := s.host.obs.IngestHeartbeat(msg); err != nil { + if err := s.host.ingestHeartbeatRecordingHealth(msg); err != nil { return nil, fmt.Errorf("ingest: %w", err) } - s.host.recordUnhealthyTransitions(msg, before) return &control.HeartbeatAck{ AcceptedAt: timestamppb.Now(), Sequence: s.seq.Add(1), @@ -733,47 +731,34 @@ func statusUnhealthyReplicas(obs *authority.ObservationHost, volumeID string, re return out } -// slotUnhealthyReasons returns the stored unhealthy reason of every slot -// the heartbeat reports, before it is ingested. -func (h *Host) slotUnhealthyReasons(msg authority.HeartbeatMessage) map[string]string { - if h.obs == nil { - return nil +// ingestHeartbeatRecordingHealth ingests a heartbeat and records a +// replica_unhealthy / replica_unhealthy_cleared event for every slot +// whose unhealthy reason the accepted report changed (#128 rule 6). The +// transitions come from the accepted store mutation itself, so a refused +// report records nothing and expiry never fabricates a clear. healthMu +// keeps the events in accepted order across concurrent heartbeats. +func (h *Host) ingestHeartbeatRecordingHealth(msg authority.HeartbeatMessage) error { + h.healthMu.Lock() + defer h.healthMu.Unlock() + transitions, err := h.obs.IngestHeartbeatWithHealthTransitions(msg) + if err != nil { + return err } - out := make(map[string]string, len(msg.Slots)) - for _, s := range msg.Slots { - prev, _ := h.obs.Store().SlotFact(s.VolumeID, s.ReplicaID) - out[s.VolumeID+"/"+s.ReplicaID] = prev.UnhealthyReason - } - return out -} - -// recordUnhealthyTransitions records an event when a slot's stored -// unhealthy reason changed with this heartbeat: set, changed, or cleared -// (#128 rule 6). It compares stored facts, so an ingest the store -// refused records nothing. -func (h *Host) recordUnhealthyTransitions(msg authority.HeartbeatMessage, before map[string]string) { - if h.obs == nil { - return - } - for _, s := range msg.Slots { - cur, _ := h.obs.Store().SlotFact(s.VolumeID, s.ReplicaID) - prev := before[s.VolumeID+"/"+s.ReplicaID] - if cur.UnhealthyReason == prev { - continue - } - if cur.UnhealthyReason == "" { + for _, tr := range transitions { + if tr.New == "" { h.events.append(ops.ClusterEvent{ - VolumeID: s.VolumeID, ReplicaID: s.ReplicaID, + VolumeID: tr.VolumeID, ReplicaID: tr.ReplicaID, Type: "replica_unhealthy_cleared", Severity: "info", - Message: "replica reported healthy again", OldValue: prev, + Message: "replica reported healthy again", OldValue: tr.Old, }) continue } h.events.append(ops.ClusterEvent{ - VolumeID: s.VolumeID, ReplicaID: s.ReplicaID, + VolumeID: tr.VolumeID, ReplicaID: tr.ReplicaID, Type: "replica_unhealthy", Severity: "warning", - Message: "replica reported an explicit unhealthy fact: " + cur.UnhealthyReason, - Reason: cur.UnhealthyReason, OldValue: prev, NewValue: cur.UnhealthyReason, + Message: "replica reported an explicit unhealthy fact: " + tr.New, + Reason: tr.New, OldValue: tr.Old, NewValue: tr.New, }) } + return nil } diff --git a/seaweed-block/core/host/volume/recovery_watchdog.go b/seaweed-block/core/host/volume/recovery_watchdog.go index a19b7e2a80..5696be885f 100644 --- a/seaweed-block/core/host/volume/recovery_watchdog.go +++ b/seaweed-block/core/host/volume/recovery_watchdog.go @@ -124,13 +124,13 @@ func (w *recoveryWatchdog) reason(ready bool, readyEpoch uint64, roleAdmissionFa if w.primarySince.IsZero() { return "", false } - if ready { // RED: old order, epoch ignored - w.timedOut, w.readySeen = false, true - return "", false - } if roleAdmissionFailed { return UnhealthyRoleAdmission, false } + if ready && readyEpoch == w.primaryEpoch { + w.timedOut, w.readySeen = false, true + return "", false + } if w.readySeen { return "", false } From d44bae2eea660e24313482b026f690961ae6eac1 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:46:33 -0800 Subject: [PATCH 6/7] authority, master: duplicate slot keys in one report must be refused (RED) Review of #134 r2: store controls (conflicting and identical duplicate volume/replica keys refused with no transition and no mutation; distinct slots still yield one transition each) and an RPC control (a duplicate-slot heartbeat is refused; status and timeline unchanged). Refs #128 Co-Authored-By: Claude Opus 5.5 --- .../observation_store_duplicate_slot_test.go | 73 +++++++++++++++++++ .../master/recovery_watchdog_master_test.go | 35 +++++++++ 2 files changed, 108 insertions(+) create mode 100644 seaweed-block/core/authority/observation_store_duplicate_slot_test.go diff --git a/seaweed-block/core/authority/observation_store_duplicate_slot_test.go b/seaweed-block/core/authority/observation_store_duplicate_slot_test.go new file mode 100644 index 0000000000..5fb4578206 --- /dev/null +++ b/seaweed-block/core/authority/observation_store_duplicate_slot_test.go @@ -0,0 +1,73 @@ +package authority + +import ( + "errors" + "testing" + "time" +) + +// Review of #134 r2: an observation carrying the same volume/replica +// slot twice is refused before any mutation, so a duplicate can never +// fabricate a health transition that does not describe the stored slot. + +func dupStore(t *testing.T) (*ObservationStore, time.Time) { + t.Helper() + base := time.Unix(1000, 0) + return NewObservationStore(FreshnessConfig{FreshnessWindow: time.Hour}, func() time.Time { return base.Add(time.Minute) }), base +} + +func slotWith(reason string) SlotFact { + return SlotFact{VolumeID: "v1", ReplicaID: "r1", DataAddr: "d", CtrlAddr: "c", Reachable: true, Eligible: reason == "", UnhealthyReason: reason} +} + +func TestObservationStore_DuplicateSlotKeysRefused(t *testing.T) { + for _, tc := range []struct { + name string + slots []SlotFact + }{ + {"conflicting", []SlotFact{slotWith(""), slotWith("recovery_timeout")}}, + {"identical", []SlotFact{slotWith("recovery_timeout"), slotWith("recovery_timeout")}}, + } { + t.Run(tc.name, func(t *testing.T) { + s, base := dupStore(t) + if _, err := s.IngestWithHealthTransitions(Observation{ServerID: "s1", ObservedAt: base, Slots: []SlotFact{slotWith("recovery_timeout")}}); err != nil { + t.Fatal(err) + } + rev := s.Snapshot().revision + tr, err := s.IngestWithHealthTransitions(Observation{ServerID: "s1", ObservedAt: base.Add(time.Second), Slots: tc.slots}) + if !errors.Is(err, ErrInvalidObservation) { + t.Fatalf("duplicate slot keys: err=%v; want ErrInvalidObservation", err) + } + if len(tr) != 0 { + t.Fatalf("refused observation produced transitions %+v", tr) + } + if got := s.Snapshot().revision; got != rev { + t.Fatalf("refused observation mutated the store: revision %d -> %d", rev, got) + } + if f, ok := s.SlotFact("v1", "r1"); !ok || f.UnhealthyReason != "recovery_timeout" { + t.Fatalf("stored slot after refusal: %+v %t; want the earlier recovery_timeout fact", f, ok) + } + }) + } +} + +// Positive: distinct slots in one observation are accepted, and each +// changed slot yields its own transition. +func TestObservationStore_UniqueMultiSlotTransitions(t *testing.T) { + s, base := dupStore(t) + a := SlotFact{VolumeID: "v1", ReplicaID: "r1", DataAddr: "d", CtrlAddr: "c", Reachable: true, Eligible: true} + b := SlotFact{VolumeID: "v2", ReplicaID: "r1", DataAddr: "d2", CtrlAddr: "c2", Reachable: true, Eligible: true} + if _, err := s.IngestWithHealthTransitions(Observation{ServerID: "s1", ObservedAt: base, Slots: []SlotFact{a, b}}); err != nil { + t.Fatal(err) + } + a2, b2 := a, b + a2.Eligible, a2.UnhealthyReason = false, "recovery_timeout" + b2.Eligible, b2.UnhealthyReason = false, "role_admission_failed" + tr, err := s.IngestWithHealthTransitions(Observation{ServerID: "s1", ObservedAt: base.Add(time.Second), Slots: []SlotFact{a2, b2}}) + if err != nil { + t.Fatal(err) + } + if len(tr) != 2 || tr[0].VolumeID != "v1" || tr[0].New != "recovery_timeout" || tr[1].VolumeID != "v2" || tr[1].New != "role_admission_failed" { + t.Fatalf("transitions %+v; want v1 -> recovery_timeout and v2 -> role_admission_failed", tr) + } +} diff --git a/seaweed-block/core/host/master/recovery_watchdog_master_test.go b/seaweed-block/core/host/master/recovery_watchdog_master_test.go index f22265d797..0d80867171 100644 --- a/seaweed-block/core/host/master/recovery_watchdog_master_test.go +++ b/seaweed-block/core/host/master/recovery_watchdog_master_test.go @@ -256,3 +256,38 @@ func TestRecoveryWatchdog_MasterRejectedHeartbeatRecordsNothing(t *testing.T) { t.Fatalf("r1 health events=%v; want only [replica_unhealthy]", got) } } + +// Review of #134 r2: a heartbeat carrying the same slot twice is +// refused at the RPC; volume status and the timeline stay unchanged. +func TestRecoveryWatchdog_MasterDuplicateSlotHeartbeatRefused(t *testing.T) { + h, svc := watchdogMaster(t) + defer closeTestMaster(t, h) + t0 := time.Now() + reportR1(t, svc, wireSlot{"r1-b", false, "recovery_timeout"}, t0) + before := r1HealthEvents(t, svc) + + slot := func(reason string) *control.HeartbeatSlot { + return &control.HeartbeatSlot{ + VolumeId: "vol-rf3", ReplicaId: "r1", DataAddr: "127.0.0.1:19101", CtrlAddr: "127.0.0.1:19102", + Reachable: true, Eligible: reason == "", Incarnation: "r1-b", UnhealthyReason: reason, + } + } + for i, slots := range [][]*control.HeartbeatSlot{ + {slot(""), slot("recovery_timeout")}, // conflicting + {slot("recovery_timeout"), slot("recovery_timeout")}, // identical + } { + _, err := svc.ReportHeartbeat(context.Background(), &control.HeartbeatReport{ + ServerId: "node-a", SentAt: timestamppb.New(t0.Add(time.Duration(i+1) * time.Millisecond)), + Reachable: true, Eligible: true, Slots: slots, + }) + if err == nil { + t.Fatalf("duplicate-slot heartbeat %d accepted", i) + } + } + if got := r1HealthEvents(t, svc); len(got) != len(before) { + t.Fatalf("health events changed by refused heartbeats: %v -> %v", before, got) + } + if got := unhealthyReplicas(t, svc); got["r1"] != "recovery_timeout" { + t.Fatalf("volume status after refusal: %v; want r1=recovery_timeout", got) + } +} From e3a0495003907d2f6d323c077480bca3040034f5 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 13:51:25 -0800 Subject: [PATCH 7/7] authority, master: refuse a report that names the same slot twice Review of #134 r2 (one P2): duplicate volume/replica keys in one report were accepted. The health transition compared against the first prior match while every entry was stored, so repeating [healthy, unhealthy] for one key invented a replica_unhealthy event that did not describe the stored slot. The observation store now refuses an observation with a repeated slot key (ErrInvalidObservation) before any mutation, so no transition and no store change result; validateHeartbeat refuses it at the RPC with the offending indices. Distinct slots are unchanged. TestStatusFrontendsForAssignedVolume_DedupesRepeatedFacts ingested its fact through a heartbeat that repeated the slot; what it pins is the status dedupe over repeated replica IDs, so it now ingests the fact once. No production heartbeat repeats a slot (one slot per blockvolume process). Refs #128 Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/authority/observation_store.go | 11 +++++++++++ .../core/host/master/frontend_status_test.go | 4 +++- seaweed-block/core/host/master/services.go | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/seaweed-block/core/authority/observation_store.go b/seaweed-block/core/authority/observation_store.go index 96fb5320f4..5ac6c1c3ab 100644 --- a/seaweed-block/core/authority/observation_store.go +++ b/seaweed-block/core/authority/observation_store.go @@ -250,6 +250,17 @@ func (s *ObservationStore) ingest(obs Observation) ([]SlotHealthTransition, erro if obs.ObservedAt.IsZero() { return nil, ErrInvalidObservation } + // One fact per volume/replica slot: a report that names a slot twice + // is refused before any mutation, so storage and health transitions + // can never disagree about which entry is the slot (#134). + seen := make(map[string]struct{}, len(obs.Slots)) + for _, slot := range obs.Slots { + k := slotKey(slot) + if _, dup := seen[k]; dup { + return nil, ErrInvalidObservation + } + seen[k] = struct{}{} + } // Always compute ExpiresAt from store config — do not trust // caller-supplied ExpiresAt to prevent out-of-band freshness diff --git a/seaweed-block/core/host/master/frontend_status_test.go b/seaweed-block/core/host/master/frontend_status_test.go index 150cac2725..c426a30619 100644 --- a/seaweed-block/core/host/master/frontend_status_test.go +++ b/seaweed-block/core/host/master/frontend_status_test.go @@ -66,8 +66,10 @@ func TestStatusFrontendsForAssignedVolume_ReturnsObservedFrontendFactsForAllSlot func TestStatusFrontendsForAssignedVolume_DedupesRepeatedFacts(t *testing.T) { obs := authority.NewObservationHost(authority.ObservationHostConfig{}) + // The repeated replica IDs below are what this pins. A heartbeat + // naming the same slot twice is refused at ingest (#134), so the + // fact is ingested once. hb := frontendHeartbeat("node-a", "v1", "r1", "127.0.0.1:3260") - hb.Slots = append(hb.Slots, hb.Slots[0]) if err := obs.IngestHeartbeat(hb); err != nil { t.Fatalf("ingest heartbeat: %v", err) } diff --git a/seaweed-block/core/host/master/services.go b/seaweed-block/core/host/master/services.go index 756ede4815..eea17026d8 100644 --- a/seaweed-block/core/host/master/services.go +++ b/seaweed-block/core/host/master/services.go @@ -455,6 +455,7 @@ func validateHeartbeat(r *control.HeartbeatReport) error { if r.SentAt == nil || !r.SentAt.IsValid() { return errors.New("heartbeat: invalid SentAt") } + seen := make(map[string]int, len(r.Slots)) for i, s := range r.Slots { if s == nil { return fmt.Errorf("heartbeat: slot[%d] is nil", i) @@ -462,6 +463,11 @@ func validateHeartbeat(r *control.HeartbeatReport) error { if s.VolumeId == "" || s.ReplicaId == "" { return fmt.Errorf("heartbeat: slot[%d] missing VolumeID or ReplicaID", i) } + key := s.VolumeId + "/" + s.ReplicaId + if j, dup := seen[key]; dup { + return fmt.Errorf("heartbeat: slot[%d] repeats slot[%d] (%s)", i, j, key) + } + seen[key] = i if s.DataAddr == "" || s.CtrlAddr == "" { return fmt.Errorf("heartbeat: slot[%d] (%s/%s) missing DataAddr or CtrlAddr", i, s.VolumeId, s.ReplicaId) }