Files
seaweedfs/seaweed-block/docs/persisted-state.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

11 KiB

Persisted state

Use this when: you upgrade in place, or you want to know what a process leaves on disk or in SeaweedFS.

Every state the product writes and reads back after a restart is listed here: the volume's remote image in SeaweedFS, blockmaster's own stores, the files a volume host keeps under --durable-root, and the files the sw-block commands write on a host. Each row says where the state lives, which process writes and reads it, how it is encoded and what a reader does with a version it does not know, whether a test pins the v1.0.0 bytes, and whether v1.0.1 changed it.

v1.0.1 adds no file, object kind, attribute or field to any store the daemons (blockmaster and blockvolume) read. A v1.0.1 daemon reads what v1.0.0 wrote, and writes the same encodings. The only new files are the ones the new sw-block commands write on a host (below); no daemon of v1.0.0 reads them. Two existing kinds are written in more situations (see What v1.0.1 writes differently).

"Pinned" means a test checks that v1.0.1 writes, and reads, the exact bytes v1.0.0 wrote for that state (fixtures under each package's testdata/golden-v1.0.0/ and core/storage/testdata/format_v3/).

The volume's remote image (SeaweedFS filer)

All under <chunk-path>/<volume>-<id8>/.

State Location Written by / read by Encoding; unknown version v1.0.0 bytes pinned Changed in v1.0.1
VOLUME record VOLUME blockmaster (create, restore) / every reader of the volume JSON with format (1); any other format, an unknown field or non-canonical bytes are refused yes no
HEAD HEAD (at most 64 KiB) the holder (blockvolume), blockmaster (create, restore, delete) / both JSON, no version field; strict: an unknown field or non-canonical bytes are refused. An entry without the layout kind attribute is refused as the pre-layout format yes: unclaimed, live with snapshots, open snapshot session, open cleaning session, detached, deleting no
Tombstone HEAD with state deleted blockmaster (delete, operator release) / both as HEAD yes no
Snapshots and their labels inside HEAD the holder / the holder part of HEAD yes (HEAD with snapshots) no
Root root/<sha256> the holder / the holder, restore readers binary, magic SWBROOT version 1; anything else is refused yes no
Segment seg/<shard>-<sha256> the holder / the holder, restore readers binary, magic SWBSEG version 2; anything else is refused yes no
Chunk pool/<index/10000>/<index>-<sha256> the holder / the holder, restore targets the chunk's bytes, named by their SHA-256 entry and attributes yes; payload bytes are the guest's no
Object attributes on every object entry: kind, volume, session, mark the holder / the holder strings; a wrong volume or kind is refused yes (a marked chunk, an unmarked root and segment) values only: roots and segments can now carry a mark (below)
Retention policy RETENTION sw-block ops chunk retain / the holder's maintenance JSON, no version; an unknown field is refused; absent means the default policy no no

blockmaster's stores

State Location Written by / read by Encoding; unknown version v1.0.0 bytes pinned Changed in v1.0.1
Volume authority (epoch, endpoint, lease, moves) <authority-store>/<volume>.v3auth.json blockmaster JSON envelope with version 1 and a checksum; an unknown version, an unknown field or a bad checksum skips that volume's record, and that volume is refused yes (plain and workspace lines) no
Lost ranges of forced moves <authority-store>/<volume>.lostrange.json blockmaster JSON with version 1; unknown version or bad checksum: the file is skipped yes, without the optional HEAD times no
Store attestations <authority-store>/store-attestations.json blockmaster JSON, no version; unknown fields are ignored yes, without the two optional flags no
Store lock <authority-store>/.sparrow-authority-lock blockmaster lock file holding the PID, for diagnosis only not needed no
Volume records <lifecycle-store>/volumes/<volume>.json blockmaster JSON, no version; unknown fields are ignored; an invalid record stops blockmaster at start. A restore target's record carries its source volume, source layout id, source snapshot and request id, as in v1.0.0 yes (a plain volume and a restore target) no; one more delete (below)
Node inventory <lifecycle-store>/nodes/<server>.json blockmaster JSON, no version; unknown fields are ignored yes no
Placements <lifecycle-store>/placements/<volume>.json blockmaster JSON, no version; unknown fields are ignored yes no
Workspace bindings <lifecycle-store>/workspace-bindings/bindings.json blockmaster JSON, no version; unknown fields are ignored yes no
Delete reservations <lifecycle-store>/deletion-reservations/reservations.json blockmaster JSON, no version; unknown fields are ignored yes no

A volume host's files

All under --durable-root unless the row says otherwise.

State Location Written by / read by Encoding; unknown version v1.0.0 bytes pinned Changed in v1.0.1
Descriptor slots A and B <volume>.bin, the first 8 KiB blockvolume binary, magic SWBK, slot version 3, implementation version 3, CRC32C; another version is refused yes no
Layout identity (claim id, fresh flag) inside each descriptor slot blockvolume bytes of the slot; a store without it is refused ("recreate it") no (the pinned slots carry no identity) no
Log (WAL) <volume>.bin, after the slots blockvolume binary records with CRC32C, bound to the descriptor; an unknown record type or bad CRC ends the valid log yes (write, batch, barrier, trim records) no
Extent <volume>.bin, after the log blockvolume the guest's blocks, no header nothing to pin no
Per-chunk map and its checkpoints <volume>.bin.chunkmap blockvolume binary pages and roots, version 1, and the slot's map format 1; anything else is refused yes no
Chunk presence <volume>.bin.chunkpresence blockvolume text lines absent N / local N; an unknown line is an error yes no
Epoch table <volume>.epoch-table blockvolume JSON with schema seaweed-block.epoch-table/v1, strict; a bad file refuses every role no no
Replica floor <volume>.replica-floor blockvolume JSON with schema seaweed-block.replica-floor/v1, strict no no
Host limit configuration <--host-limit-dir>/configuration.json, shared by the host's holders blockvolume JSON, compared byte for byte; a different configuration is refused no no
Lock files <volume>.lock; the host limit directory's lock and slot files blockvolume empty lock files not needed no

The experimental stores of v1.0.x (--durable-impl smartwal, parallel-walstore) are removed in v1.1. A <volume>.bin carrying their magic is refused at open, typed and unmodified: created by a removed experimental engine; copy the data to a walstore volume with v1.0.x first.

Files the sw-block commands write

New in v1.0.1, since the commands are. They are written by the sw-block command on the host, not by a daemon, and have no v1.0.0 bytes to pin.

File Written by Read by Format
/etc/sw-block/volumes/<volume>.env sudo sw-block volume start <volume> (mode 0640; replaced only with --replace, and only while the unit is stopped) the sw-blockvolume@<volume> unit, as its environment (EnvironmentFile=), and volume start itself on its next run KEY=value lines, sorted, values with spaces or quotes quoted
/etc/sw-block/volumes/<new>.env sudo sw-block volume restore <volume> --snapshot S --as <new> (through volume start's step, the same file and mode); removed by volume restore ... --abort, only after it confirmed that the file names exactly that restore's target as for volume start as for volume start; --abort accepts only SWB_VOLUME_EXTRA_ARGS="--layout-id <id>", the value volume start writes
<dir>/mini.json sw-block mini --dir <dir> (mode 0644) sw-block mini --reuse JSON: size, port shift, weed path, NQN, binary directory

sw-block volume backup writes no file on the host: its snapshot lives in the volume's HEAD, with the label sw-block-backup (the request) among the snapshot's labels. volume restore's record is blockmaster's existing restore target record (above); v1.0.1 only reports its restore tuple in GetVolume, without writing anything new.

The unit template sw-blockvolume@.service is shipped in deploy/systemd/ and installed by you; it is not written by a command.

Not persisted

  • Rebuilt after a restart: the holder's cut status, cleaning cursors and plans, snapshot schedule (a restart starts a fresh schedule; the snapshots it took are in HEAD), the HEAD write and maintenance counters on the status page, and blockmaster's observations, events and lease statistics.
  • Deleted unread at open: the cut's side files <volume>.bin.cut-cow-*.
  • Written for people, never read back: blockmaster's audit log, launcher manifests and profiles.

What v1.0.1 writes differently

  • Cleaning also removes unreferenced roots and segments. v1.0.0 cleaned only chunks. A v1.0.1 cleaning pass marks and removes root/ and seg/ objects that no live root or snapshot names. It uses the mark attribute every object entry already has, so the entry's encoding does not change.
  • A refused restore removes its own pending volume record. blockmaster deletes the record it made for a restore target when the restore is refused for good, with the same delete a volume delete uses.

Gaps

These states have no test pinning their v1.0.0 bytes: the retention policy, the layout identity in a descriptor slot, the epoch table, the replica floor and the host limit configuration. Their encodings did not change in v1.0.1. The pinned lost-range and attestation fixtures do not carry their optional fields, and no pinned entry is a marked root or segment.

Files without a version that are read with unknown fields ignored (blockmaster's volume records, node inventory, placements, bindings, reservations and store attestations) would lose a field an older binary does not know when it rewrites the file. v1.0.1 adds no field, so this does not arise between v1.0.0 and v1.0.1.