From 6fe5a9b17dc22f6ea20f06cd2ccca7f2ee3683f6 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Fri, 20 Nov 2026 23:25:11 -0800 Subject: [PATCH] status schema: replication peer, engine projection and chunk usage field comments Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/engine/projection.go | 20 ++--- .../core/frontend/chunkstore/retention.go | 10 +-- .../core/frontend/chunkstore/usage.go | 36 ++++---- seaweed-block/core/replication/peer.go | 18 ++-- seaweed-block/docs/status-schema.md | 82 +++++++++---------- 5 files changed, 83 insertions(+), 83 deletions(-) diff --git a/seaweed-block/core/engine/projection.go b/seaweed-block/core/engine/projection.go index b2df857375..01e1f41418 100644 --- a/seaweed-block/core/engine/projection.go +++ b/seaweed-block/core/engine/projection.go @@ -13,16 +13,16 @@ const ( // ReplicaProjection is the operator-facing view derived from state. // Intentionally descriptive. Must NEVER be reused as control truth. type ReplicaProjection struct { - Mode Mode - RecoveryDecision RecoveryDecision - SessionKind SessionKind - SessionPhase SessionPhase - Epoch uint64 - EndpointVersion uint64 - R uint64 - S uint64 - H uint64 - Reason string + Mode Mode // the engine mode (idle, recovering, healthy, degraded) + RecoveryDecision RecoveryDecision // the recovery class the R/S/H boundaries call for + SessionKind SessionKind // the kind of the current recovery session, if any + SessionPhase SessionPhase // its phase + Epoch uint64 // the authority epoch + EndpointVersion uint64 // the endpoint version within the epoch + R uint64 // the replica's durable boundary (LSN) + S uint64 // the primary's recoverable start boundary (WAL tail LSN) + H uint64 // the primary's target boundary (head LSN) + Reason string // why the engine is in this mode or decision } // DeriveProjection computes the projection from current state. diff --git a/seaweed-block/core/frontend/chunkstore/retention.go b/seaweed-block/core/frontend/chunkstore/retention.go index a714cb82bc..acc738b23e 100644 --- a/seaweed-block/core/frontend/chunkstore/retention.go +++ b/seaweed-block/core/frontend/chunkstore/retention.go @@ -116,11 +116,11 @@ func (s SnapshotInfo) Pinned() bool { // RetentionPolicy is a volume's snapshot retention policy. type RetentionPolicy struct { - KeepNewest int `json:"keepNewest"` - KeepYoungerNs int64 `json:"keepYoungerNs"` - KeepHourly int `json:"keepHourly"` - KeepDaily int `json:"keepDaily"` - KeepWeekly int `json:"keepWeekly"` + KeepNewest int `json:"keepNewest"` // keep the newest N unpinned snapshots + KeepYoungerNs int64 `json:"keepYoungerNs"` // keep every snapshot younger than this (ns) + KeepHourly int `json:"keepHourly"` // keep the newest snapshot of each of the last N hours + KeepDaily int `json:"keepDaily"` // keep the newest snapshot of each of the last N days + KeepWeekly int `json:"keepWeekly"` // keep the newest snapshot of each of the last N weeks } // DefaultRetentionPolicy is the policy of a volume that never set one. diff --git a/seaweed-block/core/frontend/chunkstore/usage.go b/seaweed-block/core/frontend/chunkstore/usage.go index d8ec500960..472c1ed877 100644 --- a/seaweed-block/core/frontend/chunkstore/usage.go +++ b/seaweed-block/core/frontend/chunkstore/usage.go @@ -38,28 +38,28 @@ import ( // SnapshotUsage is one snapshot's share of a volume's space. type SnapshotUsage struct { - Name string `json:"name"` - CreatedNs int64 `json:"createdNs"` - Class string `json:"class"` - Pinned bool `json:"pinned"` - Chunks int `json:"chunks"` - ExclusiveBytes uint64 `json:"exclusiveBytes"` + Name string `json:"name"` // the snapshot name + CreatedNs int64 `json:"createdNs"` // when it was created (Unix ns) + Class string `json:"class"` // its retention class + Pinned bool `json:"pinned"` // retention never deletes it + Chunks int `json:"chunks"` // chunks its manifest references + ExclusiveBytes uint64 `json:"exclusiveBytes"` // bytes no other holder references: what deleting it makes eligible for GC } // VolumeUsage is a volume's space accounting. type VolumeUsage struct { - VolumeID string `json:"volumeID"` - ChunkBytes uint64 `json:"chunkBytes"` // one full chunk - LiveChunks int `json:"liveChunks"` - LiveBytes uint64 `json:"liveBytes"` - Snapshots []SnapshotUsage `json:"snapshots"` - ManifestBindings int `json:"manifestBindings"` - ManifestBytes uint64 `json:"manifestBytes"` - StoredBindings int `json:"storedBindings"` - StoredBytes uint64 `json:"storedBytes"` - StoredUpperBound bool `json:"storedUpperBound"` - Policy RetentionPolicy `json:"policy"` - PolicySet bool `json:"policySet"` + VolumeID string `json:"volumeID"` // the volume + ChunkBytes uint64 `json:"chunkBytes"` // one full chunk + LiveChunks int `json:"liveChunks"` // chunks HEAD references + LiveBytes uint64 `json:"liveBytes"` // their bytes (the last chunk clipped) + Snapshots []SnapshotUsage `json:"snapshots"` // one entry per live snapshot + ManifestBindings int `json:"manifestBindings"` // stored chunk-key bindings some manifest references + ManifestBytes uint64 `json:"manifestBytes"` // their exact bytes + StoredBindings int `json:"storedBindings"` // all chunk-key bindings in the filer, referenced or not + StoredBytes uint64 `json:"storedBytes"` // their bytes; unreferenced ones counted at full chunk size + StoredUpperBound bool `json:"storedUpperBound"` // StoredBytes is an upper bound (some bindings are unreferenced) + Policy RetentionPolicy `json:"policy"` // the snapshot retention policy in force + PolicySet bool `json:"policySet"` // the volume set its own policy (else the default applies) } // chunkSize is the byte size of chunk index idx under g. diff --git a/seaweed-block/core/replication/peer.go b/seaweed-block/core/replication/peer.go index 6280721502..42dfadcedc 100644 --- a/seaweed-block/core/replication/peer.go +++ b/seaweed-block/core/replication/peer.go @@ -178,15 +178,15 @@ type ReplicaPeer struct { // append-only: status endpoints and TestOps gates use it to assert // peer recovery state without scraping logs. type ReplicaPeerStatus struct { - ReplicaID string - State string - Epoch uint64 - EndpointVersion uint64 - DataAddr string - CtrlAddr string - SessionID uint64 - ProbeInFlight bool - Closed bool + ReplicaID string // the peer replica + State string // the peer state (the replica peer table, M3) + Epoch uint64 // the epoch the peer was assigned at + EndpointVersion uint64 // the peer's endpoint version within the epoch + DataAddr string // the peer's data-path address + CtrlAddr string // the peer's control-path address + SessionID uint64 // the current recovery or shipping session; 0 when none + ProbeInFlight bool // a reachability probe of the peer is running + Closed bool // the peer handle was closed (it no longer ships) } // NewReplicaPeer constructs a per-replica runtime handle and registers diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index 08cc367950..9d2b108420 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -47,15 +47,15 @@ Replication peers of the served volume. Go type `volume.peersStatusBody`. | `ReplicaID` | string | this host's replica | | `PeerCount` | int | number of entries in Peers | | `Peers[]` | object | this primary's replication peers | -| `Peers[].ReplicaID` | string | — | -| `Peers[].State` | string | — | -| `Peers[].Epoch` | uint64 | — | -| `Peers[].EndpointVersion` | uint64 | — | -| `Peers[].DataAddr` | string | — | -| `Peers[].CtrlAddr` | string | — | -| `Peers[].SessionID` | uint64 | — | -| `Peers[].ProbeInFlight` | bool | — | -| `Peers[].Closed` | bool | — | +| `Peers[].ReplicaID` | string | the peer replica | +| `Peers[].State` | string | the peer state (the replica peer table, M3) | +| `Peers[].Epoch` | uint64 | the epoch the peer was assigned at | +| `Peers[].EndpointVersion` | uint64 | the peer's endpoint version within the epoch | +| `Peers[].DataAddr` | string | the peer's data-path address | +| `Peers[].CtrlAddr` | string | the peer's control-path address | +| `Peers[].SessionID` | uint64 | the current recovery or shipping session; 0 when none | +| `Peers[].ProbeInFlight` | bool | a reachability probe of the peer is running | +| `Peers[].Closed` | bool | the peer handle was closed (it no longer ships) | ### `GET /status/durable` @@ -285,16 +285,16 @@ The engine's replica projection (only with recovery enabled). Go type `engine.Re | Field | Type | Meaning | |---|---|---| -| `Mode` | Mode (string) | — | -| `RecoveryDecision` | RecoveryDecision (string) | — | -| `SessionKind` | SessionKind (string) | — | -| `SessionPhase` | SessionPhase (string) | — | -| `Epoch` | uint64 | — | -| `EndpointVersion` | uint64 | — | -| `R` | uint64 | — | -| `S` | uint64 | — | -| `H` | uint64 | — | -| `Reason` | string | — | +| `Mode` | Mode (string) | the engine mode (idle, recovering, healthy, degraded) | +| `RecoveryDecision` | RecoveryDecision (string) | the recovery class the R/S/H boundaries call for | +| `SessionKind` | SessionKind (string) | the kind of the current recovery session, if any | +| `SessionPhase` | SessionPhase (string) | its phase | +| `Epoch` | uint64 | the authority epoch | +| `EndpointVersion` | uint64 | the endpoint version within the epoch | +| `R` | uint64 | the replica's durable boundary (LSN) | +| `S` | uint64 | the primary's recoverable start boundary (WAL tail LSN) | +| `H` | uint64 | the primary's target boundary (head LSN) | +| `Reason` | string | why the engine is in this mode or decision | ### `GET /status/chunk` @@ -302,29 +302,29 @@ Chunk store usage of a walstore-chunk volume (only with --chunk-control-endpoint | Field | Type | Meaning | |---|---|---| -| `volumeID` | string | — | +| `volumeID` | string | the volume | | `chunkBytes` | uint64 | one full chunk | -| `liveChunks` | int | — | -| `liveBytes` | uint64 | — | -| `snapshots[]` | object | — | -| `snapshots[].name` | string | — | -| `snapshots[].createdNs` | int64 | — | -| `snapshots[].class` | string | — | -| `snapshots[].pinned` | bool | — | -| `snapshots[].chunks` | int | — | -| `snapshots[].exclusiveBytes` | uint64 | — | -| `manifestBindings` | int | — | -| `manifestBytes` | uint64 | — | -| `storedBindings` | int | — | -| `storedBytes` | uint64 | — | -| `storedUpperBound` | bool | — | -| `policy` | object | — | -| `policy.keepNewest` | int | — | -| `policy.keepYoungerNs` | int64 | — | -| `policy.keepHourly` | int | — | -| `policy.keepDaily` | int | — | -| `policy.keepWeekly` | int | — | -| `policySet` | bool | — | +| `liveChunks` | int | chunks HEAD references | +| `liveBytes` | uint64 | their bytes (the last chunk clipped) | +| `snapshots[]` | object | one entry per live snapshot | +| `snapshots[].name` | string | the snapshot name | +| `snapshots[].createdNs` | int64 | when it was created (Unix ns) | +| `snapshots[].class` | string | its retention class | +| `snapshots[].pinned` | bool | retention never deletes it | +| `snapshots[].chunks` | int | chunks its manifest references | +| `snapshots[].exclusiveBytes` | uint64 | bytes no other holder references: what deleting it makes eligible for GC | +| `manifestBindings` | int | stored chunk-key bindings some manifest references | +| `manifestBytes` | uint64 | their exact bytes | +| `storedBindings` | int | all chunk-key bindings in the filer, referenced or not | +| `storedBytes` | uint64 | their bytes; unreferenced ones counted at full chunk size | +| `storedUpperBound` | bool | StoredBytes is an upper bound (some bindings are unreferenced) | +| `policy` | object | the snapshot retention policy in force | +| `policy.keepNewest` | int | keep the newest N unpinned snapshots | +| `policy.keepYoungerNs` | int64 | keep every snapshot younger than this (ns) | +| `policy.keepHourly` | int | keep the newest snapshot of each of the last N hours | +| `policy.keepDaily` | int | keep the newest snapshot of each of the last N days | +| `policy.keepWeekly` | int | keep the newest snapshot of each of the last N weeks | +| `policySet` | bool | the volume set its own policy (else the default applies) | ### `GET /status/nvme`