From ec0d661564ce74e43b208b5f4d2a012d517c2eb5 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 17 Jun 2026 17:17:39 -0700 Subject: [PATCH] docs: add recovery node evidence and bundle deep dives --- seaweed-block/docs/wiki/code-map.md | 5 +- seaweed-block/docs/wiki/coverage-matrix.md | 12 +- .../wiki/deep-dives/live-node-evidence.md | 216 ++++++++++++++++ .../deep-dives/support-bundle-cold-reader.md | 242 ++++++++++++++++++ .../wiki/deep-dives/wal-frontier-recovery.md | 218 ++++++++++++++++ seaweed-block/docs/wiki/topic-inventory.md | 23 +- seaweed-block/mkdocs.yml | 3 + 7 files changed, 702 insertions(+), 17 deletions(-) create mode 100644 seaweed-block/docs/wiki/deep-dives/live-node-evidence.md create mode 100644 seaweed-block/docs/wiki/deep-dives/support-bundle-cold-reader.md create mode 100644 seaweed-block/docs/wiki/deep-dives/wal-frontier-recovery.md diff --git a/seaweed-block/docs/wiki/code-map.md b/seaweed-block/docs/wiki/code-map.md index 941084e00a..470f55e62a 100644 --- a/seaweed-block/docs/wiki/code-map.md +++ b/seaweed-block/docs/wiki/code-map.md @@ -46,6 +46,10 @@ mutation and prevents lifecycle ownership from becoming a broad operator. | Register `SwBlockVolume` from CSI | `core/csi/kubernetes_metadata.go` | | Project delete-safety from cleanup evidence | `core/ops/observation_bundle.go` | | Parse cleanup verifier output | `core/ops/cleanup_evidence.go` | +| Enrich live node/CSI evidence | `cmd/sw-block/main.go`, `core/ops/kubernetes_node_evidence.go` | +| Replay support bundles | `core/ops/observation_bundle.go`, `scripts/collect-helm-support-bundle.sh` | +| Render report/dashboard/snapshot | `core/ops/observation_report.go`, `core/ops/observation_dashboard.go`, `core/ops/operator_snapshot.go` | +| SmartWAL and recovery frontier handling | `core/storage/smartwal/`, `core/recovery/`, `core/transport/` | ## Development Rule @@ -62,4 +66,3 @@ failure bundle evidence ``` If any item is missing, the feature is not ready for product code. - diff --git a/seaweed-block/docs/wiki/coverage-matrix.md b/seaweed-block/docs/wiki/coverage-matrix.md index 656087c90d..09d8bac139 100644 --- a/seaweed-block/docs/wiki/coverage-matrix.md +++ b/seaweed-block/docs/wiki/coverage-matrix.md @@ -27,14 +27,15 @@ Coverage levels: | Delete-safety | Holds unsafe deletion, releases on clean evidence | Phase 39, 42, 44; finalizer-delete-safety contract | deep initial | field-by-field status contract | | Cleanup verifier | Zero-residue authority and safety evidence | cleanup scripts, Phase 29, 36, 44 | mapped | residue taxonomy | | ManagedVolume readiness | Shared ready/blocked/unknown model | Phase 22, 32, 35-36 | deep initial | add reason-code taxonomy | -| Node readiness / CSI evidence | Avoids false node-ready status | Phase 37 | linked | detailed live evidence diagram | +| Node readiness / CSI evidence | Avoids false node-ready status | Phase 37 | deep | keep live K8s evidence current as CRD evolves | | SmartWAL dirty failure | Proves dirty storage evidence cannot become false Ready | Phase 34 | deep | add exact test log excerpts later | +| WAL/frontier/barrier/recovery | Persistence and recovery vocabulary behind dirty-failure and rebuild | methodology docs, recovery tutorial, Phase 34 | deep | add exact SmartWAL layout diagrams later | | Authority / epoch / promotion | One-primary, fencing, restart authority persistence | Phases 13-18, 31, invariant ledger | deep initial | add code-level product-loop walkthrough | | Returned-replica rebuild/reintegration | Next major storage lifecycle feature | recovery refs, roadmap | deep initial | add concrete future gate plan | | iSCSI frontend / ALUA / multipath | Current default frontend and transparent failover path | iSCSI refs, Phase 17, 27, 37 | deep | keep artifact examples current as scenarios evolve | | NVMe ANA parity | Planned protocol parity path | NVMe refs, roadmap | linked | future protocol page | | TestOps runner and scenarios | Product evidence, not just tests | `testops/`, Phase 33-34 | deep initial | add runner action reference | -| Support bundle/replay/report/dashboard | Cold-reader diagnosis and support path | Phases 23-24, 28, 32, 36 | mapped | bundle structure diagram | +| Support bundle/replay/report/dashboard | Cold-reader diagnosis and support path | Phases 23-24, 28, 32, 36, 44 | deep | keep artifact list aligned with collect script | | Release engineering | Image/chart skew prevention | Phases 40, 44, release notes | mapped | release checklist page | | Docker volume plugin idea | Future non-K8s adapter | roadmap | linked | investigation page later | @@ -65,7 +66,10 @@ explicit non-claims 5. TestOps authoring and evidence realism. 6. Authority/promotion/restart persistence. 7. iSCSI ALUA/multipath frontend. -8. Returned-replica rebuild readiness. +8. WAL/frontier/barrier/recovery. +9. Live node/CSI evidence. +10. Support bundle cold-reader path. +11. Returned-replica rebuild readiness. -These eight pages would cover most of the hard-earned knowledge from the last +These pages cover most of the hard-earned knowledge from the last few months. The rest can remain linked until those are reviewed. diff --git a/seaweed-block/docs/wiki/deep-dives/live-node-evidence.md b/seaweed-block/docs/wiki/deep-dives/live-node-evidence.md new file mode 100644 index 0000000000..3b3bb28072 --- /dev/null +++ b/seaweed-block/docs/wiki/deep-dives/live-node-evidence.md @@ -0,0 +1,216 @@ +# Live Node And CSI Evidence + +This page explains how Seaweed Block decides whether a Kubernetes node can +actually participate in block-volume operations. It exists because earlier +surfaces repeatedly showed nodes as ready when live Kubernetes evidence said +otherwise. + +## Reader Orientation + +You need this page before changing: + +- node readiness projection, +- CSI node DaemonSet behavior, +- image-pull and install-preflight checks, +- report/dashboard/explain live enrichment, +- host-prereq and loopback blockers, +- release gates that claim a PVC can attach on a node. + +The product question is: + +```text +Can the user see node-level blockers from live Kubernetes/host evidence before +they become confusing PVC attach failures or false volume Ready signals? +``` + +## Domain Background + +Kubernetes node readiness is not one fact. + +| Fact | Source | Meaning | +|---|---|---| +| Node Ready | `Node.status.conditions` | kubelet/node health | +| SchedulingDisabled | node spec/cordon state | new pods should not schedule | +| CSI node pod Ready | Seaweed Block CSI DaemonSet pod | node plugin is running | +| CSI driver registration | `CSIDriver` / `CSINode` | kubelet knows the CSI driver | +| image pull state | CSI pod container waiting reason | selected image exists/reachable on that node | +| host prereqs | scripts or host evidence | iSCSI/multipath tools and modules exist | +| frontend reachability | publish target and node topology | target can be used from app node | + +A node can be Kubernetes Ready but still blocked for Seaweed Block because the +CSI image is missing, the CSI node pod is not ready, the driver is not +registered, or a loopback frontend is being used cross-node. + +## Product Contract + +The narrow claim is: + +```text +CRD status, report, dashboard, and explain must agree on node readiness and +node blockers from live evidence, not replay-only fixtures or helper summaries. +``` + +Negative-first rules: + +- Node NotReady wins over CSI symptoms. +- Image missing on node wins over secondary symptoms such as CSI driver not + registered. +- Cordon is a blocked scheduling condition, not a storage corruption signal. +- Missing evidence must not become healthy. +- A live node blocker must not be visible only in CRD status while report or + dashboard still shows green. + +## Ownership Model + +| Layer | Owns | +|---|---| +| Kubernetes API | Node, Pod, DaemonSet, CSIDriver, CSINode facts | +| node evidence enricher | reads live K8s facts and updates observation model | +| operator-status | writes `SwBlockCluster.status.nodes[]` | +| report/dashboard/explain | consume the same enriched observation path | +| lifecycle-owner | does not decide node readiness | +| TestOps | creates live blockers and checks cross-surface agreement | + +## Precedence State Machine + +```mermaid +flowchart TD + A[Live node evidence] --> B{Node Ready?} + B -->|False or Unknown| N[unknown / node_not_ready] + B -->|True| C{Schedulable?} + C -->|No| S[blocked / node_scheduling_disabled] + C -->|Yes| I{Required image present?} + I -->|No| IMG[blocked / image_missing_on_node] + I -->|Yes| D{CSI driver registered?} + D -->|No| DRV[blocked / csi_driver_not_registered] + D -->|Yes| P{CSI node pod ready?} + P -->|No| POD[blocked / csi_node_pod_not_ready] + P -->|Yes| H{Host prereqs ok?} + H -->|No| HP[blocked / iscsi_prereq_missing or multipath_prereq_missing] + H -->|Yes| R[ready / node_ready] +``` + +This precedence exists because symptom-first classification is misleading. A +NotReady node naturally causes CSI pod and driver symptoms; the root cause must +surface as `node_not_ready`. + +## Live Enrichment Path + +```mermaid +sequenceDiagram + participant CLI as sw-block ops/report/dashboard/explain + participant EN as NodeEvidenceEnricher + participant K8S as Kubernetes API + participant OBS as ClusterEvidence + participant CRD as SwBlockCluster.status + + CLI->>OBS: load master/bundle observation + CLI->>EN: enrich live node evidence + EN->>K8S: read Nodes, Pods, CSIDriver, CSINode + K8S-->>EN: live readiness/image/registration facts + EN-->>OBS: nodes[] status/reason/conditions + OBS->>CRD: operator-status patches status + OBS-->>CLI: report/dashboard/explain render same facts +``` + +The important implementation detail is that live enrichment must be shared by +all live consumers. A fix in operator-status alone is not enough if `ops report` +or dashboard still loads un-enriched facts. + +## Code Map + +| Responsibility | Code / evidence | +|---|---| +| live enrichment call site | `cmd/sw-block/main.go` (`enrichLiveObservationCluster`) | +| namespace selection for CSI pods | `liveNodeEvidenceNamespace` | +| K8s node/CSI read model | `core/ops/kubernetes_node_evidence.go` | +| node classification | `core/ops/operator_status_controller.go`, `classifyNodeReadiness` | +| observation replay/host prereq | `core/ops/observation_bundle.go` | +| reason vocabulary | `core/ops/observation.go` | +| CRD schema | `charts/seaweed-block/crds/` | +| Phase 37 gates | `internal/docs/qa-assignments/phase37-*` | + +## Evidence Contract + +Node evidence must include stable fields: + +```text +node= +status= +reason= +ready= +schedulable= +missing_images= +conditions[]=Ready/Blocked/EvidenceStale with reason +``` + +For image failures: + +```text +container_waiting_reason=ImagePullBackOff|ErrImagePull|ErrImageNeverPull +missing_images=["sw-block-csi:"] +``` + +For host prereqs: + +```text +iscsi_prereq= +multipath_prereq= +``` + +For loopback cross-node: + +```text +reason=publish_target_loopback_cross_node +app_node= +blockvolume_node= +frontend=127.0.0.1:3260 +``` + +## Failure Taxonomy + +| Reason | Meaning | +|---|---| +| `node_not_ready` | Kubernetes node readiness is false/unknown | +| `node_scheduling_disabled` | node is cordoned/unschedulable | +| `image_missing_on_node` | selected Seaweed Block image cannot run on that node | +| `csi_driver_not_registered` | Kubernetes does not see the CSI driver on the node | +| `csi_node_pod_not_ready` | CSI DaemonSet pod is not ready | +| `iscsi_prereq_missing` | node lacks required iSCSI host prerequisite | +| `multipath_prereq_missing` | node lacks required multipath host prerequisite | +| `publish_target_loopback_cross_node` | loopback frontend cannot be used from another node | + +## Implementation Checklist + +1. Read live Node, Pod, CSIDriver, and CSINode facts with read-only RBAC. +2. Resolve the CSI control-plane namespace, not the user's default namespace, + when reading CSI node pods. +3. Classify root cause before symptoms: NotReady before CSI pod/driver reasons; + image missing before registration fallout. +4. Map facts to existing CRD-valid condition types (`Ready`, `Blocked`, + `EvidenceStale`) instead of inventing invalid condition enum values. +5. Enrich every live consumer: operator-status, report, dashboard, explain. +6. Keep from-bundle replay deterministic; do not require live K8s for cold + bundles. +7. Add schema/API validation for the written status payload. +8. Test both `ImagePullBackOff` and `ErrImageNeverPull`. +9. Keep RBAC read-only: no node/pod/daemonset/storage mutation. + +## QA History + +| Gate | What it found or proved | +|---|---| +| Phase 36 D2 | positive node readiness projected, but negative live node facts were replay-only | +| Phase 36 D5 | live image import issue showed false node-ready masking | +| Phase 37 D2 initial | non-healthy node conditions violated CRD enum and were rejected | +| Phase 37 D2 rerun | node NotReady root cause precedence fixed | +| Phase 37 D3 | image-missing reason fixed across CRD/report/dashboard/default namespace | +| Phase 37 D4/D5 | host prereq and loopback cross-node blockers surfaced | + +## Non-Claims + +- Node readiness does not prove storage data safety. +- A ready node does not imply a volume is Ready. +- The node evidence enricher does not repair images, uncordon nodes, or install + host packages. +- Loopback same-node support is not cross-node support. diff --git a/seaweed-block/docs/wiki/deep-dives/support-bundle-cold-reader.md b/seaweed-block/docs/wiki/deep-dives/support-bundle-cold-reader.md new file mode 100644 index 0000000000..a8f220c046 --- /dev/null +++ b/seaweed-block/docs/wiki/deep-dives/support-bundle-cold-reader.md @@ -0,0 +1,242 @@ +# Support Bundle, Report, Dashboard, And Cold-Reader Evidence + +This page explains the support-bundle and replay path. It is the design +contract for making Seaweed Block diagnosable without SSHing back into the +cluster. + +## Reader Orientation + +You need this page before changing: + +- `scripts/collect-helm-support-bundle.sh`, +- `sw-block ops report --from-bundle`, +- `sw-block ops dashboard --from-bundle`, +- `sw-block ops explain ... --from-bundle`, +- `operator-snapshot.json`, +- cleanup-summary and delete-safety replay, +- TestOps failure artifacts. + +The product question is: + +```text +Can a support engineer or developer read one bundle on another machine and +reach the same status/reason/action conclusion as the live cluster surfaces? +``` + +## Domain Background + +Distributed storage failures often disappear when the cluster is cleaned up or +restarted. A useful bundle must therefore preserve: + +- Kubernetes object state, +- product status and logs, +- host initiator state, +- cleanup residue evidence, +- timeline and reason codes, +- enough metadata to know what was not collected. + +Logs alone are not enough. They are not structured, not necessarily complete, +and often lack the negative evidence needed for safe decisions. + +## Product Contract + +The bundle/replay contract is: + +```text +capture read-only evidence +-> replay the same observation model offline +-> render summary/report/dashboard/explain/operator-snapshot consistently +-> never claim mutation or repair +``` + +Required surfaces: + +```text +summary.txt +index.html +cluster-evidence.json +timeline.jsonl +operator-snapshot.json +explain.txt or explain command output +``` + +The cold reader should answer: + +```text +what volume/node is affected? +is it Ready, Blocked, Unknown, CleanupRequired, or Releasable? +what stable reason code explains it? +what evidence file supports the reason? +what is the safe next step? +what is explicitly not claimed? +``` + +## Ownership Model + +| Layer | Responsibility | +|---|---| +| collect script | read-only artifact capture | +| ops replay | parse bundle artifacts into `ClusterEvidence` | +| report renderer | human summary and HTML | +| dashboard | read-only local web view over same evidence | +| operator-snapshot | stable JSON for automation and UI | +| explain | cold-reader narrative for one volume/reason | +| verifier scripts | produce cleanup evidence, not hidden mutation by replay | + +No support-bundle replay path may promote, repair, rebuild, failback, delete, +or cleanup live state. + +## Replay Flow + +```mermaid +flowchart TD + A[collect support bundle] --> B[K8s snapshots and logs] + A --> C[host state: iSCSI/multipath/dmsetup/process] + A --> D[product evidence: cluster/status/timeline] + A --> E[cleanup-summary/delete-safety evidence] + B --> R[ops report --from-bundle] + C --> R + D --> R + E --> R + R --> S[summary.txt] + R --> H[index.html] + R --> O[operator-snapshot.json] + O --> DB[dashboard --from-bundle] + O --> EX[explain volume --from-bundle] +``` + +## Evidence Precedence + +Bundles can contain multiple captures. Replay must prefer the freshest relevant +evidence instead of a lexicographically early file. + +```mermaid +stateDiagram-v2 + [*] --> LoadArtifacts + LoadArtifacts --> ChooseFreshest: captured_at present + ChooseFreshest --> ReplayLatest: newer post-restart evidence wins + ChooseFreshest --> EvidenceStale: newest evidence incomplete or stale + EvidenceStale --> ReadyUnknown: do not claim Ready + ReplayLatest --> SurfaceAgreement: summary/snapshot/dashboard agree +``` + +This rule came from restart-persistence work: older pre-promotion evidence +could otherwise show the wrong primary after restart. + +## Code Map + +| Responsibility | Code / script | +|---|---| +| collect bundle | `scripts/collect-helm-support-bundle.sh` | +| basic app report generation | `scripts/run-basic-app-example.sh` | +| multi-volume report generation | `scripts/run-multi-volume-example.sh` | +| bundle load/replay | `core/ops/observation_bundle.go` | +| report rendering | `core/ops/observation_report.go` | +| dashboard handler | `core/ops/observation_dashboard.go` | +| operator snapshot | `core/ops/operator_snapshot.go` | +| CLI wiring | `cmd/sw-block/main.go` | +| cleanup parsing | `core/ops/cleanup_evidence.go` | +| delete-safety projection | `core/ops/delete_safety_contract.go`, `observation_bundle.go` | + +## Minimum Bundle Contents + +A strong failure bundle should include: + +```text +metadata: + product revision + chart values or rendered manifests + scenario/run id if from TestOps + +cluster: + pods/deploys/events + PVC/PV/StorageClass/CSIDriver/CSINode + SwBlockCluster/SwBlockVolume CRs when enabled + +product: + blockmaster logs current + previous when available + blockvolume logs current + previous when available + CSI controller/node logs + cluster-evidence.json + timeline.jsonl + operator-snapshot.json + +host: + iscsiadm sessions + iscsiadm node records + multipath -ll + dmsetup ls/info + product processes + hostPath evidence when relevant + +cleanup: + cleanup-summary.txt + residue counts + verify command output +``` + +## Stable Surface Fields + +The replayed surfaces must agree on: + +```text +status +reason_code +Ready condition +Blocked / EvidenceStale / CleanupRequired condition +read_only=true +mutation_allowed=false +safe_next_steps[].mode +support_bundle_refs[] +cleanup.status / residue counts +deleteSafety.decision/state/reason when deleting evidence exists +``` + +If any surface says `Ready=True` while another says blocked/unknown, the bundle +is not product-grade evidence. + +## Failure Taxonomy + +| Failure | Meaning | +|---|---| +| `bundle_missing_required_artifact` | replay cannot find required structured input | +| `evidence_stale` | freshest evidence is too old/incomplete for Ready | +| `surface_disagreement` | summary/snapshot/dashboard/explain disagree | +| `cleanup_required` | cleanup verifier found residue | +| `cleanup_evidence_missing` | delete request has no cleanup evidence | +| `cleanup_evidence_stale` | delete request evidence is too old | +| `from_bundle_lookup_missing` | explain/report cannot locate the volume in replay inventory | +| `snapshot_precedence_stale` | older capture overrides newer truth | + +## Implementation Checklist + +1. Capture structured JSON/JSONL before relying on text logs. +2. Include product and runner revision when available. +3. Capture previous container logs for crash/restart failures. +4. Preserve host evidence before cleanup removes it. +5. Parse artifacts into one observation model; do not let report/dashboard + recompute separate truth. +6. Prefer freshest evidence by `captured_at` for replay. +7. Represent missing evidence explicitly as Unknown/EvidenceStale. +8. Keep safe next steps read-only or scripted with `mutation_allowed=false`. +9. Verify summary, HTML, `operator-snapshot.json`, dashboard, and explain + agree on status/reason. +10. Run cleanup verifier after teardown and include zero-residue proof. + +## QA History + +| Phase | Contribution | +|---|---| +| Phase 28 | support bundle diagnostics and dashboard route became close-gate evidence | +| Phase 29 | cleanup evidence carried into report/dashboard/operator-snapshot | +| Phase 32 | surface agreement and stale-evidence replay precedence fixed | +| Phase 36 | support bundle refs and safe next steps projected into CRD/status surfaces | +| Phase 44 | cleanup-summary/deleteSafety replay for deleting CRs integrated into report/dashboard/explain | + +## Non-Claims + +- A support bundle is not a backup, snapshot, or restore point. +- Replay is not a repair executor. +- `safe_next_steps` are instructions or dry-run/scripted hints, not proof that + the product executed mutation. +- A cold bundle cannot prove facts that were never captured. diff --git a/seaweed-block/docs/wiki/deep-dives/wal-frontier-recovery.md b/seaweed-block/docs/wiki/deep-dives/wal-frontier-recovery.md new file mode 100644 index 0000000000..64fde4b9b9 --- /dev/null +++ b/seaweed-block/docs/wiki/deep-dives/wal-frontier-recovery.md @@ -0,0 +1,218 @@ +# WAL, Frontier, Barrier, And Recovery + +This page explains the persistence and recovery vocabulary behind Seaweed +Block. It is written for developers who need to change SmartWAL, durable +frontends, recovery, rebuild, or readiness projection. + +## Reader Orientation + +Do not start with "where is the write function?" Start with the block-storage +question: + +```text +After failure, which acknowledged writes are definitely part of the current +truth, and which old sessions or partial recovery streams must be ignored? +``` + +The project vocabulary is: + +| Term | Meaning | +|---|---| +| WAL | write-ahead log or durable record stream used to recover acknowledged writes | +| frontier | highest durable progress boundary that recovery can trust | +| barrier | terminal evidence that a recovery or shipping route has closed | +| lineage | generation/session identity that prevents old traffic from becoming current truth | +| session | bounded protocol or recovery conversation | +| fail closed | refuse Ready/write projection when evidence is missing, stale, or corrupt | + +These words matter because a false `Ready=True` after dirty storage evidence is +more dangerous than a visible failure. + +## Domain Background + +Block storage clients assume a coherent device. Filesystems do not know about +Seaweed Block replicas, control-plane epochs, or TestOps gates. If a write is +acknowledged, the storage system must either preserve it or explicitly fail the +path rather than present a silently regressed device. + +Write-ahead logging solves only part of the problem. The hard parts are: + +- distinguishing a torn tail from mid-history corruption, +- ensuring recovery does not skip committed records and keep later records, +- proving a replica caught up to the required frontier, +- ensuring old sessions cannot complete against new authority, +- ensuring control-plane readiness reflects storage recovery, not process + liveness. + +## Product Contract + +The narrow product rule is: + +```text +Known dirty or incomplete durable evidence must not surface as Ready=True. +``` + +Positive readiness requires: + +```text +storage opened successfully +recovery completed or is not required +local readiness published positively +authority projection sees positive primary readiness +ManagedVolume projection sees current evidence +``` + +Negative or uncertain evidence becomes: + +```text +Ready=Unknown / EvidenceStale +or Ready=False / Blocked +``` + +depending on whether the product can identify a concrete blocker. + +## Ownership Model + +| Layer | Owns | Must not own | +|---|---|---| +| storage / SmartWAL | local record integrity and recovery result | cluster readiness | +| blockvolume process | local readiness and diagnosable status endpoint | global authority decision | +| blockmaster | authority projection and primary readiness observation | WAL interpretation | +| operator-status/report | user-facing condition projection | storage mutation | +| TestOps | dirty-failure injection and evidence validation | product truth by helper echo only | + +## Recovery Shape + +```mermaid +flowchart TD + W[Write acknowledged] --> WAL[WAL record persisted] + WAL --> F[Durable frontier advances] + F --> FAIL{Failure or restart} + FAIL --> REC[Recovery reads WAL/store] + REC -->|valid records to frontier| READY[local readiness allowed] + REC -->|torn tail beyond safe frontier| TRUNC[truncate/ignore tail if proven safe] + REC -->|CRC fault inside committed history| FAULT[WAL integrity fault] + FAULT --> BLOCK[block local readiness] + BLOCK --> OBS[blockmaster sees no positive primary readiness] + OBS --> MV[ManagedVolume refuses Ready=True] +``` + +## Session / Lineage / Barrier Model + +The older methodology describes the block-shaped chain: + +```text +initiator -> target -> session -> lineage -> barrier -> recovery +``` + +In implementation terms: + +```mermaid +stateDiagram-v2 + [*] --> SessionActive + SessionActive --> LineageAdvanced: authority/endpoint generation changes + LineageAdvanced --> StaleRejected: old callback/frame/session arrives + SessionActive --> RecoveryStarted: replica behind or dirty restart + RecoveryStarted --> BarrierPending: bytes sent or records replayed + BarrierPending --> RecoveryClosed: terminal barrier evidence accepted + BarrierPending --> RecoveryBlocked: barrier missing, stale, or corrupt + RecoveryClosed --> ReadyProjection: positive readiness may be published + RecoveryBlocked --> NotReadyProjection: Ready must be Unknown/Blocked +``` + +Key rule: + +```text +bytes sent != recovery closed +process reachable != storage ready +``` + +## Code Map + +| Responsibility | Code / source | +|---|---| +| SmartWAL store layout and recovery | `core/storage/smartwal/` | +| durable frontend readiness | `core/frontend/durable/` | +| blockvolume startup/recovery/readiness | `cmd/blockvolume/main.go` | +| recovery sender/receiver/barrier | `core/recovery/` | +| transport lineage/session execution | `core/transport/` | +| authority/product projection | `core/host/master/`, `core/host/volume/` | +| ManagedVolume projection | `core/ops/managed_volume_model.go` | +| dirty-failure scenario | `helm-smartwal-corrupt-restart-chain.yaml` | + +Historical source material: + +- `design/methdology/01-problem-shape-and-method.md` +- `design/methdology/02-block-clump-initiator-target-session-lineage-barrier-recovery.md` +- `design/tutorial/09-recovery-walshipper-dual-lane.md` + +## Evidence Contract + +A recovery or dirty-failure gate needs stable facts such as: + +```text +wal_recovery_status= +wal_integrity_fault= +frontier_before= +frontier_after= +recovery_barrier_observed= +local_readiness_blocked= +publish_healthy_emitted= +operator_snapshot_ready_true_count=0 +reason= +``` + +For dirty corruption, evidence must also prove the injection was real: + +```text +target_offset_inside_wal=true +target_offset_inside_extent=false +mutated_offset= +``` + +Otherwise the test can corrupt extent bytes or the wrong file and produce a +false sense of WAL coverage. + +## Failure Taxonomy + +| Failure | Meaning | Correct projection | +|---|---|---| +| `wal_integrity_fault` | committed WAL record failed integrity check | not Ready; ideally Blocked with reason | +| `recovery_barrier_missing` | recovery stream did not close with terminal evidence | not Ready | +| `frontier_unknown` | durable progress boundary cannot be established | Unknown | +| `stale_lineage` | old session/frame/callback belongs to previous generation | reject/fail closed | +| `primary_readiness_missing` | assigned primary exists but did not positively publish readiness | Unknown | +| `status_endpoint_unreachable` | cannot collect fresh evidence | Unknown/EvidenceStale | + +## Implementation Checklist + +When changing recovery or persistence: + +1. Identify the fact source: storage record, recovery barrier, authority epoch, + or status endpoint. +2. Define the safe frontier and what evidence advances it. +3. Decide whether a fault is a safe torn tail or an unsafe mid-history fault. +4. Make the storage layer return a typed failure for unsafe faults. +5. Ensure `blockvolume` does not publish healthy after typed failure. +6. Ensure blockmaster projection requires positive primary readiness. +7. Ensure operator/status/report cannot convert missing positive evidence into + `Ready=True`. +8. Add a dirty-failure gate that proves the injection hits the intended layout. +9. Verify cleanup leaves no storage/process/Kubernetes residue. + +## QA History + +| Gate / phase | What it proved | +|---|---| +| Phase 34 D4 initial failure | real SmartWAL corruption was detected but surfaced false Ready | +| storage fix | mid-history CRC mismatch failed closed instead of being skipped | +| blockvolume fix | durable recovery fault blocked local readiness | +| projection fix | blockmaster stopped treating heartbeat/assignment as Ready | +| Phase 34 D4 strict pass | no false Ready after corruption; cleanup clean | + +## Non-Claims + +- This page does not claim all WAL corruption modes are recoverable. +- It does not claim unconditional no data loss under arbitrary power failure. +- It does not define returned-replica rebuild by itself. +- It does not allow readiness to be inferred from process liveness. diff --git a/seaweed-block/docs/wiki/topic-inventory.md b/seaweed-block/docs/wiki/topic-inventory.md index f995fd6ec6..d646c3f003 100644 --- a/seaweed-block/docs/wiki/topic-inventory.md +++ b/seaweed-block/docs/wiki/topic-inventory.md @@ -37,8 +37,8 @@ Status meanings: | lifecycle-owner finalizer add/release | deep | operation layer page | | Kubernetes VAP/RBAC admission boundary | summary | operation layer page | | delete-safety state machine | tutorial | state machines + operation layer | -| cleanup verifier / residue taxonomy | mapped | state machines + coverage matrix | -| node readiness / CSI evidence | mapped | coverage matrix | +| cleanup verifier / residue taxonomy | mapped | state machines + support bundle page | +| node readiness / CSI evidence | deep draft | `deep-dives/live-node-evidence.md` | | host prereq projection | mapped | Phase 37 D4/D5 docs | | loopback/cross-node blocker | mapped | Phase 37 D5 docs | | install drift status | mapped | roadmap/release docs | @@ -49,7 +49,7 @@ Status meanings: | Topic | Status | Current page | |---|---|---| -| WAL / frontier / barrier concepts | mapped | historical sources + SmartWAL page | +| WAL / frontier / barrier concepts | deep draft | `deep-dives/wal-frontier-recovery.md` | | SmartWAL dirty-failure path | tutorial | `deep-dives/smartwal-dirty-failure.md` | | SmartWAL file layout and corruption injection | summary | SmartWAL page | | durable root / hostPath persistence | mapped | roadmap/ref docs | @@ -90,7 +90,7 @@ Status meanings: | Topic | Status | Current page | |---|---|---| | ManagedVolume readiness | tutorial | `deep-dives/managed-volume-readiness.md` | -| support bundle / report / dashboard | mapped | coverage matrix | +| support bundle / report / dashboard | deep draft | `deep-dives/support-bundle-cold-reader.md` | | operator-snapshot.json | mapped | operations docs | | Events and reason-code vocabulary | mapped | release docs | | action model evaluator | mapped | protocol catalog | @@ -116,14 +116,13 @@ Status meanings: The highest-value missing or summary-only pages are: -1. WAL/frontier/barrier/recovery architecture. -2. support bundle/report/dashboard cold-reader path. -3. node readiness / CSI evidence. -4. release engineering and image/chart skew prevention. -5. CRD schema/RBAC/envtest conformance. -6. NVMe-oF / ANA background. -7. blockvolume process layout and frontend readiness. -8. runner action reference. +1. CRD schema/RBAC/envtest conformance. +2. release engineering and image/chart skew prevention. +3. NVMe-oF / ANA background. +4. blockvolume process layout and frontend readiness. +5. runner action reference. +6. WAL SmartWAL file-layout detail diagrams. +7. support bundle artifact examples from real runs. ## Review Rule diff --git a/seaweed-block/mkdocs.yml b/seaweed-block/mkdocs.yml index 2657e8aadf..df586c6a73 100644 --- a/seaweed-block/mkdocs.yml +++ b/seaweed-block/mkdocs.yml @@ -47,8 +47,11 @@ nav: - Operation Layer v0.5: wiki/deep-dives/operation-layer-v05.md - ManagedVolume Readiness: wiki/deep-dives/managed-volume-readiness.md - SmartWAL Dirty Failure: wiki/deep-dives/smartwal-dirty-failure.md + - WAL Frontier Recovery: wiki/deep-dives/wal-frontier-recovery.md - Authority And Promotion: wiki/deep-dives/authority-promotion.md - iSCSI ALUA Multipath: wiki/deep-dives/iscsi-alua-multipath.md + - Live Node Evidence: wiki/deep-dives/live-node-evidence.md + - Support Bundle Cold Reader: wiki/deep-dives/support-bundle-cold-reader.md - Returned Replica Rebuild: wiki/deep-dives/returned-replica-rebuild.md - TestOps Authoring: wiki/deep-dives/testops-authoring.md - Product: