docs: persisted state, the list an in-place upgrade rests on

Every state the product writes and reads back after a restart, in three
groups (the volume's remote image, blockmaster's stores, a volume host's
files): where it lives, who writes and reads it, its encoding and what a
reader does with an unknown version, whether a test pins the v1.0.0 bytes,
and whether v1.0.1 changed it. The upgrade page's format sentence now covers
all three groups and links the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-29 02:09:36 -08:00
1 parent 8e131ca2b0
commit cff31f5ab2
2 files changed
+97 -2

No files matched your search

+93
View File
@@ -0,0 +1,93 @@
# 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, in three groups: the volume's remote
image in SeaweedFS, blockmaster's own stores, and the files a volume host keeps under `--durable-root`. 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 of them.** A v1.0.1 process reads what v1.0.0 wrote,
and writes the same encodings. Two existing kinds are written in more situations (see
[What v1.0.1 writes differently](#what-v101-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](#what-v101-writes-differently)) |
| 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 | yes | no; one more delete ([below](#what-v101-writes-differently)) |
| 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 (`--durable-impl smartwal`, `parallel-walstore`) have their own magic and version in
`<volume>.bin`, refuse other versions, and are not pinned. They are experimental; smartwal does not support the
chunk layer.
## 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.
+4 -2
View File
@@ -3,8 +3,10 @@
**Use this when:** you run v1.0.0 single-replica volumes (`--durable-impl walstore-chunk`, standalone under systemd)
and move them to v1.0.1.
**Format:** v1.0.1 makes no format change in a volume's remote image (its chunks, roots and HEAD in SeaweedFS) or
in its log. There is no conversion step and no flag to set.
**Format:** v1.0.1 makes no format change in anything it stores: a volume's remote image (its chunks, roots and
HEAD in SeaweedFS), blockmaster's stores, and the volume host's files (its log included).
[Persisted state](persisted-state.md) lists each one, how it is encoded and which ones a test pins to the v1.0.0
bytes. There is no conversion step and no flag to set.
## Order