Files
seaweedfs/seaweed-block/docs/wiki/state-machines.md
T
pingqiuandClaude Opus 5.5 68045d9698 durable: remove the smartwal and parallel-walstore engines
- The provider refuses the removed names and, under every selector and
  before any selector comparison, a volume carrying their magic (SWAW;
  SWPW in either header slot), reading the file read-only and never
  modifying it. blockvolume --durable-impl and the launcher refuse the
  names with the same advice; the chart schema allows walstore only.
- core/storage/smartwal, core/storage/parallelwal and
  cmd/sw-block-testutil (whose one command corrupted smartwal records)
  are deleted, with the helm smartwal-corruption scenario and the
  parallel-walstore gate script.
- The replication harness runs on walstore; tests that ran on a removed
  engine only because a stub needed some store move to walstore, and the
  state_convergence label test moves to the in-memory BlockStore.
- sw-block cluster.check drops the removed engines' cases.
- Ledger: INV-OPEN-REMOVED-ENGINE-REFUSED-001 and
  INV-OPEN-REMOVED-ENGINE-NAME-REFUSED-001, an OpenRefused edge in M1, and
  the rows citing the removed tests updated. Docs: block-design 1.3 now
  describes the removal, the smartwal deep-dive and figure are gone, the
  scripts default to walstore, and the v1.1 notes carry the removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:38:54 -08:00

3.9 KiB

State Machines

Seaweed Block development should be driven by state machines and invariants, not by isolated helper scripts. This page names the states developers must preserve.

For runtime diagrams, see Runtime State Machines. Storage state machines are in the core design; HEAD, lease and snapshot state machines are in the agent workspace design.

Managed Volume Readiness

Ready
Blocked
Recovering
Recovered
EvidenceStale
CleanupRequired
Unknown

Negative-first rule:

missing, stale, unreachable, corrupt, or contradictory evidence must not become
Ready=True

Typical mappings:

Evidence Status
first volume verified Ready=True, reason first_volume_verified
CSI image pull failure Ready=False, Blocked=True, reason csi_node_image_pull_failed
status endpoint unreachable Ready=Unknown, EvidenceStale=True
WAL integrity fault not Ready; prefer reason wal_integrity_fault
cleanup residue CleanupRequired=True, delete-safety rejected

Node Readiness

Node status combines Kubernetes facts and product prerequisites:

Fact Expected projection
Kubernetes Ready false/unknown unknown/node_not_ready
Scheduling disabled blocked/node_scheduling_disabled
CSI driver not registered blocked/csi_driver_not_registered
CSI node pod not ready blocked/csi_node_pod_not_ready
CSI image missing blocked/image_missing_on_node
iSCSI prereq missing blocked/iscsi_prereq_missing
multipath prereq missing blocked/multipath_prereq_missing

Root cause should win over symptoms. For example, node NotReady should not be masked by CSI pod not ready.

Delete Safety

Delete-safety is evidence-driven:

stateDiagram-v2
  [*] --> Requested: delete timestamp observed
  Requested --> HoldUnknown: cleanup evidence missing or stale
  Requested --> HoldBlocked: residue evidence present
  HoldUnknown --> Releasable: fresh clean cleanup evidence
  HoldBlocked --> Releasable: residue cleared and fresh clean evidence
  Releasable --> Released: lifecycle-owner removes protection finalizer
  Released --> [*]: CR deletion completes
missing cleanup evidence -> unknown/requested -> hold finalizer
stale cleanup evidence -> unknown/requested -> hold finalizer
residue evidence -> rejected/blocked -> hold finalizer
clean fresh evidence -> allowed/releasable -> release protection finalizer

The lifecycle-owner never runs cleanup. It only consumes status already written by operator-status.

Finalizer Lifecycle

sequenceDiagram
  participant CSI
  participant CR as SwBlockVolume CR
  participant OS as operator-status
  participant LO as lifecycle-owner
  participant QA as cleanup evidence

  CSI->>CR: create/update identity spec after CreateVolume
  LO->>CR: add protection finalizer
  OS->>CR: publish Ready status and Events
  CR->>OS: deletionTimestamp observed
  OS->>QA: read cleanup-summary evidence
  OS->>CR: publish deleteSafety hold or releasable status
  LO->>CR: remove only protection finalizer if releasable
SwBlockVolume created
-> lifecycle-owner adds protection finalizer
-> delete requested
-> hold while deleteSafety is missing/stale/rejected
-> release only when deleteSafety is allowed/releasable
-> remove only block.seaweedfs.com/swblockvolume-protection
-> preserve foreign finalizers

Admission policy confines lifecycle-owner main-object patches to this finalizer shape.

Dirty-Failure Rule

The corruption gate of the (since removed) SmartWAL engine established the pattern:

detect corruption
-> fail closed in storage
-> block local readiness in blockvolume
-> require positive readiness before projection
-> never publish false Ready=True

This is the model for future dirty failures such as partial writes, stale replicas, and returned-replica rebuild.