From 3bb1cfb1e961a7a96aba4d4ae02b9616f82bd1a7 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 24 Nov 2026 10:37:36 -0800 Subject: [PATCH] test, docs: a missing primary pod is unknown: no automatic reassign; Kubernetes alpha failover is manual Co-Authored-By: Claude Opus 5.5 --- .../core/host/master/product_loop_test.go | 28 ++++++++----------- seaweed-block/deploy/k8s/alpha/README.md | 1 + .../docs/design/kubernetes-block-design.md | 4 ++- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/seaweed-block/core/host/master/product_loop_test.go b/seaweed-block/core/host/master/product_loop_test.go index b8d9cbeed9..c52a824938 100644 --- a/seaweed-block/core/host/master/product_loop_test.go +++ b/seaweed-block/core/host/master/product_loop_test.go @@ -544,7 +544,7 @@ func TestMountedFailover_ProductLoopRF3ProbeCanAuthorizeStaleHeartbeatReadiness( } } -func TestMountedFailover_ProductLoopRF3PromotesWhenCurrentSlotMissingButSurvivorProbeReady(t *testing.T) { +func TestMountedFailover_ProductLoopRF3DoesNotReassignWhenCurrentSlotMissing(t *testing.T) { h := newTestMasterWithControllerConfig(t, t.TempDir(), authority.TopologyControllerConfig{ ExpectedSlotsPerVolume: 3, }) @@ -570,28 +570,22 @@ func TestMountedFailover_ProductLoopRF3PromotesWhenCurrentSlotMissingButSurvivor } // K8s can keep the server/node fresh while the generated primary - // blockvolume pod is gone. That produces PartialInventory and excludes - // the volume from the normal supported snapshot; the product loop must - // still use placement + probe evidence to promote an eligible survivor. + // blockvolume pod is gone: PartialInventory, and the current primary's + // status cannot be read (CurrentKnown false). That is UNKNOWN, not + // failed: on a partition the primary may still be serving, so no + // automatic reassign happens, however ready the survivors. Failover is + // an admin forced move with its barrier. ingestRF3PartialInventoryMissingCurrent(t, h, "vol-rf3", "node-a", "node-b", "node-c") placements := h.Lifecycle().Placements.ListPlacements() report := authority.SupportabilityReport{Unsupported: map[string]authority.VolumeUnsupportedEvidence{ "vol-rf3": {VolumeID: "vol-rf3", Reasons: []string{authority.ReasonPartialInventory}}, }} - probes, blocked, asks := h.applyUnsupportedPromotionEvidenceGate(placements, report, nil) - if probes != 1 || blocked != 0 || len(asks) != 1 { - line, _ := h.Publisher().VolumeAuthorityLine("vol-rf3") - t.Fatalf("probes=%d blocked=%d asks=%+v placements=%+v line=%+v want one direct unsupported promotion ask", probes, blocked, asks, placements, line) + probes, _, asks := h.applyUnsupportedPromotionEvidenceGate(placements, report, nil) + if probes != 1 || len(asks) != 0 { + t.Fatalf("probes=%d asks=%+v; want one probe and no reassign for an unanswered current primary", probes, asks) } - if asks[0].ReplicaID != "r3" || asks[0].Intent != authority.IntentReassign { - t.Fatalf("ask=%+v want highest durable survivor r3 reassign", asks[0]) - } - if err := h.ctrl.SubmitAssignmentAsk(asks[0]); err != nil { - t.Fatalf("submit unsupported promotion ask: %v", err) - } - failover := waitAuthorityReplica(t, h.Publisher(), "vol-rf3", "r3") - if failover.Epoch != 2 || failover.EndpointVersion != 1 { - t.Fatalf("failover line=%+v want highest durable survivor r3@2/1", failover) + if line, _ := h.Publisher().VolumeAuthorityLine("vol-rf3"); line.ReplicaID != "r1" || line.Epoch != initial.Epoch { + t.Fatalf("line=%+v; want r1@%d unchanged", line, initial.Epoch) } } diff --git a/seaweed-block/deploy/k8s/alpha/README.md b/seaweed-block/deploy/k8s/alpha/README.md index c873c61db2..93a8fc33ff 100644 --- a/seaweed-block/deploy/k8s/alpha/README.md +++ b/seaweed-block/deploy/k8s/alpha/README.md @@ -205,6 +205,7 @@ This alpha MVP does not yet claim: - production-ready durability - multi-node Kubernetes operation - failover while a pod remains mounted +- automatic failover when the primary node or pod is lost: blockmaster does not reassign on a primary it cannot read; failover is a manual admin action - real operator reconciliation - backend data shredding on delete - snapshots, clone, resize, block mode, topology spread, or NVMe-oF diff --git a/seaweed-block/docs/design/kubernetes-block-design.md b/seaweed-block/docs/design/kubernetes-block-design.md index f414c1838f..b12b036e9b 100644 --- a/seaweed-block/docs/design/kubernetes-block-design.md +++ b/seaweed-block/docs/design/kubernetes-block-design.md @@ -210,7 +210,9 @@ 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). -**What blocks a promotion:** any engine reason above; `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. +**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. + +**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. ```mermaid stateDiagram-v2