diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 7a6eb833d1..4d3c3aa67a 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -230,6 +230,7 @@ RF2 qualification limitation until ordered-live certification is wired (#297). S | any | role admission failed | the listener cannot be fenced or its floor cannot be persisted; the role is not adopted and the projection is not healthy | `core/host/volume/host.go` `latchRoleAdmission` | `INV-FENCE-FLOOR-DURABLE-001` | | (every inbound frame) | — | a mutating frame is refused on a primary, below the floor, or before a role is known; the rebuild port applies the same rules; a failed apply closes the connection | `core/transport/replica.go` `acceptMutationLineage`, `admitMutation`, `EnterDualLane`, `handleConn` | `INV-FENCE-SELF-ON-PROMOTE-001`, `INV-FENCE-FLOOR-DURABLE-001`, `INV-REPL-REBUILD-PORT-FENCE-001`, `INV-REPL-APPLY-FAIL-001` | | Supporting | promotion candidate | no active recovery session; member, reachable, caught up, fenced at the current epoch, post-rebuild durable acknowledgement delivered; for RF=2 and up also a fresh probe and coverage of the required frontier: known, or proven by at least N_peers-K+1 fresh ready peers when it is unknown | `core/engine/promotion_ready.go` `BuildPromotionReadyFact`; `core/host/master/product_loop.go` `applyPromotionEvidenceGate` | `INV-REPL-PROMOTION-READY-001`, `INV-PROMOTE-FRONTIER-001`, `INV-PROMOTE-FRONTIER-PROBE-001`, `INV-PROMOTE-FRONTIER-UNKNOWN-001` | +| Primary (unreachable) | another replica Primary at e+1 | the operator's failover (`ExecuteFailback`) of a line whose primary has no fresh, reachable heartbeat slot: the fence is pending from the attempt; the fencing round fences every other replica at e+1; only `fencedDecision`'s allowed target is published, basis Fenced at e+1, through the line's conditional update (a concurrent promotion-loop decision at the same epoch is refused); a refused or unpublished round is healed by either gate (the line's own primary continued at e+1); `best_effort` is refused, and a reachable RF3 `sync_quorum` primary's move stays refused (needs a seal) | `core/host/master/planned_move.go` `plannedMoveEvidence`, `primaryUnreachable`, `fencedMoveEvidence`; `core/host/master/product_loop.go` `applyPromotionEvidenceGate`, `applyUnsupportedPromotionEvidenceGate` | `INV-PROMOTE-UNKNOWN-CURRENT-001` | **Recovery observation and apply ordering.** A probe publishes its fresh boundaries before reachability, and each emitted recovery is prepared under the adapter mutex before the next event. Same-identity delayed probes retain completed durable R; missing probe boundaries remain unknown until a valid observation arrives. Every lane and session shares one replica-wide per-LBA applied-LSN map under the apply mutex; session close releases coverage only. Recovery skips stale data while advancing its own coverage; stale live data fails without advancing recovery coverage. diff --git a/seaweed-block/docs/design/kubernetes-block-design.md b/seaweed-block/docs/design/kubernetes-block-design.md index 4dfeeb2619..ab710d8a3b 100644 --- a/seaweed-block/docs/design/kubernetes-block-design.md +++ b/seaweed-block/docs/design/kubernetes-block-design.md @@ -210,7 +210,7 @@ The volume computes whether it may become primary; blockmaster decides; only the **RF=3 gate** (`core/host/master/promotion_probe.go`, `promotionAllowedReplicas`, `chooseAllowedPromotionTarget`): no promotion when the probe failed or is not installed, or the ack profile is unknown; a candidate is skipped when it is not `replica_ready` with a known frontier, or its durable LSN is below the required frontier. The decision is recorded as an ops event (`candidate_covers_required_frontier`, `candidate_frontier_behind`, `no_promotion_ready_candidate`). The required frontier per volume (`RequiredLSNByVolume`) is not set by `cmd/blockmaster` today, so the frontier is unknown and coverage is proven from the survivors instead: with `sync_quorum` or `sync_all`, the ready candidate with the highest durable LSN is promoted only when at least P-K+1 of the P peers are probed ready (known durable LSN) and have a fresh heartbeat, where K is the number of peer acks a write needs (`waitForSyncAcks`: P for `sync_all`, (P+1)/2 for `sync_quorum`). Any P-K+1 peers include one that holds every acknowledged write that their sampled frontiers represent. The probes of one tick are snapshots, not a fence: a primary that is still running can acknowledge after a sample was taken (for example, r3 reports 70 in a held probe response, the old primary then acknowledges 71, and r2 at 70 is still selected). That is the missing primary lease below (§12, #195). For RF=3 that is both peers under `sync_quorum` and one under `sync_all`; with fewer, nothing is promoted. An unknown frontier is never read as zero. `best_effort` is unchanged (§12). -**A current primary that does not answer is unknown, not failed.** When its status cannot be read (a pod gone, a partition), blockmaster does not reassign on either path, however ready the survivors: on a partition the primary may still be serving. Only the primary's own not-ready report moves the line automatically; otherwise failover is a manual admin action in this release. +**A current primary that does not answer is unknown, not failed.** When its status cannot be read (a pod gone, a partition), blockmaster does not reassign on either path, however ready the survivors: on a partition the primary may still be serving. Only the primary's own not-ready report moves the line automatically; otherwise failover is a manual admin action in this release. The admin's failover of an unreachable primary (no fresh, reachable heartbeat) is decided on the fencing round, at any replica count: every other replica is fenced at N+1, the target must hold the highest fenced end and be ready, and the line carries basis Fenced; a round that publishes nothing leaves the fence pending, and the line's own primary is continued at N+1 when it answers ready again. The round stops the old primary's writes, not its reads: confirm the old node is off or cut from its clients first. **What blocks a promotion:** any engine reason above; a current primary whose status cannot be read; `unhealthy_reason` set or withdrawn; an unreachable or ineligible server; boot grace still holding; a current primary whose probe is ready; a snapshot rejected for slot count; slots that changed while the probe ran. @@ -222,6 +222,8 @@ stateDiagram-v2 Suspect --> Blocked: no promotion-ready candidate Blocked --> Suspect: next product tick Suspect --> Reassigned: candidate chosen, IntentReassign + Suspect --> Reassigned: admin failover of an unreachable primary, fencing round allows the target (basis Fenced) + Suspect --> Serving: fencing round refused or unpublished, own primary answers ready (heal at N+1) Reassigned --> Serving: publisher persists epoch N+1, new primary fences and serves ```