mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
Merge pull request #179 from seaweedfs/docs/cleanup-and-design
docs: delete outdated docs, simplify the rest, and split the design reference with diagrams
This commit is contained in:
commit
84aa2146a3
34 files changed
+1434
-2671
No files matched your search
+10
-6
@@ -31,9 +31,11 @@ current: a deposed primary refuses I/O once it observes the new assignment or
|
||||
a fence, or once its workspace lease expires. That is a local admission rule,
|
||||
not an instant global revocation. Separately, every remote HEAD publish is a
|
||||
conditional update on `{gen, epoch}`, so the store refuses a stale holder's
|
||||
publish even before that holder notices it was replaced. The [design
|
||||
reference](docs/design/block-design.md) covers each part, its invariants, the
|
||||
tests behind them and the known issues.
|
||||
publish even before that holder notices it was replaced. The design is in
|
||||
three documents: the [core design](docs/design/block-design.md), the [agent
|
||||
workspace design](docs/design/agent-workspace-design.md) and the [Kubernetes
|
||||
block design](docs/design/kubernetes-block-design.md). Each covers its parts,
|
||||
their invariants, the tests behind them and the known issues.
|
||||
|
||||
## Highlights
|
||||
|
||||
@@ -195,7 +197,7 @@ run evidence: [release notes](docs/releases/README.md).
|
||||
- **CI** runs `go build`, `go vet` and `go test -short` on every pull request
|
||||
and push to `main` ([workflow](.github/workflows/test.yml)). Crash,
|
||||
mutation, real-SeaweedFS and binary tests are described in the
|
||||
[design reference, Part 3](docs/design/block-design.md#part-3-verification-lessons-known-issues),
|
||||
[core design, Part 2](docs/design/block-design.md#part-2-verification-lessons-known-issues),
|
||||
with the known issues.
|
||||
- **Formal models**: [TLA+ specifications](docs/spec/README.md) of the
|
||||
protocols where a bug would lose data. Counterexamples became fixes and
|
||||
@@ -206,12 +208,14 @@ run evidence: [release notes](docs/releases/README.md).
|
||||
|
||||
## Documentation
|
||||
|
||||
- Design: [design reference](docs/design/block-design.md), [TLA+ specifications](docs/spec/README.md),
|
||||
- Design: [core](docs/design/block-design.md), [agent workspace](docs/design/agent-workspace-design.md),
|
||||
[Kubernetes block](docs/design/kubernetes-block-design.md), [TLA+ specifications](docs/spec/README.md),
|
||||
[workspace measurements](docs/workspace-measurements.md)
|
||||
- Operations: [standalone deployment](docs/standalone-deployment.md),
|
||||
[Kubernetes quickstart](docs/quickstart-kubernetes.md), [user capabilities](docs/user-capabilities.md)
|
||||
- Claims: [Kubernetes status](docs/kubernetes-status.md), [release notes](docs/releases/README.md),
|
||||
[NVMe/TCP supported-lab claim](docs/releases/nvme-tcp-supported-lab.md), [roadmap](docs/roadmap.md)
|
||||
[NVMe/TCP supported-lab claim](docs/releases/nvme-tcp-supported-lab.md),
|
||||
[known issues and work in progress](docs/design/block-design.md#24-known-issues-and-work-in-progress)
|
||||
- Engineering references, not release-claim sources: [architecture](docs/architecture.md),
|
||||
[developer architecture](docs/developer-architecture.md), [runtime state machines](docs/runtime-state-machines.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="720" viewBox="0 0 1200 720" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif">
|
||||
<title>smartwal (experimental) layout: data written in place in the extent, plus a ring of 32-byte metadata records indexed by LSN modulo capacity</title>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#475569"/>
|
||||
</marker>
|
||||
<marker id="arrowR" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#b91c1c"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<rect width="1200" height="720" rx="18" fill="#f8fafc"/>
|
||||
|
||||
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">smartwal · in-place data plus a metadata record ring</text>
|
||||
<rect x="790" y="30" width="140" height="28" rx="14" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="860" y="49" font-size="13" font-weight="700" fill="#92400e" text-anchor="middle">EXPERIMENTAL</text>
|
||||
<text x="40" y="80" font-size="15" fill="#475569">Not a default and no chunk snapshots · core/storage/smartwal/store.go (Store), record.go, ring.go, recovery.go</text>
|
||||
|
||||
<!-- file regions -->
|
||||
<text x="40" y="122" font-size="14" font-weight="700" fill="#0f172a">File regions (not to scale)</text>
|
||||
<rect x="40" y="134" width="170" height="74" rx="8" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="125" y="164" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">header</text>
|
||||
<text x="125" y="184" font-size="12" fill="#4338ca" text-anchor="middle">4 KiB · offset 0</text>
|
||||
<rect x="214" y="134" width="360" height="74" rx="8" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="394" y="164" font-size="14" font-weight="600" fill="#92400e" text-anchor="middle">record ring</text>
|
||||
<text x="394" y="184" font-size="12" fill="#b45309" text-anchor="middle">slots × 32 bytes (65,536 slots = 2 MiB default)</text>
|
||||
<rect x="578" y="134" width="582" height="74" rx="8" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="869" y="164" font-size="14" font-weight="600" fill="#065f46" text-anchor="middle">extent: the data, written in place</text>
|
||||
<text x="869" y="184" font-size="12" fill="#047857" text-anchor="middle">numBlocks × BlockSize · reads always come from here</text>
|
||||
|
||||
<!-- record byte map: 30 px per byte, x0 = 120 -->
|
||||
<rect x="40" y="232" width="1120" height="170" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="260" font-size="15" font-weight="700" fill="#0f172a">One ring slot: a 32-byte record (record.go encode)</text>
|
||||
<rect x="120" y="280" width="30" height="44" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<rect x="150" y="280" width="30" height="44" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<rect x="180" y="280" width="60" height="44" fill="#f1f5f9" stroke="#cbd5e1"/>
|
||||
<rect x="240" y="280" width="120" height="44" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<rect x="360" y="280" width="240" height="44" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<rect x="600" y="280" width="240" height="44" fill="#f1f5f9" stroke="#cbd5e1"/>
|
||||
<rect x="840" y="280" width="120" height="44" fill="#d1fae5" stroke="#10b981"/>
|
||||
<rect x="960" y="280" width="120" height="44" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<text x="135" y="307" font-size="10.5" fill="#312e81" text-anchor="middle">mg</text>
|
||||
<text x="165" y="307" font-size="10.5" fill="#312e81" text-anchor="middle">fl</text>
|
||||
<text x="210" y="307" font-size="10.5" fill="#64748b" text-anchor="middle">rsv</text>
|
||||
<text x="300" y="307" font-size="12" font-weight="600" fill="#92400e" text-anchor="middle">LBA u32</text>
|
||||
<text x="480" y="307" font-size="12" font-weight="600" fill="#92400e" text-anchor="middle">LSN u64</text>
|
||||
<text x="720" y="307" font-size="12" fill="#64748b" text-anchor="middle">reserved2 (zero)</text>
|
||||
<text x="900" y="307" font-size="12" font-weight="600" fill="#065f46" text-anchor="middle">dataCRC32</text>
|
||||
<text x="1020" y="307" font-size="12" font-weight="600" fill="#312e81" text-anchor="middle">recCRC32</text>
|
||||
<text x="120" y="340" font-size="11" fill="#64748b" text-anchor="middle">0</text>
|
||||
<text x="150" y="340" font-size="11" fill="#64748b" text-anchor="middle">1</text>
|
||||
<text x="180" y="340" font-size="11" fill="#64748b" text-anchor="middle">2</text>
|
||||
<text x="240" y="340" font-size="11" fill="#64748b" text-anchor="middle">4</text>
|
||||
<text x="360" y="340" font-size="11" fill="#64748b" text-anchor="middle">8</text>
|
||||
<text x="600" y="340" font-size="11" fill="#64748b" text-anchor="middle">16</text>
|
||||
<text x="840" y="340" font-size="11" fill="#64748b" text-anchor="middle">24</text>
|
||||
<text x="960" y="340" font-size="11" fill="#64748b" text-anchor="middle">28</text>
|
||||
<text x="1080" y="340" font-size="11" fill="#64748b" text-anchor="middle">32</text>
|
||||
<text x="60" y="366" font-size="12" fill="#334155">mg = magic 0xAC (anything else is an empty slot) · fl = flags (write 0x01, trim 0x02, barrier 0x04) · rsv = reserved · little-endian</text>
|
||||
<text x="60" y="386" font-size="12" fill="#334155">dataCRC32 = CRC32 of the data block in the extent · recCRC32 = CRC32 of bytes 0..27 · slot index = LSN mod capacity (ring.go appendAt)</text>
|
||||
|
||||
<!-- write order -->
|
||||
<text x="40" y="440" font-size="15" font-weight="700" fill="#0f172a">Write order (Store.writeAt) and Sync</text>
|
||||
<rect x="40" y="454" width="250" height="96" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5"/>
|
||||
<text x="56" y="480" font-size="13.5" font-weight="700" fill="#0f172a">1 · read the old block</text>
|
||||
<text x="56" y="502" font-size="12" fill="#334155">kept in memory for rollback</text>
|
||||
<rect x="320" y="454" width="250" height="96" rx="10" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="336" y="480" font-size="13.5" font-weight="700" fill="#065f46">2 · pwrite data in place</text>
|
||||
<text x="336" y="502" font-size="12" fill="#334155">the extent slot of the LBA</text>
|
||||
<rect x="600" y="454" width="250" height="96" rx="10" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="616" y="480" font-size="13.5" font-weight="700" fill="#92400e">3 · append the record</text>
|
||||
<text x="616" y="502" font-size="12" fill="#334155">slot = LSN mod capacity; on failure</text>
|
||||
<text x="616" y="520" font-size="12" fill="#334155">the old block is written back</text>
|
||||
<rect x="880" y="454" width="280" height="96" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="896" y="480" font-size="13.5" font-weight="700" fill="#312e81">4 · Sync: one fsync</text>
|
||||
<text x="896" y="502" font-size="12" fill="#334155">covers data and record together</text>
|
||||
<text x="896" y="520" font-size="12" fill="#334155">(same file)</text>
|
||||
<line x1="291" y1="502" x2="318" y2="502" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="571" y1="502" x2="598" y2="502" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="851" y1="502" x2="878" y2="502" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- crash window -->
|
||||
<path d="M585,556 L585,580" stroke="#b91c1c" stroke-width="2" marker-end="url(#arrowR)"/>
|
||||
<rect x="380" y="586" width="410" height="50" rx="10" fill="#fef2f2" stroke="#ef4444" stroke-width="1.5"/>
|
||||
<text x="585" y="607" font-size="12.5" font-weight="700" fill="#991b1b" text-anchor="middle">Known crash window between 2 and 3</text>
|
||||
<text x="585" y="625" font-size="11.5" fill="#991b1b" text-anchor="middle">extent newer than the ring: CRC check fails, volume does not open</text>
|
||||
|
||||
<!-- recovery -->
|
||||
<rect x="40" y="652" width="1120" height="52" rx="10" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="676" font-size="12.5" font-weight="700" fill="#0f172a">Recovery (runRecoveryCounting):</text>
|
||||
<text x="280" y="676" font-size="12.5" fill="#334155">scan every slot (a bad recCRC is skipped and counted as a warning) → highest LSN per LBA →</text>
|
||||
<text x="280" y="694" font-size="12.5" fill="#334155">check the extent block against dataCRC32; a mismatch fails closed as a WAL integrity failure → frontier = highest verified LSN</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.1 KiB |
@@ -0,0 +1,177 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="940" viewBox="0 0 1200 940" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif">
|
||||
<title>walstore on-disk layout: a 4 KiB superblock, a circular WAL and a block-indexed extent in one file, the WAL record format, and the write, Sync, flush, checkpoint and recovery path</title>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#475569"/>
|
||||
</marker>
|
||||
<marker id="arrowG" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#0f766e"/>
|
||||
</marker>
|
||||
<pattern id="pad" width="8" height="8" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
||||
<rect width="8" height="8" fill="#fef3c7"/>
|
||||
<line x1="0" y1="0" x2="0" y2="8" stroke="#f59e0b" stroke-width="3"/>
|
||||
</pattern>
|
||||
</defs>
|
||||
|
||||
<rect width="1200" height="940" rx="18" fill="#f8fafc"/>
|
||||
|
||||
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">walstore · on-disk layout and write path</text>
|
||||
<text x="40" y="80" font-size="15" fill="#475569">One preallocated file per volume replica · core/storage/walstore.go (WALStore), superblock.go, wal_entry.go, wal_writer.go</text>
|
||||
|
||||
<!-- Band A: file regions -->
|
||||
<text x="40" y="122" font-size="14" font-weight="700" fill="#0f172a">File regions (not to scale)</text>
|
||||
<rect x="40" y="134" width="170" height="74" rx="8" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="125" y="164" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">superblock</text>
|
||||
<text x="125" y="184" font-size="12" fill="#4338ca" text-anchor="middle">4 KiB · offset 0</text>
|
||||
<rect x="214" y="134" width="420" height="74" rx="8" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="424" y="164" font-size="14" font-weight="600" fill="#92400e" text-anchor="middle">circular WAL</text>
|
||||
<text x="424" y="184" font-size="12" fill="#b45309" text-anchor="middle">WALSize bytes (64 MiB default) · offset 4096</text>
|
||||
<rect x="638" y="134" width="522" height="74" rx="8" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="899" y="164" font-size="14" font-weight="600" fill="#065f46" text-anchor="middle">extent</text>
|
||||
<text x="899" y="184" font-size="12" fill="#047857" text-anchor="middle">VolumeSize bytes · offset 4096 + WALSize · one slot per block (LBA × BlockSize)</text>
|
||||
|
||||
<!-- Band B left: superblock fields -->
|
||||
<rect x="40" y="232" width="360" height="300" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="260" font-size="15" font-weight="700" fill="#0f172a">Superblock fields</text>
|
||||
<text x="60" y="284" font-size="12.5" fill="#334155">Magic "SWBK" · Version 2 · Flags · UUID</text>
|
||||
<text x="60" y="306" font-size="12.5" fill="#334155">VolumeSize · ExtentSize · BlockSize (4096)</text>
|
||||
<text x="60" y="328" font-size="12.5" fill="#334155">WALOffset (must be 4096) · WALSize</text>
|
||||
<text x="60" y="350" font-size="12.5" font-weight="600" fill="#92400e">WALHead · WALTail</text>
|
||||
<text x="60" y="368" font-size="11.5" fill="#64748b">monotonic logical byte cursors; position = cursor mod WALSize</text>
|
||||
<text x="60" y="392" font-size="12.5" font-weight="600" fill="#065f46">WALCheckpointLSN</text>
|
||||
<text x="60" y="410" font-size="11.5" fill="#64748b">highest LSN durably in the extent; replay skips LSN ≤ it</text>
|
||||
<text x="60" y="434" font-size="12.5" fill="#334155">CreatedAt · ImplKind (1 = walstore) · ImplVersion</text>
|
||||
<line x1="60" y1="452" x2="380" y2="452" stroke="#e2e8f0"/>
|
||||
<text x="60" y="474" font-size="11.5" fill="#64748b">96 bytes encoded, rest of the 4 KiB is zero (writeTo).</text>
|
||||
<text x="60" y="492" font-size="11.5" fill="#64748b">Wrong magic, version or ImplKind refuses to open.</text>
|
||||
<text x="60" y="510" font-size="11.5" fill="#64748b">No checksum over the superblock (known issue).</text>
|
||||
|
||||
<!-- Band B right: WAL ring -->
|
||||
<rect x="420" y="232" width="740" height="300" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="440" y="260" font-size="15" font-weight="700" fill="#0f172a">WAL region, physical view [0, WALSize)</text>
|
||||
|
||||
<!-- ring strip y 284..324 -->
|
||||
<rect x="440" y="304" width="50" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="465" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r9</text>
|
||||
<rect x="490" y="304" width="50" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="515" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r10</text>
|
||||
<rect x="540" y="304" width="210" height="40" fill="#f1f5f9" stroke="#cbd5e1"/>
|
||||
<text x="645" y="329" font-size="11.5" fill="#64748b" text-anchor="middle">reusable (released)</text>
|
||||
<rect x="750" y="304" width="60" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="780" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r4</text>
|
||||
<rect x="810" y="304" width="60" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="840" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r5</text>
|
||||
<rect x="870" y="304" width="60" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="900" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r6</text>
|
||||
<rect x="930" y="304" width="60" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="960" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r7</text>
|
||||
<rect x="990" y="304" width="60" height="40" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="1020" y="329" font-size="11.5" fill="#92400e" text-anchor="middle">r8</text>
|
||||
<rect x="1050" y="304" width="90" height="40" fill="url(#pad)" stroke="#f59e0b"/>
|
||||
<text x="1095" y="329" font-size="11.5" font-weight="600" fill="#92400e" text-anchor="middle">padding</text>
|
||||
|
||||
<!-- markers -->
|
||||
<line x1="540" y1="296" x2="540" y2="356" stroke="#0f172a" stroke-width="2"/>
|
||||
<text x="540" y="372" font-size="12" font-weight="700" fill="#0f172a" text-anchor="middle">head</text>
|
||||
<line x1="750" y1="296" x2="750" y2="356" stroke="#0f172a" stroke-width="2"/>
|
||||
<text x="750" y="372" font-size="12" font-weight="700" fill="#0f172a" text-anchor="middle">durable tail</text>
|
||||
<!-- wrap arrow -->
|
||||
<path d="M1140,302 C1150,286 1000,288 800,290 C600,292 470,286 448,300" fill="none" stroke="#475569" stroke-width="1.4" stroke-dasharray="5 4" marker-end="url(#arrow)"/>
|
||||
<text x="1140" y="284" font-size="11" fill="#64748b" text-anchor="end">wrap: a record that does not fit at the end is preceded by padding and starts at 0</text>
|
||||
|
||||
<text x="440" y="398" font-size="12.5" fill="#334155">Retained window [tail, head): records recovery may still need. Space used = head − durable tail.</text>
|
||||
<text x="440" y="418" font-size="12.5" fill="#334155">Bytes are reused only after an fsynced superblock releases them (walWriter.spaceUsed, tailPersisted).</text>
|
||||
|
||||
<!-- record format -->
|
||||
<text x="440" y="444" font-size="13" font-weight="700" fill="#0f172a">One WAL record (wal_entry.go)</text>
|
||||
<rect x="440" y="454" width="56" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="468" y="474" font-size="11" fill="#92400e" text-anchor="middle">LSN 8</text>
|
||||
<rect x="496" y="454" width="76" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="534" y="474" font-size="11" fill="#92400e" text-anchor="middle">Reserved 8</text>
|
||||
<rect x="572" y="454" width="52" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="598" y="474" font-size="11" fill="#92400e" text-anchor="middle">Type 1</text>
|
||||
<rect x="624" y="454" width="54" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="651" y="474" font-size="11" fill="#92400e" text-anchor="middle">Flags 1</text>
|
||||
<rect x="678" y="454" width="54" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="705" y="474" font-size="11" fill="#92400e" text-anchor="middle">LBA 8</text>
|
||||
<rect x="732" y="454" width="68" height="32" fill="#fef3c7" stroke="#f59e0b"/>
|
||||
<text x="766" y="474" font-size="11" fill="#92400e" text-anchor="middle">Length 4</text>
|
||||
<rect x="800" y="454" width="200" height="32" fill="#ecfdf5" stroke="#10b981"/>
|
||||
<text x="900" y="474" font-size="11.5" fill="#065f46" text-anchor="middle">data (Length bytes)</text>
|
||||
<rect x="1000" y="454" width="64" height="32" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<text x="1032" y="474" font-size="11" fill="#312e81" text-anchor="middle">CRC32 4</text>
|
||||
<rect x="1064" y="454" width="76" height="32" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<text x="1102" y="474" font-size="11" fill="#312e81" text-anchor="middle">EntrySize 4</text>
|
||||
<text x="605" y="499" font-size="11" fill="#64748b" text-anchor="middle">prefix: 30 bytes</text>
|
||||
<text x="1070" y="499" font-size="11" fill="#64748b" text-anchor="middle">trailer: 8 bytes</text>
|
||||
<text x="440" y="520" font-size="11.5" fill="#64748b">Fixed overhead 38 bytes; CRC32 covers prefix and data; a one-block (4 KiB) write is a 4,134-byte record.</text>
|
||||
|
||||
<!-- Band C: write path -->
|
||||
<text x="40" y="572" font-size="15" font-weight="700" fill="#0f172a">Write path (Sync is the only durability point)</text>
|
||||
|
||||
<rect x="40" y="586" width="208" height="150" rx="10" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="56" y="610" font-size="13.5" font-weight="700" fill="#92400e">1 · Write</text>
|
||||
<text x="56" y="632" font-size="12" fill="#334155">assign the next LSN</text>
|
||||
<text x="56" y="652" font-size="12" fill="#334155">pwrite the record at head</text>
|
||||
<text x="56" y="672" font-size="12" fill="#334155">dirty map: LBA → record, LSN</text>
|
||||
<text x="56" y="700" font-size="11.5" fill="#b45309">not durable yet</text>
|
||||
<text x="56" y="718" font-size="11" fill="#64748b">WALStore.Write</text>
|
||||
|
||||
<rect x="268" y="586" width="208" height="150" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="284" y="610" font-size="13.5" font-weight="700" fill="#312e81">2 · Sync (FLUSH / FUA)</text>
|
||||
<text x="284" y="632" font-size="12" fill="#334155">group commit: one fsync</text>
|
||||
<text x="284" y="652" font-size="12" fill="#334155">for many callers (wait ≤ 1 ms</text>
|
||||
<text x="284" y="672" font-size="12" fill="#334155">or 64 waiters); no extent copy</text>
|
||||
<text x="284" y="700" font-size="11.5" fill="#4338ca">returns the synced frontier</text>
|
||||
<text x="284" y="718" font-size="11" fill="#64748b">WALStore.Sync, group_commit.go</text>
|
||||
|
||||
<rect x="496" y="586" width="208" height="150" rx="10" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="512" y="610" font-size="13.5" font-weight="700" fill="#065f46">3 · Flusher (100 ms)</text>
|
||||
<text x="512" y="632" font-size="12" fill="#334155">snapshot the whole dirty map</text>
|
||||
<text x="512" y="652" font-size="12" fill="#334155">copy each still-current record</text>
|
||||
<text x="512" y="672" font-size="12" fill="#334155">to its extent slot; one fsync</text>
|
||||
<text x="512" y="700" font-size="11.5" fill="#047857">extent now holds the batch</text>
|
||||
<text x="512" y="718" font-size="11" fill="#64748b">flusher.flushOnceInternal</text>
|
||||
|
||||
<rect x="724" y="586" width="208" height="150" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="740" y="610" font-size="13.5" font-weight="700" fill="#312e81">4 · Checkpoint</text>
|
||||
<text x="740" y="632" font-size="12" fill="#334155">bitmap / metadata hooks first</text>
|
||||
<text x="740" y="652" font-size="12" fill="#334155">superblock: CheckpointLSN,</text>
|
||||
<text x="740" y="672" font-size="12" fill="#334155">head, released tail; fsync</text>
|
||||
<text x="740" y="700" font-size="11.5" fill="#4338ca">replay now starts later</text>
|
||||
<text x="740" y="718" font-size="11" fill="#64748b">persistCheckpointReleasing</text>
|
||||
|
||||
<rect x="952" y="586" width="208" height="150" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5"/>
|
||||
<text x="968" y="610" font-size="13.5" font-weight="700" fill="#0f172a">5 · Reuse</text>
|
||||
<text x="968" y="632" font-size="12" fill="#334155">writer may overwrite the</text>
|
||||
<text x="968" y="652" font-size="12" fill="#334155">released WAL bytes; flushed</text>
|
||||
<text x="968" y="672" font-size="12" fill="#334155">entries compare-and-deleted</text>
|
||||
<text x="968" y="700" font-size="11.5" fill="#475569">a newer write survives</text>
|
||||
<text x="968" y="718" font-size="11" fill="#64748b">tailPersisted, compareAndDelete</text>
|
||||
|
||||
<line x1="249" y1="660" x2="266" y2="660" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="477" y1="660" x2="494" y2="660" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="705" y1="660" x2="722" y2="660" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="933" y1="660" x2="950" y2="660" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
|
||||
<text x="40" y="760" font-size="12" fill="#475569">Read: a dirty-map hit reads the WAL record, otherwise the extent slot (WALStore.Read). A failed fsync is sticky: no later Sync, write or checkpoint until reopen.</text>
|
||||
|
||||
<!-- Band D: recovery -->
|
||||
<rect x="40" y="780" width="1120" height="134" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="808" font-size="15" font-weight="700" fill="#0f172a">Recovery after a crash (recovery.go recoverWAL, WALStore.Recover)</text>
|
||||
<rect x="60" y="822" width="248" height="72" rx="8" fill="#eef2ff" stroke="#6366f1"/>
|
||||
<text x="184" y="850" font-size="12.5" font-weight="600" fill="#312e81" text-anchor="middle">read the superblock</text>
|
||||
<text x="184" y="870" font-size="11.5" fill="#4338ca" text-anchor="middle">persisted tail, head, checkpoint</text>
|
||||
<rect x="332" y="822" width="248" height="72" rx="8" fill="#fffbeb" stroke="#f59e0b"/>
|
||||
<text x="456" y="850" font-size="12.5" font-weight="600" fill="#92400e" text-anchor="middle">scan [tail, head)</text>
|
||||
<text x="456" y="870" font-size="11.5" fill="#b45309" text-anchor="middle">stop at a bad CRC or a truncated record</text>
|
||||
<rect x="604" y="822" width="248" height="72" rx="8" fill="#ecfdf5" stroke="#10b981"/>
|
||||
<text x="728" y="850" font-size="12.5" font-weight="600" fill="#065f46" text-anchor="middle">skip LSN ≤ checkpoint</text>
|
||||
<text x="728" y="870" font-size="11.5" fill="#047857" text-anchor="middle">replay the rest by LSN (last writer wins)</text>
|
||||
<rect x="876" y="822" width="264" height="72" rx="8" fill="#f1f5f9" stroke="#94a3b8"/>
|
||||
<text x="1008" y="850" font-size="12.5" font-weight="600" fill="#0f172a" text-anchor="middle">persist rebuilt bounds</text>
|
||||
<text x="1008" y="870" font-size="11.5" fill="#475569" text-anchor="middle">before the first append; bad bounds fail closed</text>
|
||||
<line x1="309" y1="858" x2="330" y2="858" stroke="#0f766e" stroke-width="1.8" marker-end="url(#arrowG)"/>
|
||||
<line x1="581" y1="858" x2="602" y2="858" stroke="#0f766e" stroke-width="1.8" marker-end="url(#arrowG)"/>
|
||||
<line x1="853" y1="858" x2="874" y2="858" stroke="#0f766e" stroke-width="1.8" marker-end="url(#arrowG)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,72 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="600" viewBox="0 0 1200 600" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif">
|
||||
<title>walstore LSN watermarks on a timeline: checkpoint, synced frontier and newest written LSN, and which writes survive a crash</title>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#475569"/>
|
||||
</marker>
|
||||
<pattern id="unsynced" width="8" height="8" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
||||
<rect width="8" height="8" fill="#f1f5f9"/>
|
||||
<line x1="0" y1="0" x2="0" y2="8" stroke="#cbd5e1" stroke-width="3"/>
|
||||
</pattern>
|
||||
</defs>
|
||||
|
||||
<rect width="1200" height="600" rx="18" fill="#f8fafc"/>
|
||||
|
||||
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">walstore · LSN watermarks and what survives a crash</text>
|
||||
<text x="40" y="80" font-size="15" fill="#475569">Frontiers kept by WALStore (core/storage/walstore.go); on disk are only the WAL bytes and the superblock's WALCheckpointLSN</text>
|
||||
|
||||
<!-- markers above the line -->
|
||||
<line x1="470" y1="120" x2="470" y2="244" stroke="#065f46" stroke-width="2.2"/>
|
||||
<text x="470" y="112" font-size="13" font-weight="700" fill="#065f46" text-anchor="middle">checkpointLSN</text>
|
||||
<line x1="800" y1="140" x2="800" y2="244" stroke="#92400e" stroke-width="2.2"/>
|
||||
<text x="800" y="132" font-size="13" font-weight="700" fill="#92400e" text-anchor="middle">syncedLSN</text>
|
||||
<line x1="1010" y1="120" x2="1010" y2="244" stroke="#334155" stroke-width="2.2"/>
|
||||
<text x="1010" y="112" font-size="13" font-weight="700" fill="#334155" text-anchor="middle">walHead (newest written)</text>
|
||||
|
||||
<!-- LSN band -->
|
||||
<rect x="80" y="170" width="390" height="56" fill="#d1fae5" stroke="#10b981"/>
|
||||
<text x="275" y="196" font-size="13" font-weight="600" fill="#065f46" text-anchor="middle">1 … checkpoint</text>
|
||||
<text x="275" y="214" font-size="11.5" fill="#047857" text-anchor="middle">in the extent</text>
|
||||
<rect x="470" y="170" width="330" height="56" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="635" y="196" font-size="13" font-weight="600" fill="#92400e" text-anchor="middle">checkpoint … synced</text>
|
||||
<text x="635" y="214" font-size="11.5" fill="#b45309" text-anchor="middle">in the WAL, fsynced</text>
|
||||
<rect x="800" y="170" width="210" height="56" fill="url(#unsynced)" stroke="#94a3b8" stroke-dasharray="5 3"/>
|
||||
<text x="905" y="196" font-size="13" font-weight="600" fill="#334155" text-anchor="middle">synced … head</text>
|
||||
<text x="905" y="214" font-size="11.5" fill="#475569" text-anchor="middle">pwrite only</text>
|
||||
<line x1="80" y1="250" x2="1140" y2="250" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<text x="1140" y="272" font-size="12" fill="#475569" text-anchor="end">LSN</text>
|
||||
<text x="1075" y="204" font-size="12" fill="#64748b" text-anchor="middle">nextLSN →</text>
|
||||
|
||||
<!-- flush in progress bracket -->
|
||||
<path d="M470,262 L470,272 L690,272 L690,262" fill="none" stroke="#0f766e" stroke-width="1.6"/>
|
||||
<text x="580" y="290" font-size="12" font-weight="600" fill="#0f766e" text-anchor="middle">flush in progress</text>
|
||||
<text x="580" y="306" font-size="11" fill="#0f766e" text-anchor="middle">extent written and fsynced,</text>
|
||||
<text x="580" y="320" font-size="11" fill="#0f766e" text-anchor="middle">checkpoint not yet persisted</text>
|
||||
|
||||
<!-- RemoteLSN marker (workspace) -->
|
||||
<line x1="740" y1="226" x2="740" y2="262" stroke="#6366f1" stroke-width="2" stroke-dasharray="4 3"/>
|
||||
<text x="760" y="290" font-size="12" font-weight="600" fill="#4338ca">HEAD RemoteLSN (workspace only)</text>
|
||||
<text x="760" y="306" font-size="11" fill="#4338ca">the last cut H: always a synced LSN,</text>
|
||||
<text x="760" y="320" font-size="11" fill="#4338ca">independent of the checkpoint</text>
|
||||
|
||||
<!-- survival table -->
|
||||
<rect x="40" y="346" width="1120" height="230" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="376" font-size="15" font-weight="700" fill="#0f172a">After a crash (process kill or power cut without media corruption)</text>
|
||||
|
||||
<rect x="60" y="392" width="16" height="16" fill="#d1fae5" stroke="#10b981"/>
|
||||
<text x="88" y="405" font-size="13" font-weight="600" fill="#065f46">≤ checkpoint: survives.</text>
|
||||
<text x="270" y="405" font-size="12.5" fill="#334155">Read from the extent; recovery skips these records; their WAL bytes are released once that superblock is fsynced.</text>
|
||||
|
||||
<rect x="60" y="424" width="16" height="16" fill="#fde68a" stroke="#f59e0b"/>
|
||||
<text x="88" y="437" font-size="13" font-weight="600" fill="#92400e">≤ synced: survives.</text>
|
||||
<text x="270" y="437" font-size="12.5" fill="#334155">Acknowledged by Sync. Recovery replays them from the WAL into the dirty map by LSN (last writer wins).</text>
|
||||
|
||||
<rect x="60" y="456" width="16" height="16" fill="url(#unsynced)" stroke="#94a3b8"/>
|
||||
<text x="88" y="469" font-size="13" font-weight="600" fill="#334155">> synced: may be lost.</text>
|
||||
<text x="270" y="469" font-size="12.5" fill="#334155">Never acknowledged. A record that reached the disk intact is replayed; a torn one ends the scan of its range.</text>
|
||||
|
||||
<line x1="60" y1="488" x2="1140" y2="488" stroke="#e2e8f0"/>
|
||||
<text x="60" y="510" font-size="12" fill="#475569">A crash during a flush replays the same records again from the WAL: the tail was not released, so nothing is lost and replay is idempotent.</text>
|
||||
<text x="60" y="530" font-size="12" fill="#475569">The checkpoint is not ordered against syncedLSN: the flusher's own fsync also makes the records it copies durable (flusher.flushOnceInternal).</text>
|
||||
<text x="60" y="550" font-size="12" fill="#475569">After recovery, the synced frontier is the higher of the checkpoint and the highest valid record LSN; new writes continue above it (WALStore.Recover).</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.8 KiB |
@@ -0,0 +1,171 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="960" viewBox="0 0 1200 960" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif">
|
||||
<title>Agent workspace cut: the dirty chunk bitmap over 4 MiB chunk slots, the quiesced cut, immutable chunk uploads, the two-level manifest and the HEAD conditional update; a snapshot or fork copies only the HEAD root</title>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#475569"/>
|
||||
</marker>
|
||||
<marker id="arrowG" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#0f766e"/>
|
||||
</marker>
|
||||
<marker id="arrowI" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="#6366f1"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<rect width="1200" height="960" rx="18" fill="#f8fafc"/>
|
||||
|
||||
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">Agent workspace · dirty bitmap → cut → chunks → HEAD</text>
|
||||
<text x="40" y="80" font-size="15" fill="#475569">core/storage/chunk_layer.go (captureLocked), chunk_seam.go · core/frontend/chunkstore/manifest.go, chunk_remote.go, catalog.go</text>
|
||||
|
||||
<!-- Row 1: volume and dirty set -->
|
||||
<rect x="40" y="100" width="1120" height="200" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="60" y="128" font-size="15" font-weight="700" fill="#0f172a">Local volume (walstore), split into chunk slots</text>
|
||||
<text x="60" y="148" font-size="12" fill="#475569">chunk = 1024 blocks × 4 KiB = 4 MiB (defaultChunkBlocks × BlockSize) · chunk i holds blocks [1024·i, 1024·i + 1024)</text>
|
||||
|
||||
<g font-size="11.5" text-anchor="middle">
|
||||
<rect x="60" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="100" y="187" fill="#475569">c0</text>
|
||||
<rect x="144" y="162" width="80" height="40" rx="4" fill="#fde68a" stroke="#f59e0b"/><text x="184" y="187" fill="#92400e" font-weight="600">c1</text>
|
||||
<rect x="228" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="268" y="187" fill="#475569">c2</text>
|
||||
<rect x="312" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="352" y="187" fill="#475569">c3</text>
|
||||
<rect x="396" y="162" width="80" height="40" rx="4" fill="#fde68a" stroke="#f59e0b"/><text x="436" y="187" fill="#92400e" font-weight="600">c4</text>
|
||||
<rect x="480" y="162" width="80" height="40" rx="4" fill="#fde68a" stroke="#f59e0b"/><text x="520" y="187" fill="#92400e" font-weight="600">c5</text>
|
||||
<rect x="564" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="604" y="187" fill="#475569">c6</text>
|
||||
<rect x="648" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="688" y="187" fill="#475569">c7</text>
|
||||
<rect x="732" y="162" width="80" height="40" rx="4" fill="#fde68a" stroke="#f59e0b"/><text x="772" y="187" fill="#92400e" font-weight="600">c8</text>
|
||||
<text x="842" y="187" fill="#64748b">…</text>
|
||||
<rect x="872" y="162" width="80" height="40" rx="4" fill="#f1f5f9" stroke="#cbd5e1"/><text x="912" y="187" fill="#475569">c256</text>
|
||||
<text x="982" y="187" fill="#64748b">…</text>
|
||||
</g>
|
||||
<g font-size="13" font-weight="700" text-anchor="middle" font-family="Consolas, Menlo, monospace">
|
||||
<text x="100" y="228" fill="#94a3b8">0</text><text x="184" y="228" fill="#b45309">1</text><text x="268" y="228" fill="#94a3b8">0</text>
|
||||
<text x="352" y="228" fill="#94a3b8">0</text><text x="436" y="228" fill="#b45309">1</text><text x="520" y="228" fill="#b45309">1</text>
|
||||
<text x="604" y="228" fill="#94a3b8">0</text><text x="688" y="228" fill="#94a3b8">0</text><text x="772" y="228" fill="#b45309">1</text>
|
||||
<text x="912" y="228" fill="#94a3b8">0</text>
|
||||
</g>
|
||||
<text x="1012" y="190" font-size="12" font-weight="600" fill="#0f172a">chunk slots</text>
|
||||
<text x="1012" y="228" font-size="12" font-weight="600" fill="#b45309">dirty bitmap</text>
|
||||
<text x="60" y="256" font-size="12" fill="#334155">An extent write marks its chunk in memory, O(1), no I/O (OnExtentWrite). Dirty set = persisted bitmap ∪ chunks of WAL entries above the checkpoint.</text>
|
||||
<text x="60" y="276" font-size="12" fill="#334155">The bitmap is made durable before the checkpoint passes those WAL entries (BeforeCheckpointAdvance). It may over-report, never under-report.</text>
|
||||
|
||||
<!-- Row 2: cut pipeline -->
|
||||
<text x="40" y="334" font-size="15" font-weight="700" fill="#0f172a">The cut (captureLocked)</text>
|
||||
<g>
|
||||
<rect x="40" y="346" width="210" height="108" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="54" y="370" font-size="13" font-weight="700" fill="#312e81">1 · quiesce</text>
|
||||
<text x="54" y="392" font-size="12" fill="#334155">capture barrier (exclusive),</text>
|
||||
<text x="54" y="410" font-size="12" fill="#334155">Sync: H = synced LSN</text>
|
||||
<text x="54" y="436" font-size="11" fill="#64748b">large dirty sets pre-copy first</text>
|
||||
|
||||
<rect x="268" y="346" width="210" height="108" rx="10" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="282" y="370" font-size="13" font-weight="700" fill="#92400e">2 · copy</text>
|
||||
<text x="282" y="392" font-size="12" fill="#334155">read dirty chunks into</text>
|
||||
<text x="282" y="410" font-size="12" fill="#334155">buffers, SHA-256; release</text>
|
||||
<text x="282" y="436" font-size="11" fill="#64748b">pause = Sync + this copy</text>
|
||||
|
||||
<rect x="496" y="346" width="210" height="108" rx="10" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="510" y="370" font-size="13" font-weight="700" fill="#065f46">3 · upload changed</text>
|
||||
<text x="510" y="392" font-size="12" fill="#334155">intent first, then new keys</text>
|
||||
<text x="510" y="410" font-size="12" fill="#334155">(8 parallel by default)</text>
|
||||
<text x="510" y="436" font-size="11" fill="#64748b">same hash or all-zero: no upload</text>
|
||||
|
||||
<rect x="724" y="346" width="210" height="108" rx="10" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="738" y="370" font-size="13" font-weight="700" fill="#065f46">4 · segments</text>
|
||||
<text x="738" y="392" font-size="12" fill="#334155">rewrite only segments with</text>
|
||||
<text x="738" y="410" font-size="12" fill="#334155">changed chunks (intent first)</text>
|
||||
<text x="738" y="436" font-size="11" fill="#64748b">unchanged segments keep keys</text>
|
||||
|
||||
<rect x="952" y="346" width="208" height="108" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="966" y="370" font-size="13" font-weight="700" fill="#312e81">5 · CAS HEAD</text>
|
||||
<text x="966" y="392" font-size="12" fill="#334155">on {gen, epoch}; then drop</text>
|
||||
<text x="966" y="410" font-size="12" fill="#334155">intents, reset the bitmap</text>
|
||||
<text x="966" y="436" font-size="11" fill="#64748b">post-cut dirt stays set</text>
|
||||
|
||||
<line x1="251" y1="400" x2="266" y2="400" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="479" y1="400" x2="494" y2="400" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="707" y1="400" x2="722" y2="400" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<line x1="935" y1="400" x2="950" y2="400" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
</g>
|
||||
|
||||
<!-- Row 3: remote layout -->
|
||||
<rect x="40" y="480" width="1120" height="456" rx="14" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="60" y="508" font-size="15" font-weight="700" fill="#065f46">SeaweedFS: filer entries and immutable chunk objects</text>
|
||||
|
||||
<!-- HEAD v1 -->
|
||||
<rect x="60" y="524" width="300" height="214" rx="10" fill="#ffffff" stroke="#6366f1" stroke-width="1.8"/>
|
||||
<text x="76" y="548" font-size="13.5" font-weight="700" fill="#312e81">v1/HEAD (root, format 2)</text>
|
||||
<text x="76" y="572" font-size="12" fill="#334155">Gen g+1 · Epoch e · Holder A</text>
|
||||
<text x="76" y="592" font-size="12" fill="#334155">RemoteLSN H · State active</text>
|
||||
<text x="76" y="612" font-size="12" fill="#334155">ChunkBytes 4 MiB · ManifestChunkCount</text>
|
||||
<text x="76" y="636" font-size="12" font-weight="600" fill="#0f172a">Segments:</text>
|
||||
<text x="90" y="656" font-size="12" fill="#334155">0 → @v1/seg/n2 (new)</text>
|
||||
<text x="90" y="676" font-size="12" fill="#334155">1 → @v1/seg/n1 (unchanged)</text>
|
||||
<text x="76" y="702" font-size="11" fill="#64748b">{gen, epoch, holder} mirrored in</text>
|
||||
<text x="76" y="718" font-size="11" fill="#64748b">extended attributes for the CAS</text>
|
||||
|
||||
<!-- segments -->
|
||||
<rect x="420" y="524" width="330" height="104" rx="10" fill="#ffffff" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="436" y="548" font-size="13" font-weight="700" fill="#065f46">segment 0: @v1/seg/n2 (new)</text>
|
||||
<text x="436" y="568" font-size="11.5" fill="#047857">chunks 0–255 (1 GiB = 256 chunks)</text>
|
||||
<text x="436" y="588" font-size="11.5" fill="#334155">1 → k1', 4 → k4', 5 → k5', 8 → k8' (new keys)</text>
|
||||
<text x="436" y="606" font-size="11.5" fill="#334155">others → previous keys · absent index = zeros</text>
|
||||
|
||||
<rect x="420" y="640" width="330" height="98" rx="10" fill="#ffffff" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="436" y="664" font-size="13" font-weight="700" fill="#065f46">segment 1: @v1/seg/n1 (unchanged)</text>
|
||||
<text x="436" y="684" font-size="11.5" fill="#047857">chunks 256–511</text>
|
||||
<text x="436" y="704" font-size="11.5" fill="#334155">each entry: chunk key + SHA-256</text>
|
||||
<text x="436" y="722" font-size="11.5" fill="#334155">same object, same key as before the cut</text>
|
||||
|
||||
<line x1="361" y1="656" x2="418" y2="580" stroke="#0f766e" stroke-width="1.6" marker-end="url(#arrowG)"/>
|
||||
<line x1="361" y1="676" x2="418" y2="686" stroke="#0f766e" stroke-width="1.6" marker-end="url(#arrowG)"/>
|
||||
|
||||
<!-- chunk objects -->
|
||||
<text x="800" y="548" font-size="13" font-weight="700" fill="#065f46">Chunk objects (write-once)</text>
|
||||
<g>
|
||||
<rect x="800" y="560" width="54" height="30" rx="4" fill="#6ee7b7"/><text x="827" y="580" font-size="11" fill="#065f46" text-anchor="middle">k1'</text>
|
||||
<rect x="860" y="560" width="54" height="30" rx="4" fill="#6ee7b7"/><text x="887" y="580" font-size="11" fill="#065f46" text-anchor="middle">k4'</text>
|
||||
<rect x="920" y="560" width="54" height="30" rx="4" fill="#6ee7b7"/><text x="947" y="580" font-size="11" fill="#065f46" text-anchor="middle">k5'</text>
|
||||
<rect x="980" y="560" width="54" height="30" rx="4" fill="#6ee7b7"/><text x="1007" y="580" font-size="11" fill="#065f46" text-anchor="middle">k8'</text>
|
||||
<rect x="800" y="598" width="54" height="30" rx="4" fill="#a7f3d0"/><text x="827" y="618" font-size="11" fill="#065f46" text-anchor="middle">k1</text>
|
||||
<rect x="860" y="598" width="54" height="30" rx="4" fill="#a7f3d0"/><text x="887" y="618" font-size="11" fill="#065f46" text-anchor="middle">k4</text>
|
||||
<rect x="920" y="598" width="54" height="30" rx="4" fill="#a7f3d0"/><text x="947" y="618" font-size="11" fill="#065f46" text-anchor="middle">k2</text>
|
||||
<rect x="980" y="598" width="54" height="30" rx="4" fill="#a7f3d0"/><text x="1007" y="618" font-size="11" fill="#065f46" text-anchor="middle">…</text>
|
||||
</g>
|
||||
<text x="1046" y="580" font-size="11" fill="#047857">this cut</text>
|
||||
<text x="1046" y="618" font-size="11" fill="#047857">earlier cuts</text>
|
||||
<text x="800" y="652" font-size="11.5" fill="#334155">key: chunks/e<epoch>/c<idx>/<nonce>-<seq> (newKey)</text>
|
||||
<text x="800" y="670" font-size="11.5" fill="#334155">keys/<key> binds it to a needle; never rebound</text>
|
||||
<text x="800" y="688" font-size="11.5" fill="#334155">old versions stay while a snapshot or fork</text>
|
||||
<text x="800" y="706" font-size="11.5" fill="#334155">reaches them; GC reclaims the rest</text>
|
||||
<line x1="751" y1="588" x2="796" y2="576" stroke="#0f766e" stroke-width="1.4" marker-end="url(#arrowG)"/>
|
||||
<line x1="751" y1="700" x2="796" y2="616" stroke="#0f766e" stroke-width="1.4" marker-end="url(#arrowG)"/>
|
||||
|
||||
<!-- snapshot and fork -->
|
||||
<rect x="60" y="760" width="300" height="160" rx="10" fill="#ffffff" stroke="#94a3b8" stroke-width="1.5"/>
|
||||
<text x="76" y="784" font-size="13.5" font-weight="700" fill="#0f172a">Snapshot: v1/snaps/s1/<attempt></text>
|
||||
<text x="76" y="806" font-size="12" fill="#334155">an exclusive create holding a copy</text>
|
||||
<text x="76" y="824" font-size="12" fill="#334155">of the HEAD root; name claimed in</text>
|
||||
<text x="76" y="842" font-size="12" fill="#334155">snapnames/s1 first</text>
|
||||
<text x="76" y="870" font-size="12" font-weight="600" fill="#065f46">no segment or chunk is copied</text>
|
||||
|
||||
<rect x="420" y="760" width="330" height="160" rx="10" fill="#ffffff" stroke="#6366f1" stroke-width="1.8" stroke-dasharray="6 4"/>
|
||||
<text x="436" y="784" font-size="13.5" font-weight="700" fill="#312e81">Fork: v2/VOLUME + v2/HEAD</text>
|
||||
<text x="436" y="806" font-size="12" fill="#334155">VOLUME: origin fork, parent v1@s1</text>
|
||||
<text x="436" y="824" font-size="12" fill="#334155">HEAD: Gen 1 · Epoch 0 · no holder</text>
|
||||
<text x="436" y="842" font-size="12" fill="#334155">RemoteLSN and Segments copied from s1:</text>
|
||||
<text x="450" y="862" font-size="12" fill="#334155">0 → @v1/seg/n2 · 1 → @v1/seg/n1</text>
|
||||
<text x="436" y="890" font-size="12" font-weight="600" fill="#065f46">owner-qualified keys: v2 shares v1's objects</text>
|
||||
|
||||
<line x1="361" y1="840" x2="418" y2="840" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<text x="389" y="832" font-size="11" fill="#475569" text-anchor="middle">fork</text>
|
||||
<path d="M600,758 C600,746 560,746 560,732" fill="none" stroke="#6366f1" stroke-width="1.4" stroke-dasharray="4 3" marker-end="url(#arrowI)"/>
|
||||
<path d="M210,758 C210,748 210,748 210,740" fill="none" stroke="#94a3b8" stroke-width="1.4" stroke-dasharray="4 3" marker-end="url(#arrow)"/>
|
||||
<text x="222" y="752" font-size="11" fill="#64748b">copy of root</text>
|
||||
|
||||
<rect x="800" y="760" width="340" height="160" rx="10" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="816" y="784" font-size="13.5" font-weight="700" fill="#0f172a">Other filer entries per volume</text>
|
||||
<text x="816" y="808" font-size="12" fill="#334155">intents/<id>: keys about to be published;</text>
|
||||
<text x="816" y="826" font-size="12" fill="#334155">GC roots until the CAS outcome is known</text>
|
||||
<text x="816" y="850" font-size="12" fill="#334155">VOLUME: identity, geometry, lineage;</text>
|
||||
<text x="816" y="868" font-size="12" fill="#334155">write-once</text>
|
||||
<text x="816" y="892" font-size="12" fill="#334155">snapnames/<name>: name records</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,325 @@
|
||||
# Agent workspace disks: design
|
||||
|
||||
This document describes the Agent Block line: a local-speed block device for an agent sandbox or microVM, whose durability comes from snapshots in SeaweedFS. It covers how the code works, the invariants, where each is enforced, the tests, and what is not done yet.
|
||||
|
||||
**Status: proof of concept.** The chunk path (`blockvolume --durable-impl=walstore-chunk`) is not yet a default, a release claim or a production path.
|
||||
|
||||
The three design documents:
|
||||
|
||||
| Document | Covers |
|
||||
|---|---|
|
||||
| [Core design](block-design.md) | The shared core: frontends and the Backend contract, walstore, smartwal (experimental), durability and `Sync`, authority and epochs, the replication engine, recovery; verification, lessons and known issues across the codebase |
|
||||
| Agent workspace design (this document) | Agent workspace disks: one local replica per workspace, cuts to SeaweedFS, snapshots, forks, GC, host moves |
|
||||
| [Kubernetes block design](kubernetes-block-design.md) | Kubernetes block volumes (alpha): CSI, Helm, RF=2/3 replication and failover, multipath, readiness |
|
||||
|
||||
Conventions are those of the core document: code references name a file and a function, not a line number; test references name the test function and its file; "Model-checked" means the protocol was specified in TLA+ and checked exhaustively with TLC at small scale (the specifications are in [`docs/spec/`](../spec/README.md)).
|
||||
|
||||
## Contents
|
||||
|
||||
- [1. Composition](#1-composition)
|
||||
- [2. One replica; durability from cuts](#2-one-replica-durability-from-cuts)
|
||||
- [3. Remote layout](#3-remote-layout)
|
||||
- [4. Dirty tracking](#4-dirty-tracking)
|
||||
- [5. The cut](#5-the-cut)
|
||||
- [6. Snapshots, forks, retention, GC, volume delete](#6-snapshots-forks-retention-gc-volume-delete)
|
||||
- [7. Lease, takeover and host moves](#7-lease-takeover-and-host-moves)
|
||||
- [8. Security model](#8-security-model)
|
||||
- [9. Invariants](#9-invariants)
|
||||
- [10. Tests](#10-tests)
|
||||
- [11. Review directions](#11-review-directions)
|
||||
- [12. Lessons](#12-lessons)
|
||||
- [13. Measured results](#13-measured-results)
|
||||
- [14. Known gaps](#14-known-gaps)
|
||||
|
||||
---
|
||||
|
||||
## 1. Composition
|
||||
|
||||
<p align="center">
|
||||
<img src="../assets/seaweed-block-agent-workspace.svg" alt="Agent workspace disks: an agent microVM on host A writes to a blockvolume with a local WAL; cuts upload changed chunks to SeaweedFS, where a HEAD root, snapshots and forks share immutable chunks; another host can take over the HEAD" width="100%">
|
||||
</p>
|
||||
|
||||
An agent workspace disk is a composition of core parts plus a SeaweedFS chunk backend:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
G["guest microVM"] -->|"virtio-blk"| F["frontend: ublk or NVMe/TCP loopback"]
|
||||
F -->|"Read / Write / Sync"| W["local engine: walstore"]
|
||||
W -->|"dirty chunk bitmap"| C["chunk layer: quiesced cut"]
|
||||
C -->|"upload changed 4 MiB chunks, intents first"| S[("SeaweedFS: immutable chunks + segment manifests")]
|
||||
C -->|"CAS HEAD on {gen, epoch}"| H["HEAD root (about 2 KB)"]
|
||||
H -->|"snapshot / fork = copy the root"| H2["snapshot or forked volume"]
|
||||
M["blockmaster: epoch + lease"] -->|"higher epoch"| T["another host: claim HEAD, lazy-load chunks"]
|
||||
T --> H
|
||||
```
|
||||
|
||||
- **Frontend:** the same ublk and NVMe/TCP code as the Kubernetes line ([core §1.1](block-design.md#11-frontends-and-the-backend-contract)). NVMe/TCP binds to loopback (`cmd/blockvolume/main.go` `enforceFrontendLoopbackBind`); ublk serves `/dev/ublkbN` on the same host (`--ublk-device`). The guest sees a plain virtio block device that the hypervisor attaches.
|
||||
- **Local engine:** walstore only (`--durable-impl=walstore-chunk`, [core §1.2](block-design.md#12-walstore-wal-plus-extent)). `Sync` still means local durability; nothing on the write path waits for the network. smartwal does not support the chunk layer.
|
||||
- **Chunk layer:** `core/storage/chunk_layer.go` (`chunkLayerImpl`), attached under the walstore flusher; the contract is the header of `core/storage/chunk_seam.go`.
|
||||
- **Backend:** SeaweedFS. Chunk bytes live in volume servers; HEAD, key bindings, intents, volume records and snapshot records live in the filer (`core/frontend/chunkstore`).
|
||||
- **Authority:** blockmaster mints the epoch and grants a workspace lease ([core §1.5](block-design.md#15-authority-blockmaster-assignments-epochs-leases); §7 below).
|
||||
|
||||
## 2. One replica; durability from cuts
|
||||
|
||||
A workspace runs one replica (RF=1). It does not use the replication engine of the Kubernetes line; durability against host loss comes from cuts published to SeaweedFS.
|
||||
|
||||
| Event | What survives |
|
||||
|---|---|
|
||||
| Guest `fsync` returns | the write is in the local WAL (a covering `Sync`) |
|
||||
| Process crash or host restart | every synced write; local recovery replays the WAL ([core §1.2](block-design.md#12-walstore-wal-plus-extent)) |
|
||||
| Permanent host loss | the image at the last successful cut (HEAD `RemoteLSN`); writes after it are lost |
|
||||
| Clean move (Detach) | everything written before Detach: guest I/O is stopped, then Detach publishes a final cut before the host releases the volume |
|
||||
|
||||
- **When cuts happen.** At semantic points chosen by the integrator (after an agent step, before a risky command, on detach) and on explicit request (`sw-block ops chunk cut`). The periodic timer is off by default (`cmd/blockvolume/chunk_remote.go` `defaultChunkCaptureInterval = 0`); an operator may set one as a host-loss safety net. `--chunk-dirty-threshold` (default 512 chunks, 2 GiB) only bounds how much one cut copies under its barrier; it never triggers a cut.
|
||||
- **So the default RPO is unbounded** until the integrator cuts. This is a design choice for workspaces, where a cut at a semantic point is more useful than a timer.
|
||||
- Multi-replica workspaces combined with chunk snapshots are not supported.
|
||||
|
||||
## 3. Remote layout
|
||||
|
||||
<p align="center">
|
||||
<img src="../assets/workspace-cut-manifest.svg" alt="Dirty bitmap over 4 MiB chunk slots; the five steps of a cut; in SeaweedFS the HEAD root lists segment references, each segment lists chunk keys with SHA-256, chunk objects are write-once; a snapshot copies the root and a fork writes a new VOLUME and a HEAD at gen 1, epoch 0 with the same segment references" width="100%">
|
||||
</p>
|
||||
|
||||
Per volume, under the chunk base directory in the filer (`core/frontend/chunkstore/catalog.go` header, `chunk_remote.go` header):
|
||||
|
||||
| Entry | Content | Written |
|
||||
|---|---|---|
|
||||
| `HEAD` | the published state as JSON; `{gen, epoch, holder}` mirrored in extended attributes (`swb.gen`, `swb.epoch`, `swb.holder`) | conditional update on `{gen, epoch}`; the first HEAD is an exclusive create |
|
||||
| `keys/<key>` | one entry per chunk key, naming the needle (fid) that holds the bytes | exclusive create; never rebound |
|
||||
| `intents/<id>` | the keys a holder is about to publish (GC roots); id `<gen>-<16 hex>` | created before the first upload, removed after the outcome is known |
|
||||
| `VOLUME` | identity, geometry (`NumBlocks`, `BlockSize`, `ChunkBlocks`), origin (create or fork) and parent | write-once |
|
||||
| `snapnames/<name>`, `snaps/<name>/<attempt>` | snapshot name records and snapshots | exclusive create |
|
||||
|
||||
**HEAD** (`core/storage/chunk_seam.go` `chunkHead`): `Gen`, `Epoch`, `Holder`, `RemoteLSN`, `Segments` (or a flat `Chunks` map in format 1), `ChunkBytes`, `ManifestChunkCount`, `State` (`active`, `detached`, `deleting`, `purging`, `deleted`, `aborted`), `DetachedBy`. A chunk index missing from the manifest reads as zeros.
|
||||
|
||||
**Chunks.** A chunk is `ChunkBlocks × BlockSize` = 1024 × 4 KiB = 4 MiB (`core/frontend/durable/provider.go` `defaultChunkBlocks`; `core/storage/store.go` `DefaultBlockSize`). Chunk keys are `chunks/e<epoch>/c<idx>/<nonce>-<seq>` (`chunk_layer.go` `newKey`) and are never reused. `ChunkRemote.Put` refuses a key that exists or once existed, and refuses an owner-qualified key: a volume only writes its own keys (`chunk_remote.go` `putObject`).
|
||||
|
||||
**Two-level manifest** (format 2, `core/frontend/chunkstore/manifest.go`):
|
||||
- The HEAD root lists segment references `{Key, SHA256, Owner, Count}` keyed by segment number (`core/storage/chunk_manifest.go` `ChunkSegment`).
|
||||
- Each segment covers a fixed 1 GiB of logical range (`manifestSegmentBytes`, a format constant), so 256 chunks of 4 MiB. It holds a sparse map of chunk index to `{Key, SHA256}`.
|
||||
- Segment keys are owner-qualified, `@<volume>/seg/<nonce>` (`ChunkRemote.PrepareManifest`). A cut rewrites only segments whose chunks changed; unchanged segments keep their exact keys.
|
||||
- Each HEAD is logically full: restore never chains deltas.
|
||||
- A flat (format 1) HEAD is upgraded at its next cut ([chunk manifests](../chunk-manifests.md)). In a host-side proxy, the root of a 10 GiB volume shrank from 261,531 bytes (flat) to 2,172 bytes (two-level) (§13).
|
||||
|
||||
## 4. Dirty tracking
|
||||
|
||||
- **In memory:** every extent write marks its chunk dirty, in O(1), with no I/O and no remote call (`chunk_layer.go` `OnExtentWrite`; the set is `chunkLayerImpl.dirty`). A rebuild BASE write sets a constant-time all-dirty flag instead.
|
||||
- **Off the write path:** WAL entries carry their LBA, so the dirty set is the persisted bitmap plus the chunks of WAL entries above the checkpoint (`walChunks`). The bitmap is made durable before the checkpoint advances past those entries (`BeforeCheckpointAdvance`, called from walstore `persistCheckpointReleasing`); an error refuses the advance and the WAL keeps the entries.
|
||||
- **On disk:** `FileChunkBitmapStore` (`core/storage/chunk_bitmap_file.go`) is one state file (a header `{BaseLSN, HeadGen, Epoch, Base}` and the dirty chunk indices, with a SHA-256 over the body) replaced atomically on every change, plus an append-only delta log with one record per closed HEAD period.
|
||||
- **Reset:** only after a successful HEAD CAS at cut H. The new header is `{BaseLSN: H, HeadGen, Epoch}`; chunks dirtied after the cut stay set (`chunkBitmapStore.Reset`, stillDirty).
|
||||
- **Over-report, never under-report.** A lost bitmap, or a header that does not match HEAD `{RemoteLSN, Gen, Epoch}`, falls back to a background per-chunk SHA-256 comparison against HEAD; cuts are refused until it finishes (`startReconcile`, `errChunkReconciling`).
|
||||
|
||||
## 5. The cut
|
||||
|
||||
`chunkLayerImpl.captureLocked` (`core/storage/chunk_layer.go`; contract in the `chunk_seam.go` header). A checkpoint is not a prefix image (the extent can already hold blocks newer than the checkpoint), so a cut is a quiesced point, not a checkpoint boundary.
|
||||
|
||||
1. **Admit:** refuse when closed, fenced, detached, during a base install, or when `CaptureAllowed` fails (healthy primary, unchanged lineage, valid lease).
|
||||
2. **Pre-copy:** while more than `BarrierBound` chunks would be copied under the barrier (`--chunk-dirty-threshold`, default 512), stage up to that many per round outside the barrier, for at most `chunkStageRounds` (3) rounds (`stage`). A staged chunk with new bytes is uploaded under a fresh key named by an intent written first.
|
||||
3. **Quiesce:** take the capture barrier (walstore `captureMu`) exclusively, then `Sync`. H is the synced LSN; no data newer than H exists in the WAL or the extent.
|
||||
4. **Copy:** read every candidate chunk through the normal read path into immutable buffers and hash them; release the barrier. The pause is `Sync` plus this copy. A staged copy is reused only if its chunk was not written since and HEAD is unchanged.
|
||||
5. **LSN guard:** if H is below HEAD's `RemoteLSN`, refuse (`lsn_behind`).
|
||||
6. **Diff:** upload only chunks whose SHA-256 differs from HEAD; drop all-zero chunks from the map.
|
||||
7. **Intent first:** write an intent naming every key, then upload in parallel (`UploadConcurrency`, `--chunk-upload-concurrency`, default 8, 1 to 64).
|
||||
8. **Manifest:** build segments; new segments are also covered by an intent before upload (`PrepareManifest`).
|
||||
9. **Re-admit** right before the CAS; fence if a superseding holder owns HEAD (`supersededBy`).
|
||||
10. **CAS** HEAD on `{gen, epoch}` with `RemoteLSN = H`. On success, drop the intents and reset the bitmap, keeping post-cut dirt.
|
||||
11. **Unknown outcome:** re-read HEAD; never retry blindly. If unresolved, keep the proposal pending and keep the intents.
|
||||
|
||||
`ChunkRemote.CASHead` (`core/frontend/chunkstore/chunk_remote.go`) refuses a lower epoch, any move of a `deleting`, `purging` or `deleted` HEAD, a `{gen, epoch}` mismatch and a lower `RemoteLSN`, then issues the filer's conditional `UpdateEntry` with `expected_extended = {swb.gen, swb.epoch}`. Only a definite refusal is a precondition failure; any other error is an unknown outcome.
|
||||
|
||||
**Reads after a move.** A block absent locally is fetched from the chunk named in HEAD, bounded by `ReadMissTimeout` (default 30 s), and installed only if no newer local version exists; the dirty map is consulted again after the fetch, so a newer local write always wins (`OnReadMiss`; walstore `readFromExtent`).
|
||||
|
||||
## 6. Snapshots, forks, retention, GC, volume delete
|
||||
|
||||
- **Snapshot** (`Catalog.CreateSnapshot`): claim the name with an exclusive name record `{request, attempt}` (a retry gets its own attempt back); check the volume is not being deleted; write an intent with a deadline; re-check the deadline; exclusively create `snaps/<name>/<attempt>` holding a copy of the HEAD root. An unknown outcome keeps the intent; the caller retries with the same request id.
|
||||
- **Fork** (`Catalog.Fork`): claim the parent snapshot, check the source is not being deleted, write the target `VOLUME` (origin fork), then a HEAD at gen 1, epoch 0, no holder, with the parent's `RemoteLSN` and references. No segment or chunk is copied: the fork's references are owner-qualified, so it reads the parent's objects, and its root alone keeps them live after the parent snapshot is deleted.
|
||||
- **Retention** (`retention.go`): classes `semantic` and `pinned`; newest N, recent window and log-spaced keeps; a snapshot with a live fork claim is always kept; deletion uses the same conditional mark as `DeleteSnapshot`.
|
||||
- **GC** (`gc.go` `Collector.run`, operator-driven through `sw-block ops chunk gc`, preview by default; see also `core/frontend/chunkstore/GC.md`):
|
||||
- roots: every HEAD, every snapshot (including deleting ones), snapshot attempts, live intents, and segment objects; an unreadable segment aborts the mark;
|
||||
- a capture intent expires only if it is older than the TTL, blockmaster has issued a higher epoch, and the remote HEAD has moved to a higher epoch; copy intents are settled only by a permanent tombstone at their publication target;
|
||||
- the whole mark must finish within the grace period minus the operation deadline, and the collector requires grace greater than the deadline;
|
||||
- a binding is deleted only if it is older than the grace period and was unrooted in two marks at least one grace period apart with unchanged binding bytes;
|
||||
- deletion tombstones the binding (`swb.gc.deleted=1`), deletes the needle, then marks it `done`; bindings are never removed, so a key is never rebound.
|
||||
- **Volume delete** (`volume_delete.go` `DeleteVolume`): (a) a blockmaster deletion reservation; (b) one HEAD write to `deleting` (refused while HEAD is held); (c) refuse and revert if any snapshot name record exists; (c') commit `deleting → purging` bound to the same incarnation; (e) HEAD becomes `deleted` with no chunks and `VOLUME` is marked deleted. A deleted id is never attached or created again.
|
||||
|
||||
HEAD states:
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> active: initial HEAD (gen 1, epoch 0) or fork HEAD
|
||||
active --> active: holder's cut CAS (gen+1)
|
||||
active --> detached: Detach final cut
|
||||
detached --> active: takeover CAS (higher epoch, new holder)
|
||||
active --> active: forced takeover (higher epoch)
|
||||
active --> deleting: delete mark (HEAD not held)
|
||||
detached --> deleting: delete mark
|
||||
deleting --> active: snapshots exist, delete reverts
|
||||
deleting --> detached: snapshots exist, delete reverts
|
||||
deleting --> purging: commit point (same incarnation)
|
||||
purging --> deleted: chunks dropped, VOLUME marked deleted
|
||||
deleted --> [*]
|
||||
[*] --> aborted: GC tombstones a dead fork's HEAD
|
||||
```
|
||||
|
||||
Snapshot name lifecycle:
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> NameHeld: exclusive name record {request, attempt}
|
||||
NameHeld --> Published: exclusive create snaps/name/attempt
|
||||
NameHeld --> Aborted: DeleteSnapshot or GC tombstones the attempt path
|
||||
Published --> Deleting: DeleteSnapshot or retention (no live fork claim)
|
||||
Deleting --> NameFreed: name record removed
|
||||
Aborted --> NameFreed: name record removed
|
||||
NameFreed --> [*]
|
||||
```
|
||||
|
||||
The attempt path is never removed, so a late create can never land after a delete.
|
||||
|
||||
## 7. Lease, takeover and host moves
|
||||
|
||||
**Host guard** (`core/host/volume/workspace_lease.go` `WorkspaceLeaseGuard`, enabled with `blockvolume --workspace-lease`; see [workspace lease](../workspace-lease.md)): frontend I/O and cuts are admitted only with a granted, unexpired lease for the exact `{volume, replica, epoch}`. Validity is anchored to the renewal request's start time, and blockmaster's `ValidForNs` already subtracts half the clock-skew bound (`core/host/master/workspace_service.go` `leaseFact`). A late reply cannot extend admission. A fenced guard never reopens. The lease is 30 s (`core/authority/authority.go`, `workspaceTTL`); the skew bound defaults to 20 s (`blockmaster --workspace-max-clock-skew`).
|
||||
|
||||
**CLEAN move:** Detach publishes the final cut with `State = detached` in one CAS → revoke → the host drains frontend, replication and provider and acknowledges the stored detached HEAD generation → blockmaster checks the detached HEAD and the matching acknowledgement → new epoch → the new host claims HEAD.
|
||||
|
||||
**FORCED move:** blockmaster waits until both the stored expiry and its conservative restart deadline plus the full skew bound have passed (`core/authority/workspace.go` `prepareWorkspaceMoveLocked`). The old host's late CAS fails on the epoch; its uploads become orphans for GC. Writes since the old host's last cut are lost.
|
||||
|
||||
**Takeover** (`core/storage/chunk_restore.go` `ClaimChunkHead`, called before the chunk layer attaches in `core/frontend/durable/provider_chunk.go`): read HEAD; fence if HEAD has a higher epoch or another holder at the same epoch; seed the local LSN frontier from HEAD (`PrepareRestore`); CAS HEAD to the new epoch and holder with `State = active`; on an unknown outcome, succeed only if a re-read shows the exact proposal. I/O opens afterwards; blocks load lazily on first read.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
autonumber
|
||||
participant A as Old holder (host A)
|
||||
participant M as blockmaster
|
||||
participant B as New holder (host B)
|
||||
participant F as Filer HEAD
|
||||
Note over A,F: HEAD {gen g, epoch e, holder A}
|
||||
alt CLEAN move
|
||||
A->>F: Detach: final cut, CAS on {g, e}, State detached
|
||||
M->>A: revoke
|
||||
A->>A: drain frontend, replication and provider
|
||||
A->>M: ack the detached HEAD gen (lease still valid)
|
||||
M->>M: check detached HEAD and ack, then mint epoch e+1
|
||||
else FORCED move (host A lost or partitioned)
|
||||
A--xM: renewals stop
|
||||
A->>A: self-fence when ValidForNs runs out
|
||||
M->>M: wait for expiry, restart deadline and skew bound, then mint epoch e+1
|
||||
end
|
||||
M->>B: assignment at epoch e+1 and a lease
|
||||
B->>F: GetHead
|
||||
B->>B: refuse if HEAD epoch is higher, else seed the local frontier from HEAD
|
||||
B->>F: CASHead expected {current gen, e}, next {epoch e+1, holder B, active}
|
||||
F-->>B: installed (gen + 1)
|
||||
B->>B: serve I/O, chunks load lazily on first read
|
||||
opt late publish from the old holder
|
||||
A->>F: CASHead expected {g, e}
|
||||
F-->>A: precondition failed (gen and epoch moved)
|
||||
A->>A: fence, its uploads are orphans for GC
|
||||
end
|
||||
```
|
||||
|
||||
Lease states:
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
state "Lease (blockmaster)" as L {
|
||||
[*] --> Granted: Renew
|
||||
Granted --> Granted: Renew before expiry
|
||||
Granted --> Revoking: BeginWorkspaceRevocation
|
||||
Revoking --> Acked: host acks detached HEAD gen while the lease is valid
|
||||
Acked --> Moved: CLEAN move
|
||||
Granted --> Expired: expiry
|
||||
Expired --> Moved: FORCED move after expiry + skew bound
|
||||
}
|
||||
```
|
||||
|
||||
**Moving back to a host with a surviving local file.** A fresh volume claims HEAD before serving. A non-fresh attach reads HEAD first; if another holder published it, the attach fails closed with `ErrChunkStaleLocalRoot` (`core/frontend/durable/provider_chunk.go`): the volume is not served, and one log line and the status evidence name the local root to remove or quarantine, after which the next attach starts fresh from HEAD (#167).
|
||||
|
||||
## 8. Security model
|
||||
|
||||
What isolates one workspace from another today:
|
||||
|
||||
- **One process per workspace volume.** Each `blockvolume` serves one volume replica from its own local file.
|
||||
- **Loopback frontends.** NVMe/TCP and iSCSI refuse non-loopback binds unless an explicit `--allow-external-*-bind` flag is set; external iSCSI also requires CHAP (`cmd/blockvolume/main.go` `enforceFrontendLoopbackBind`, `enforceISCSIBindPolicy`). The status endpoint and the `/chunk/*` control routes are loopback-only by default. ublk serves a device node on the same host and needs root.
|
||||
- **Orchestrator, hypervisor and jailer (outside this repository).** The guest sees only the virtio block device its hypervisor attaches; which device each microVM gets, and the sandboxing of the hypervisor process (for example a jailer with chroot, cgroups and an unprivileged user) are the integrator's configuration. This repository does not ship that integration.
|
||||
- **Ownership on the remote is a correctness rule, not access control.** A volume writes only its own keys (`ChunkRemote.putObject` refuses owner-qualified keys); a fork reads its parent's objects through owner-qualified keys; every HEAD publish is a CAS on `{gen, epoch}`. These rules stop a stale holder, not a malicious client.
|
||||
|
||||
Not done yet:
|
||||
|
||||
- No authentication on the control plane (blockmaster), the status and chunk control endpoints, the replication channel or the filer client. Anyone who can reach the filer can read or change any volume's entries. **Planned:** mTLS and role checks for destructive operations ([core known issues](block-design.md#24-known-issues-and-work-in-progress)).
|
||||
- No encryption of chunks in SeaweedFS or of traffic to it.
|
||||
- The NVMe/TCP H2CData bound check can wrap and panic the process on one malformed PDU; it is reachable from loopback ([core known issues](block-design.md#24-known-issues-and-work-in-progress)).
|
||||
- ublk at high density: unprivileged per-volume servers need a privileged control broker, which is not done.
|
||||
|
||||
## 9. Invariants
|
||||
|
||||
| Invariant | Enforced in | Test | Model-checked |
|
||||
|---|---|---|---|
|
||||
| Only one holder can publish HEAD: every publish is a CAS on `{gen, epoch}`; a superseded holder fences itself | `chunk_remote.go` `CASHead`; `chunk_layer.go` `supersededBy` | `TestChunkRemote_TakeoverRefusesOldHolder` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkLayer_C6_FencedOnTakeover` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| HEAD epoch and `RemoteLSN` never decrease | `CASHead`; `captureLocked` LSN guard | `TestChunkRemote_EpochNeverLowers` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkCut_RemoteLSNNeverDecreases` (`core/storage/chunk_layer_lsn_order_test.go`); `TestHEADRefusesLSNRegressionAcrossMove` (`core/frontend/chunkstore/restore_lsn_test.go`) | yes |
|
||||
| HEAD is exactly the image at a quiesced cut H, and H is a synced LSN | `captureLocked` | `TestChunkLayer_C1_HeadIsQuiescedCutImage`, `TestChunkLayer_C3_EveryHeadIsExactUnderConcurrentWrites` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| The dirty bitmap never under-reports; it is durable before the checkpoint passes its entries and reset only after a successful CAS | `BeforeCheckpointAdvance`; `finishCut` | `TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle`, `TestChunkLayer_C11_RolloverKeepsPostCutDirt` (`core/storage/chunk_layer_c11_test.go`) | yes |
|
||||
| Chunks and segments are write-once; keys are never rebound | `chunk_remote.go` `putObject`; `gc.go` tombstones | `TestChunkRemote_KeysAreWriteOnce` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkLayer_C5_ChunksAreImmutable` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| Intents are durable before the first upload and removed only after the CAS outcome is known | `captureLocked` | `TestChunkIntent_WrittenBeforeFirstUploadAndDeletedAfterCAS`, `TestChunkIntent_UncertainCASKeepsIntentUntilSettled` (`core/storage/chunk_layer_intent_test.go`) | yes |
|
||||
| GC never deletes a chunk reachable from a HEAD, snapshot, attempt or intent, and deletes only after two graced marks | `gc.go` `Collector.run` | `TestGC_UnreachableRequiresTwoMarksAndUploadAge`, `TestGC_StalledCutRemainsReadableAfterTwoMarks`, `TestGC_IntentExpiryNeedsTTLAuthorityAndRemoteFence` (`core/frontend/chunkstore/gc_test.go`) | yes |
|
||||
| A published snapshot is removed only by `DeleteSnapshot` or retention for the planned attempt, never while a fork claim is live | `catalog.go` `DeleteSnapshot`; `retention.go` `markDeleting` | `TestCatalog_DeleteMarksThenIdempotent` (`core/frontend/chunkstore/catalog_test.go`); `TestCatalog_ClaimBetweenCheckAndMarkWins` (`core/frontend/chunkstore/retention_review_test.go`) | yes |
|
||||
| Volume delete commits only with no snapshot name records; past the commit point it is irreversible | `volume_delete.go` | `TestCatalog_DeleteVolumeRefusesWhileSnapshotsExist`, `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne`, `TestCatalog_DeletedHeadCannotBeRevivedByAClaim` (`core/frontend/chunkstore/volume_delete_test.go`) | yes |
|
||||
| Volume ids are never reused | `core/host/master/services.go`; `catalog.go` `EnsureVolume` | `TestCatalog_DeleteVolumeTombstonesAndRefusesReuse` (`core/frontend/chunkstore/volume_delete_test.go`) | yes |
|
||||
| A host serves and cuts only under a valid lease; a fenced guard never reopens | `workspace_lease.go` | `TestWorkspaceLeaseExpiryFencesWithoutTimerAndCannotReopen`, `TestWorkspaceDelayedRenewalCannotUndoExpiry` (`core/host/volume/workspace_lease_test.go`); `TestWorkspaceHostRequiresLeaseBeforeFrontendAndCut` (`core/host/volume/workspace_runtime_test.go`) | yes |
|
||||
| A forced move waits for expiry plus the skew bound; a clean move needs a detached HEAD and a matching acknowledgement; a new host claims HEAD before serving | `workspace.go` `prepareWorkspaceMoveLocked`; `provider_chunk.go` | `TestWorkspaceSkewSeparatesOldServingFromForcedGrant` (`core/host/master/workspace_skew_test.go`); `TestWorkspaceCleanMoveNeedsDetachedHEADAndRevocationAck` (`core/authority/workspace_test.go`); `TestWorkspaceMoveRestoresLazilyAndFencesOldHost` (`core/host/master/workspace_restore_test.go`) | yes |
|
||||
|
||||
## 10. Tests
|
||||
|
||||
- Contract tests C1–C11 for the chunk layer (`core/storage/chunk_layer_contract_test.go`, `chunk_layer_c11_test.go`), with a fake remote that can hold a CAS or create and complete it after the caller gave up.
|
||||
- Real SeaweedFS (build tag `chunkstore_integration`, real master, volume and filer processes): `TestIntegration_ChunkRemoteContract` (`core/frontend/chunkstore/chunk_remote_integration_test.go`), `TestIntegration_DeleteVolumeThenGC` (`core/frontend/chunkstore/volume_delete_integration_test.go`), `TestIntegration_RetainAndUsage` (`core/frontend/chunkstore/retention_integration_test.go`), `TestIntegration_OpsChunkGC_RealMasterAndStore` (`cmd/sw-block/chunk_gc_integration_test.go`), and `TestIntegration_ConcurrentHEADCASRealFiler` (`core/frontend/chunkstore/concurrent_cas_integration_test.go`), which holds concurrent HEAD updates until every client has read, then lets the real filer's `expected_extended` check decide.
|
||||
- Binary tests with real `blockvolume` and `blockmaster`, for example `TestBinaryWorkspaceLeaseOptInOwnsCLEANShutdown` (`cmd/blockvolume/workspace_lease_binary_test.go`).
|
||||
- Two-host lab lifecycle with Firecracker microVMs (§13).
|
||||
- Not covered: several filers sharing a store, a filer that predates `expected_extended`, and power loss on the local host (see [core §2.2](block-design.md#22-what-is-not-covered)).
|
||||
|
||||
## 11. Review directions
|
||||
|
||||
- **Every remote write must be either write-once or a CAS.** Name the precondition and say what happens on an unknown outcome.
|
||||
- **Every new publication must be covered by an intent** before its first object is written, and the intent must survive an unknown outcome.
|
||||
- **Nothing may move a HEAD in `deleting`, `purging` or `deleted`** except the delete's own transitions.
|
||||
- **Anything that changes GC roots must also change `Collector.run`.** That includes a new manifest level or a new kind of reference.
|
||||
- **Attach paths must decide** whether the local file or HEAD is authoritative, and claim HEAD when it is not this holder's.
|
||||
- **Cut cost:** check barrier pause, RAM held, and amplification for any change to chunk size, staging or copy.
|
||||
|
||||
## 12. Lessons
|
||||
|
||||
- **#152, found before merge.** Model checking reproduced four concurrency issues from a review round, each in seconds:
|
||||
- a snapshot back-out marked another caller's published snapshot as deleting;
|
||||
- a claim check suffered an ABA across delete incarnations;
|
||||
- a lost CLI token left a reservation held;
|
||||
- CreateVolume released a lock before the create.
|
||||
- **Fix:** incarnation-bound commit, no snapshot cascade, request ids, and lock scope.
|
||||
- **Guards:** `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne` and `TestCatalog_DeleteVolumeLosesToAnAttachAtTheMark`.
|
||||
- **#157, clock skew (fixed in #158).** A forced move had no clock-skew margin, so with a slow host clock the old and new hosts could serve together. HEAD stayed safe.
|
||||
- **Fix:** blockmaster waits for expiry plus the skew bound; hosts fence half a bound early.
|
||||
- **Guard:** `TestWorkspaceSkewSeparatesOldServingFromForcedGrant`.
|
||||
- **#102 review, read-miss race.** A read miss that waited on a remote fetch could return a stale zero block while a WAL write landed.
|
||||
- **Fix:** re-resolve through the dirty map after the fetch.
|
||||
- **Guard:** `TestChunkLayer_WALOnlyOverlapReadNeverReturnsUntouchedZero` (`core/storage/chunk_layer_races_test.go`).
|
||||
- **#118 review, Recover and the barrier.** Recover must take the capture barrier. Otherwise a record at H+1 could be copied into a HEAD labelled H.
|
||||
- **Guard:** `TestChunkCut_RecoverWaitsForTheCaptureBarrier` (`core/storage/chunk_layer_precopy_test.go`).
|
||||
|
||||
## 13. Measured results
|
||||
|
||||
Measurements, not SLOs; each is the median of 3 runs. [Workspace measurements](../workspace-measurements.md) has every number and how it was measured.
|
||||
|
||||
- **Workloads** (Firecracker microVMs, 4 vCPU, 4 GiB, one bare-metal host, NVMe/TCP loopback): metadata-heavy agent workloads (`npm ci`, `git clone`, untar, `find` + `stat`) ran at local-disk speed. The cost is `fsync` latency: 2,000 × create + write + `fsync` took 14.33 s against 6.09 s on a local disk, about 7 ms against 3 ms per `fsync`. Reducing it is in progress; the per-stage histograms are described in [fsync latency](../fsync-latency.md).
|
||||
- **Snapshot and fork** (host-side proxy, a 10 GiB volume of 2,560 chunks, no network latency, guest `fsync` or block frontend): HEAD root 2,172 bytes; snapshot 0.18 ms; fork 0.29 ms (flat manifest: 261,531 bytes, 5.79 ms, 10.67 ms).
|
||||
- **Cut upload** (same proxy): 64 dirty chunks (256 MiB) in 624 ms with one upload at a time, 434 ms with 8 in parallel.
|
||||
- **Two-host lifecycle** (Firecracker VMs, SeaweedFS chunk backend): create, write, two snapshots, fork, clean move, stale-holder replay refused, delete, GC; 35 of 35 checks passed, GC reclaimed 38 of 38 candidates and every reclaimed chunk returned 404.
|
||||
|
||||
## 14. Known gaps
|
||||
|
||||
These are tracked for fixes. Gaps that apply to the whole codebase (authentication, formats, power-loss testing) are in the [core known issues](block-design.md#24-known-issues-and-work-in-progress).
|
||||
|
||||
- **Moving back to a host with a surviving local file** fails closed with `ErrChunkStaleLocalRoot` (§7). **Follow-up:** recreate the local root from HEAD automatically instead of refusing.
|
||||
- **Default RPO is unbounded.** No automatic cut is enabled by default (§2).
|
||||
- **The master is a single point of failure.** A master outage longer than the lease stops I/O on every workspace, and recovery is a forced move.
|
||||
- **Cut cost.** The barrier pause includes copying every non-staged candidate chunk (up to the dirty threshold, 512 chunks by default), held in RAM until upload. A 4 KiB write re-uploads its 4 MiB chunk, and a read miss after a move fetches the whole chunk with no request coalescing.
|
||||
- **GC is manual.** Needles uploaded without a persisted key binding are never reclaimed. An intent stamped by a host clock running ahead of the GC runner fails the whole pass (liveness, not safety).
|
||||
- **Filer conditional update: multi-filer and old-filer cases.** Reading the open-source SeaweedFS filer: `UpdateEntry` takes an exclusive lock on the path before it validates `expected_extended`. The concurrent case against one pinned filer is tested (#163). Not tested: several filers sharing a store, and a filer that predates the field (there is no capability probe). **Planned:** a multi-filer test and a probe.
|
||||
- **No multi-replica workspaces with chunk snapshots**, and no crash-restart recovery of a ublk server (a crashed server fails closed).
|
||||
@@ -1,10 +1,14 @@
|
||||
# Seaweed Block design
|
||||
# Seaweed Block design: core
|
||||
|
||||
This is the design reference for Seaweed Block. It describes how the code works, which invariants it maintains, where each invariant is enforced, which tests cover it, and what is not covered yet.
|
||||
This is the design reference for the core of Seaweed Block. It describes how the code works, which invariants it maintains, where each invariant is enforced, which tests cover it, and what is not covered yet.
|
||||
|
||||
- **Part 1** describes the core block service: frontends, storage engines, durability, the authority model, replication for the Kubernetes line, and recovery.
|
||||
- **Part 2** describes agent workspace disks. They are a composition of core parts plus a SeaweedFS chunk backend.
|
||||
- **Part 3** covers verification across the codebase, lessons learned, and known issues.
|
||||
The design is split into three documents: this shared core and one document per product line.
|
||||
|
||||
| Document | Covers |
|
||||
|---|---|
|
||||
| Core design (this document) | **Part 1**, the core block service: frontends and the Backend contract, walstore, smartwal (experimental), durability and `Sync`, the authority model, the replication engine, recovery. **Part 2**, verification, lessons and known issues across the codebase. |
|
||||
| [Agent workspace design](agent-workspace-design.md) | Agent workspace disks (proof of concept): a frontend, local walstore and a SeaweedFS chunk backend; one replica per workspace with durability from snapshots; the cut, the two-level manifest, snapshots, forks, GC, leases and host moves; the security model. |
|
||||
| [Kubernetes block design](kubernetes-block-design.md) | Kubernetes block volumes (alpha): the CSI driver, Helm and the operator controllers, RF=2/3 replication and failover from the product view, iSCSI ALUA, multipath and NVMe/TCP ANA, authority promotion, readiness, the operation layer. |
|
||||
|
||||
Code references name a file and a function, not a line number, so they stay valid as the code changes. Test references name the test function and its file. "Model-checked" means the protocol was specified in TLA+ and checked exhaustively with TLC at small scale. The specifications are in [`docs/spec/`](../spec/README.md); Go regression tests are the in-repo evidence for every counterexample found that way.
|
||||
|
||||
@@ -16,10 +20,13 @@ Code references name a file and a function, not a line number, so they stay vali
|
||||
- [1.3 smartwal: in-place writes plus a metadata ring](#13-smartwal-in-place-writes-plus-a-metadata-ring)
|
||||
- [1.4 Durability and Sync](#14-durability-and-sync)
|
||||
- [1.5 Authority: blockmaster, assignments, epochs, leases](#15-authority-blockmaster-assignments-epochs-leases)
|
||||
- [1.6 Replication and failover (Kubernetes line)](#16-replication-and-failover-kubernetes-line)
|
||||
- [1.6 Replication and failover](#16-replication-and-failover)
|
||||
- [1.7 Recovery and typed fail-closed reasons](#17-recovery-and-typed-fail-closed-reasons)
|
||||
- [Part 2. Agent workspace disks](#part-2-agent-workspace-disks)
|
||||
- [Part 3. Verification, lessons, known issues](#part-3-verification-lessons-known-issues)
|
||||
- [Part 2. Verification, lessons, known issues](#part-2-verification-lessons-known-issues)
|
||||
- [2.1 Test methods](#21-test-methods)
|
||||
- [2.2 What is not covered](#22-what-is-not-covered)
|
||||
- [2.3 Lessons learned](#23-lessons-learned)
|
||||
- [2.4 Known issues and work in progress](#24-known-issues-and-work-in-progress)
|
||||
|
||||
---
|
||||
|
||||
@@ -91,6 +98,12 @@ stateDiagram-v2
|
||||
- A WAL record is a 30-byte header (LSN, reserved, type, flags, LBA, length), the data, and an 8-byte trailer (CRC32, record size) (`core/storage/wal_entry.go`). A record that does not fit at the end of the region is preceded by a padding record and starts at offset 0 (`core/storage/wal_writer.go` `walWriter.append`).
|
||||
- An in-memory dirty map maps each LBA to its newest WAL record and LSN (`core/storage/dirty_map.go`).
|
||||
|
||||
<p align="center">
|
||||
<img src="../assets/walstore-layout.svg" alt="walstore file: a 4 KiB superblock, a circular WAL of 64 MiB by default, and the extent; the superblock fields; the WAL ring with head, durable tail and a padding record before the wrap; the record format with a 30-byte prefix and an 8-byte trailer; the five steps Write, Sync, flusher, checkpoint and reuse; and recovery from the superblock" width="100%">
|
||||
</p>
|
||||
|
||||
Numbers in the figure, all from the code: the superblock is 4096 bytes and the WAL starts at offset 4096 (`superblock.go` `superblockSize`, `newSuperblock`, `validate`), and 96 bytes of it are encoded (`superblock.writeTo`); the WAL region is 64 MiB (the `newSuperblock` default, which walstore does not override), and the extent starts at `WALOffset + WALSize` with one slot per block (`walstore.go` `CreateWALStoreWithOptions`, `openInitializedWithMetadata`); a record has a 30-byte prefix and an 8-byte trailer (`wal_entry.go` `walEntryPrefixSize`, `walEntryHeaderSize`); the group committer waits up to 1 ms or 64 waiters (`openInitializedWithMetadata`, `NewGroupCommitter`); the flusher runs every 100 ms (`flusher.go` `newFlusher`). A store may also bind an optional metadata region after the extent through a metadata factory (`block_metadata.go` `bindBlockMetadata`); it is not shown.
|
||||
|
||||
**Write.** `WALStore.Write` takes the capture barrier (shared), the lifecycle lock and WAL admission (back-pressure when the WAL is full), assigns the next LSN under `mu`, appends the record with `pwrite` only, updates the dirty map and notifies an attached chunk layer. The write is not durable until a covering `Sync` returns.
|
||||
|
||||
**Sync.** `WALStore.Sync` records the current head, runs a group-committed `fsync` (`core/storage/group_commit.go`), and returns the new durable frontier. A request whose writes are already covered by a completed physical sync reuses it (`walSyncCovered`, `syncWALBatch`); reuse is disabled when a chunk layer is attached or after replica apply and direct extent writes.
|
||||
@@ -108,9 +121,15 @@ stateDiagram-v2
|
||||
1. Derive scan ranges from the persisted `[tail, head)`. An empty window (head == tail) is scanned from its own position, not from offset 0.
|
||||
2. Decode each range until a record fails CRC or is truncated. If a valid record with a higher LSN follows a bad one, record a `wal_hole_suspected` warning (detection only).
|
||||
3. Skip records at or below the checkpoint. Replay the rest by last writer wins on LSN (`dirtyMap.putAtIfNewer`), not by physical order.
|
||||
4. Rebuild and validate the retained bounds; an inconsistent order or size is a `WALIntegrityFailure` and the store does not open.
|
||||
4. Rebuild and validate the retained bounds; an inconsistent order or size is a WAL integrity failure (`NewWALIntegrityFailure`) and the store does not open.
|
||||
5. `Recover` persists rebuilt bounds before any append.
|
||||
|
||||
<p align="center">
|
||||
<img src="../assets/walstore-lsn-watermarks.svg" alt="LSN timeline with the checkpoint, the synced frontier and the newest written LSN: writes at or below the checkpoint are in the extent, writes up to the synced frontier are fsynced in the WAL and replayed after a crash, writes above it were never acknowledged and may be lost" width="100%">
|
||||
</p>
|
||||
|
||||
The watermarks are `WALStore.checkpointLSN` (persisted as the superblock's `WALCheckpointLSN`), `syncedLSN` (returned by `Sync`) and `walHead` (the newest written LSN; `nextLSN` is one above it). Only the checkpoint and the WAL bytes are on disk. After a crash, `Recover` sets the synced frontier to the higher of the checkpoint and the highest valid record it replays.
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Appended: Write (pwrite, LSN assigned, dirty map)
|
||||
@@ -134,7 +153,7 @@ stateDiagram-v2
|
||||
| Synced entries above an intentional LSN gap (a rebuild's frontier jump) are kept | `recovery.go` (replay keyed on the checkpoint, not on a contiguous prefix) | `TestWALStoreRecoverKeepsSyncedEntriesAboveAnUnpersistedFrontierJump` (`core/storage/walstore_recovery_frontier_gap_test.go`) | yes |
|
||||
| A failed checkpoint metadata write neither publishes nor recycles | `persistCheckpointReleasing` | `TestFlusherCheckpointMetadataFailureDoesNotPublishOrRecycle` (`core/storage/walstore_checkpoint_safety_test.go`) | — |
|
||||
|
||||
**Tests and coverage.** Unit tests with hand-built torn and corrupted bytes; fault seams for append and metadata writes; a Linux SIGKILL crash test over checkpoint windows. Not covered: real power loss (dropped or reordered page-cache writes) at the device level, fuzzing of the recovery scan as a whole (the WAL record decoder is fuzzed, see 3.2), and crash-point enumeration.
|
||||
**Tests and coverage.** Unit tests with hand-built torn and corrupted bytes; fault seams for append and metadata writes; a Linux SIGKILL crash test over checkpoint windows. Not covered: real power loss (dropped or reordered page-cache writes) at the device level, fuzzing of the recovery scan as a whole (the WAL record decoder is fuzzed, see 2.2), and crash-point enumeration.
|
||||
|
||||
**Review directions.**
|
||||
- Any change to recovery must say what it does for: a torn tail, a torn record inside the retained window, a wrapped log, an empty window, and a corrupted synced record.
|
||||
@@ -158,9 +177,15 @@ stateDiagram-v2
|
||||
|
||||
**Layout.** A 4 KB header, a ring of 32-byte records, and the extent (`core/storage/smartwal/store.go`). A record holds magic, flags, LBA, LSN, the CRC32 of the 4 KB data block, and a record CRC (`core/storage/smartwal/record.go`). Slot = LSN mod capacity (`ring.go` `appendAt`).
|
||||
|
||||
<p align="center">
|
||||
<img src="../assets/smartwal-layout.svg" alt="smartwal file: a 4 KiB header, a ring of 32-byte records and the extent; the byte layout of one record; the write order read old block, write in place, append record, Sync; the crash window between the in-place write and the append; recovery" width="100%">
|
||||
</p>
|
||||
|
||||
Numbers in the figure: the header is 4096 bytes (`smartwal/superblock.go` `headerSize`); a record is 32 bytes with the byte offsets of `record.go` `encode` (magic 0xAC; flags write 0x01, trim 0x02, barrier 0x04); the default ring has 65,536 slots, 2 MiB (`store.go` `defaultWALSlots`). On a data CRC mismatch, recovery fails closed (`recovery.go` `runRecoveryCounting`); the comment on the `Store` type still says such a record is skipped, which the code no longer does.
|
||||
|
||||
**Write, read, Sync.** `Store.writeAt` reads the old block (kept for rollback), writes the new data in place, then appends the record; if the append fails, the old block is written back. Reads always come from the extent. `Sync` is one `fsync` of the file.
|
||||
|
||||
**Recovery.** `runRecoveryCounting` (`core/storage/smartwal/recovery.go`): scan slots (record-CRC failures are skipped and counted as a warning), keep the highest-LSN record per LBA, check the extent block against its data CRC, and fail closed with `WALIntegrityFailure` on a mismatch. The frontier is the highest verified LSN.
|
||||
**Recovery.** `runRecoveryCounting` (`core/storage/smartwal/recovery.go`): scan slots (record-CRC failures are skipped and counted as a warning), keep the highest-LSN record per LBA, check the extent block against its data CRC, and fail closed with a WAL integrity failure (`NewWALIntegrityFailure`) on a mismatch. The frontier is the highest verified LSN.
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
@@ -184,18 +209,19 @@ stateDiagram-v2
|
||||
|
||||
**Review directions.** Any fix must define the order between the record and the data and say how a torn pair is classified (torn and unsynced, versus corrupted and synced). A synced watermark persisted outside the ring is the planned way to tell them apart.
|
||||
|
||||
**Lessons.** #51 (open): a CRC-failed committed record is skipped and the volume reports ready. #155 made this visible as a warning; the fix needs the format change described in Part 3.
|
||||
**Lessons.** #51 (open): a CRC-failed committed record is skipped and the volume reports ready. #155 made this visible as a warning; the fix needs the format change described in Part 2.
|
||||
|
||||
## 1.4 Durability and Sync
|
||||
|
||||
- **One durability point.** A write is durable only when a `Sync` covering its LSN returns nil. `Sync` returns the durable frontier.
|
||||
- **Group commit.** Concurrent `Sync` callers share one `fsync`. The committer waits up to `MaxDelay` (1 ms) or until 64 waiters are queued (`core/storage/group_commit.go` `NewGroupCommitter`, `Run`).
|
||||
- **Deduplication.** A sync that started after the last mutation covers later `Sync` requests with no new writes (`walstore.go` `walSyncCovered`).
|
||||
- **A failed `fsync` is sticky.** The first failed `fsync` of the store's file (WAL, extent or superblock), or a failed WAL append, latches a typed `io_error` fault; the open store then refuses every later `Sync`, write and checkpoint until it is reopened and recovered (`walstore.go` `noteFsyncFailure`, `noteAppendFailure`, `syncFile`, `stickyIOFault`). Every `fsync` of the file is serialized with that latch, so no publication can pass the check and complete after another path's `fsync` failed (#172).
|
||||
- **With replication.** `ReplicationVolume.Sync` queues a barrier behind every shipped write, runs the local `fsync` in parallel, and applies the volume's durability mode (§1.6).
|
||||
- **Observability.** Per-stage power-of-two histograms (frontend receive, WAL append, group-commit wait, physical sync, return) are exposed under `/status/durable` (`docs/fsync-latency.md`).
|
||||
|
||||
**Review directions.**
|
||||
- `fsync` failure semantics: after a failed `fsync`, the kernel may have dropped the dirty pages. A later successful `fsync` does not prove the earlier data is durable (see Known issues).
|
||||
- `fsync` failure semantics: after a failed `fsync`, the kernel may have dropped the dirty pages, so a later successful `fsync` proves nothing about them. Any new path that `fsync`s the store's file must go through `syncFile`, so the fault latches.
|
||||
- Do not add a stage's p99 to another's; the populations differ.
|
||||
|
||||
## 1.5 Authority: blockmaster, assignments, epochs, leases
|
||||
@@ -204,7 +230,7 @@ stateDiagram-v2
|
||||
- blockmaster is the only component that mints epochs. A reassignment takes the maximum epoch published for the volume plus one (`core/authority/authority.go` `applyWithWorkspaceMove`, `IntentReassign` case). A workspace move reserves its epoch the same way and journals the move before the epoch is published (`core/authority/workspace.go` `prepareWorkspaceMoveLocked`).
|
||||
- If a durable authority write fails, the publisher marks the volume uncertain and refuses further writes for it, so a later write cannot go backwards (`workspace.go` `persistWorkspaceLocked`).
|
||||
- blockvolume never elects itself; it serves under the assignment it was given, and every I/O re-checks that assignment (§1.1).
|
||||
- Workspace volumes add a lease (§2.5).
|
||||
- Workspace volumes add a lease ([agent workspace design §7](agent-workspace-design.md#7-lease-takeover-and-host-moves)).
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
@@ -228,9 +254,9 @@ stateDiagram-v2
|
||||
|
||||
**Review directions.** Any new way to publish an assignment must go through the publisher's epoch rule; nothing else may construct an epoch. The control plane has no authentication today (see Known issues), so every destructive RPC is reachable by anyone who can reach the port.
|
||||
|
||||
## 1.6 Replication and failover (Kubernetes line)
|
||||
## 1.6 Replication and failover
|
||||
|
||||
Agent workspaces do not use this path (they run RF=1); Kubernetes volumes use RF=2 or RF=3.
|
||||
This section is the replication engine as a core component. Kubernetes volumes use it when their StorageClass sets `replicationFactor` to 2 or 3 (the default is 1); agent workspaces do not use it (they run RF=1). The product view (StorageClass and Helm settings, failure detection, the promotion gate, multipath, readiness) is in the [Kubernetes block design](kubernetes-block-design.md).
|
||||
|
||||
**Shipping.** The primary writes locally first, then ships each write to every replica in LSN order (`core/replication/volume.go` `OnLocalWrite`), through a per-peer FIFO.
|
||||
|
||||
@@ -254,12 +280,14 @@ stateDiagram-v2
|
||||
Healthy --> Degraded: barrier or ship failure
|
||||
Degraded --> CatchingUp: gap within the primary's WAL
|
||||
CatchingUp --> Healthy: caught up to the target
|
||||
CatchingUp --> Degraded: catch-up fails
|
||||
Degraded --> Healthy: recovers
|
||||
Degraded --> NeedsRebuild: gap beyond WAL retention or retries exhausted
|
||||
CatchingUp --> NeedsRebuild: WAL recycled
|
||||
NeedsRebuild --> Healthy: dual-lane rebuild completes and acks durably
|
||||
NeedsRebuild --> [*]: terminal for this peer
|
||||
```
|
||||
|
||||
(Peer states are in `core/replication/peer.go` `ReplicaState`.)
|
||||
(Peer states and allowed transitions are in `core/replication/peer.go` `ReplicaState`, `replicaStateTransitionAllowed`. `NeedsRebuild` is terminal in this state machine; the rebuild itself runs as a separate dual-lane session, and the Kubernetes line drives it through an opt-in operator path, see the [Kubernetes block design](kubernetes-block-design.md#4-replication-and-failover).)
|
||||
|
||||
**Invariants.**
|
||||
|
||||
@@ -302,185 +330,9 @@ The reason is an unhealthy, not-eligible fact; blockmaster does not promote or s
|
||||
|
||||
---
|
||||
|
||||
# Part 2. Agent workspace disks
|
||||
# Part 2. Verification, lessons, known issues
|
||||
|
||||
An agent workspace disk is a composition of core parts:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
G["guest microVM"] -->|"virtio-blk"| F["frontend: NVMe/TCP loopback or ublk (1.1)"]
|
||||
F -->|"Read / Write / Sync"| W["local engine: walstore (1.2)"]
|
||||
W -->|"dirty chunk bitmap"| C["chunk layer: quiesced cut"]
|
||||
C -->|"upload changed 4 MiB chunks, intents first"| S[("SeaweedFS: immutable chunks + segment manifests")]
|
||||
C -->|"CAS HEAD on {gen, epoch}"| H["HEAD root (about 2 KB)"]
|
||||
H -->|"snapshot / fork = copy the root"| H2["snapshot or forked volume"]
|
||||
M["blockmaster: epoch + lease (1.5)"] -->|"higher epoch"| T["another host: claim HEAD, lazy-load chunks"]
|
||||
T --> H
|
||||
```
|
||||
|
||||
- **Frontend:** the same NVMe/TCP and ublk code as the Kubernetes line, bound to loopback.
|
||||
- **Local engine:** walstore only (`--durable-impl=walstore-chunk`). `Sync` still means local durability; nothing on the write path waits for the network.
|
||||
- **Backend:** SeaweedFS. Chunks live in volume servers; HEAD, key bindings, intents and snapshot records live in the filer.
|
||||
- **Single replica by design.** Durability against host loss comes from cuts to SeaweedFS. A host restart loses nothing (local WAL); a permanent host loss loses the writes since the last cut.
|
||||
- **Host moves** reuse the epoch from §1.5: the new host claims HEAD with a higher epoch.
|
||||
|
||||
## 2.1 Remote layout
|
||||
|
||||
Per volume, in the filer (`core/frontend/chunkstore/catalog.go` header, `chunk_remote.go` header):
|
||||
- `HEAD`: the published state as JSON, with `{gen, epoch, holder}` mirrored in extended attributes for the conditional update.
|
||||
- `keys/<key>`: one write-once entry per chunk key, naming the needle that holds the bytes.
|
||||
- `intents/<id>`: live publication intents (GC roots).
|
||||
- `VOLUME`: identity, geometry, origin (create or fork) and parent; write-once.
|
||||
- `snapnames/<name>`: name records; `snaps/<name>/<attempt>`: snapshots.
|
||||
|
||||
HEAD fields: `Gen`, `Epoch`, `Holder`, `RemoteLSN`, chunk or segment references, `State`, `DetachedBy` (`core/storage/chunk_seam.go` `chunkHead`). A chunk index missing from HEAD reads as zeros. A chunk is 4 MiB (1024 blocks of 4 KiB). Chunk keys are `chunks/e<epoch>/c<idx>/<nonce>-<seq>` and are never reused (`chunk_layer.go` `newKey`).
|
||||
|
||||
**Two-level manifest.** The HEAD root lists segment references, not chunks. Each segment covers 1 GiB of logical range and lists that range's chunk references with SHA-256 (`core/frontend/chunkstore/manifest.go`). Unchanged segments keep their keys. A flat (format 1) HEAD is upgraded at its next cut (`docs/chunk-manifests.md`).
|
||||
|
||||
## 2.2 Dirty tracking (bitmap)
|
||||
|
||||
- Every extent write marks its chunk dirty in memory, in O(1), with no I/O (`chunk_layer.go` `OnExtentWrite`).
|
||||
- The dirty set is the persisted bitmap plus the chunks of WAL entries above the checkpoint, so the bitmap is off the write path. It is made durable before the checkpoint advances (`BeforeCheckpointAdvance`, called from `persistCheckpointReleasing`).
|
||||
- The bitmap may over-report, never under-report. A lost bitmap, or a header that does not match HEAD, falls back to a background per-chunk SHA-256 comparison; cuts are refused until it finishes (`startReconcile`, `errChunkReconciling`).
|
||||
|
||||
## 2.3 The cut
|
||||
|
||||
`chunkLayerImpl.captureLocked` (`core/storage/chunk_layer.go`; contract in the `chunk_seam.go` header):
|
||||
1. **Admit:** refuse when closed, fenced, detached, during a base install, or when `CaptureAllowed` fails (healthy primary, unchanged lineage, valid lease).
|
||||
2. **Pre-copy:** if many chunks are dirty, stage them outside the barrier in rounds.
|
||||
3. **Quiesce:** take the capture barrier exclusively, `Sync`; H is the synced LSN.
|
||||
4. **Copy:** read every candidate chunk through the normal read path into immutable buffers and hash them; release the barrier. A staged copy is reused only if its chunk was not written since and HEAD is unchanged.
|
||||
5. **LSN guard:** if H is below HEAD's `RemoteLSN`, refuse (`lsn_behind`).
|
||||
6. **Diff:** upload only chunks whose SHA-256 differs from HEAD; drop all-zero chunks from the map.
|
||||
7. **Intent first:** write an intent naming every key, then upload in parallel (default 8).
|
||||
8. **Manifest:** build segments; new segments are also covered by an intent before upload.
|
||||
9. **Re-admit** right before the CAS; fence if a superseding holder owns HEAD.
|
||||
10. **CAS** HEAD on `{gen, epoch}`. On success, drop the intents and reset the bitmap, keeping post-cut dirt.
|
||||
11. **Unknown outcome:** re-read HEAD; never retry blindly. If unresolved, keep the proposal pending and keep the intents.
|
||||
|
||||
`ChunkRemote.CASHead` (`core/frontend/chunkstore/chunk_remote.go`) refuses a lower epoch, any move of a deleting, purging or deleted HEAD, a `{gen, epoch}` mismatch and a lower `RemoteLSN`, then issues the filer's conditional `UpdateEntry` with `expected_extended = {swb.gen, swb.epoch}` (the first HEAD is an exclusive create). Only a definite refusal is a precondition failure; any other error is an unknown outcome.
|
||||
|
||||
## 2.4 Snapshots, forks, retention, GC, volume delete
|
||||
|
||||
- **Snapshot** (`Catalog.CreateSnapshot`): claim the name with an exclusive name record `{request, attempt}` (a retry gets its own attempt back); check the volume is not being deleted; write an intent with a deadline; re-check the deadline; exclusively create `snaps/<name>/<attempt>` holding a copy of the HEAD root. An unknown outcome keeps the intent; the caller retries with the same request id.
|
||||
- **Fork** (`Catalog.Fork`): claim the parent snapshot, check the source is not being deleted, write the target `VOLUME` (origin fork), then a HEAD at gen 1, epoch 0, no holder, with the parent's `RemoteLSN` and references. No chunk is copied.
|
||||
- **Retention** (`retention.go`): classes `semantic` and `pinned`; newest N, recent window and log-spaced keeps; a snapshot with a live fork claim is always kept; deletion uses the same conditional mark as `DeleteSnapshot`.
|
||||
- **GC** (`gc.go` `Collector.run`, operator-driven through `sw-block ops chunk gc`, preview by default):
|
||||
- roots: every HEAD, every snapshot (including deleting ones), snapshot attempts, live intents, and segment objects; an unreadable segment aborts the mark;
|
||||
- a capture intent expires only if it is older than the TTL, blockmaster has issued a higher epoch, and the remote HEAD has moved to a higher epoch; copy intents are settled only by a permanent tombstone at their publication target;
|
||||
- the whole mark must finish within the grace period minus the operation deadline, and the collector requires grace greater than the deadline;
|
||||
- a binding is deleted only if it is older than the grace period and was unrooted in two marks at least one grace period apart with unchanged binding bytes;
|
||||
- deletion tombstones the binding (`swb.gc.deleted=1`), deletes the needle, then marks it `done`; bindings are never removed, so a key is never rebound.
|
||||
- **Volume delete** (`volume_delete.go` `DeleteVolume`): (a) a blockmaster deletion reservation; (b) one HEAD write to `deleting` (refused while HEAD is held); (c) refuse and revert if any snapshot name record exists; (c') commit `deleting → purging` bound to the same incarnation; (e) HEAD becomes `deleted` with no chunks and `VOLUME` is marked deleted. A deleted id is never attached or created again.
|
||||
|
||||
## 2.5 Lease, takeover and host moves
|
||||
|
||||
**Host guard** (`core/host/volume/workspace_lease.go` `WorkspaceLeaseGuard`): frontend I/O and cuts are admitted only with a granted, unexpired lease for the exact `{volume, replica, epoch}`. Validity is anchored to the renewal request's start time, and blockmaster's `ValidForNs` already subtracts half the clock-skew bound (`core/host/master/workspace_service.go` `leaseFact`). A late reply cannot extend admission. A fenced guard never reopens.
|
||||
|
||||
**CLEAN move:** Detach publishes the final cut with `State = detached` in one CAS → revoke → the host drains frontend, replication and provider and acknowledges the stored detached HEAD generation → blockmaster checks the detached HEAD and the matching acknowledgement → new epoch → the new host claims HEAD.
|
||||
|
||||
**FORCED move:** blockmaster waits until both the stored expiry and its conservative restart deadline plus the full skew bound have passed (`core/authority/workspace.go` `prepareWorkspaceMoveLocked`); the default bound is 20 s against a 30 s lease. The old host's late CAS fails on the epoch; its uploads become orphans for GC. Writes since the old host's last cut are lost.
|
||||
|
||||
**Takeover** (`core/storage/chunk_restore.go` `ClaimChunkHead`, called before the chunk layer attaches in `core/frontend/durable/provider_chunk.go`): read HEAD; fence if HEAD has a higher epoch or another holder at the same epoch; seed the local LSN frontier from HEAD; CAS HEAD to the new epoch and holder; on an unknown outcome, succeed only if a re-read shows the exact proposal. I/O opens afterwards; blocks load lazily on first read.
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> active: initial HEAD (gen 1, epoch 0) or fork HEAD
|
||||
active --> active: holder's cut CAS (gen+1)
|
||||
active --> detached: Detach final cut
|
||||
detached --> active: takeover CAS (higher epoch, new holder)
|
||||
active --> active: forced takeover (higher epoch)
|
||||
active --> deleting: delete mark (HEAD not held)
|
||||
detached --> deleting: delete mark
|
||||
deleting --> active: snapshots exist, delete reverts
|
||||
deleting --> detached: snapshots exist, delete reverts
|
||||
deleting --> purging: commit point (same incarnation)
|
||||
purging --> deleted: chunks dropped, VOLUME marked deleted
|
||||
deleted --> [*]
|
||||
[*] --> aborted: GC tombstones a dead fork's HEAD
|
||||
```
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
state "Lease (blockmaster)" as L {
|
||||
[*] --> Granted: Renew
|
||||
Granted --> Granted: Renew before expiry
|
||||
Granted --> Revoking: BeginWorkspaceRevocation
|
||||
Revoking --> Acked: host acks detached HEAD gen while the lease is valid
|
||||
Acked --> Moved: CLEAN move
|
||||
Granted --> Expired: expiry
|
||||
Expired --> Moved: FORCED move after expiry + skew bound
|
||||
}
|
||||
```
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> NameHeld: exclusive name record {request, attempt}
|
||||
NameHeld --> Published: exclusive create snaps/name/attempt
|
||||
NameHeld --> Aborted: DeleteSnapshot or GC tombstones the attempt path
|
||||
Published --> Deleting: DeleteSnapshot or retention (no live fork claim)
|
||||
Deleting --> NameFreed: name record removed
|
||||
Aborted --> NameFreed: name record removed
|
||||
NameFreed --> [*]
|
||||
```
|
||||
|
||||
The attempt path is never removed, so a late create can never land after a delete.
|
||||
|
||||
## 2.6 Workspace invariants
|
||||
|
||||
| Invariant | Enforced in | Test | Model-checked |
|
||||
|---|---|---|---|
|
||||
| Only one holder can publish HEAD: every publish is a CAS on `{gen, epoch}`; a superseded holder fences itself | `chunk_remote.go` `CASHead`; `chunk_layer.go` `supersededBy` | `TestChunkRemote_TakeoverRefusesOldHolder` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkLayer_C6_FencedOnTakeover` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| HEAD epoch and `RemoteLSN` never decrease | `CASHead`; `captureLocked` LSN guard | `TestChunkRemote_EpochNeverLowers` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkCut_RemoteLSNNeverDecreases` (`core/storage/chunk_layer_lsn_order_test.go`); `TestHEADRefusesLSNRegressionAcrossMove` (`core/frontend/chunkstore/restore_lsn_test.go`) | yes |
|
||||
| HEAD is exactly the image at a quiesced cut H, and H is a synced LSN | `captureLocked` | `TestChunkLayer_C1_HeadIsQuiescedCutImage`, `TestChunkLayer_C3_EveryHeadIsExactUnderConcurrentWrites` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| The dirty bitmap never under-reports; it is durable before the checkpoint passes its entries and reset only after a successful CAS | `BeforeCheckpointAdvance`; `finishCut` | `TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle`, `TestChunkLayer_C11_RolloverKeepsPostCutDirt` (`core/storage/chunk_layer_c11_test.go`) | yes |
|
||||
| Chunks and segments are write-once; keys are never rebound | `chunk_remote.go` `putObject`; `gc.go` tombstones | `TestChunkRemote_KeysAreWriteOnce` (`core/frontend/chunkstore/chunk_remote_test.go`); `TestChunkLayer_C5_ChunksAreImmutable` (`core/storage/chunk_layer_contract_test.go`) | yes |
|
||||
| Intents are durable before the first upload and removed only after the CAS outcome is known | `captureLocked` | `TestChunkIntent_WrittenBeforeFirstUploadAndDeletedAfterCAS`, `TestChunkIntent_UncertainCASKeepsIntentUntilSettled` (`core/storage/chunk_layer_intent_test.go`) | yes |
|
||||
| GC never deletes a chunk reachable from a HEAD, snapshot, attempt or intent, and deletes only after two graced marks | `gc.go` `Collector.run` | `TestGC_UnreachableRequiresTwoMarksAndUploadAge`, `TestGC_StalledCutRemainsReadableAfterTwoMarks`, `TestGC_IntentExpiryNeedsTTLAuthorityAndRemoteFence` (`core/frontend/chunkstore/gc_test.go`) | yes |
|
||||
| A published snapshot is removed only by `DeleteSnapshot` or retention for the planned attempt, never while a fork claim is live | `catalog.go` `DeleteSnapshot`; `retention.go` `markDeleting` | `TestCatalog_DeleteMarksThenIdempotent` (`core/frontend/chunkstore/catalog_test.go`); `TestCatalog_ClaimBetweenCheckAndMarkWins` (`core/frontend/chunkstore/retention_review_test.go`) | yes |
|
||||
| Volume delete commits only with no snapshot name records; past the commit point it is irreversible | `volume_delete.go` | `TestCatalog_DeleteVolumeRefusesWhileSnapshotsExist`, `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne`, `TestCatalog_DeletedHeadCannotBeRevivedByAClaim` (`core/frontend/chunkstore/volume_delete_test.go`) | yes |
|
||||
| Volume ids are never reused | `services.go`; `catalog.go` `EnsureVolume` | `TestCatalog_DeleteVolumeTombstonesAndRefusesReuse` (`core/frontend/chunkstore/volume_delete_test.go`) | yes |
|
||||
| A host serves and cuts only under a valid lease; a fenced guard never reopens | `workspace_lease.go` | `TestWorkspaceLeaseExpiryFencesWithoutTimerAndCannotReopen`, `TestWorkspaceDelayedRenewalCannotUndoExpiry` (`core/host/volume/workspace_lease_test.go`); `TestWorkspaceHostRequiresLeaseBeforeFrontendAndCut` (`core/host/volume/workspace_runtime_test.go`) | yes |
|
||||
| A forced move waits for expiry plus the skew bound; a clean move needs a detached HEAD and a matching acknowledgement; a new host claims HEAD before serving | `workspace.go` `prepareWorkspaceMoveLocked`; `provider_chunk.go` | `TestWorkspaceSkewSeparatesOldServingFromForcedGrant` (`core/host/master/workspace_skew_test.go`); `TestWorkspaceCleanMoveNeedsDetachedHEADAndRevocationAck` (`core/authority/workspace_test.go`); `TestWorkspaceMoveRestoresLazilyAndFencesOldHost` (`core/host/master/workspace_restore_test.go`) | yes |
|
||||
|
||||
## 2.7 Workspace tests
|
||||
|
||||
- Contract tests C1–C11 for the chunk layer (`core/storage/chunk_layer_contract_test.go`, `chunk_layer_c11_test.go`), with a fake remote that can hold a CAS or create and complete it after the caller gave up.
|
||||
- Real SeaweedFS (build tag `chunkstore_integration`, real master, volume and filer processes): `TestIntegration_ChunkRemoteContract` (`core/frontend/chunkstore/chunk_remote_integration_test.go`), `TestIntegration_DeleteVolumeThenGC` (`core/frontend/chunkstore/volume_delete_integration_test.go`), `TestIntegration_RetainAndUsage` (`core/frontend/chunkstore/retention_integration_test.go`), and `TestIntegration_OpsChunkGC_RealMasterAndStore` (`cmd/sw-block/chunk_gc_integration_test.go`).
|
||||
- Two-host lab lifecycle with Firecracker microVMs: create, write, snapshots, fork, clean move, stale-holder replay refused, delete, GC; 35 of 35 checks passed, GC reclaimed 38 of 38 candidates and every reclaimed chunk returned 404 ([workspace measurements](../workspace-measurements.md), "Workspace lifecycle on two hosts").
|
||||
|
||||
## 2.8 Workspace review directions
|
||||
|
||||
- **Every remote write must be either write-once or a CAS.** Name the precondition and say what happens on an unknown outcome.
|
||||
- **Every new publication must be covered by an intent** before its first object is written, and the intent must survive an unknown outcome.
|
||||
- **Nothing may move a HEAD in `deleting`, `purging` or `deleted`** except the delete's own transitions.
|
||||
- **Anything that changes GC roots must also change `Collector.run`.** That includes a new manifest level or a new kind of reference.
|
||||
- **Attach paths must decide** whether the local file or HEAD is authoritative, and claim HEAD when it is not this holder's.
|
||||
- **Cut cost:** check barrier pause, RAM held, and amplification for any change to chunk size, staging or copy.
|
||||
|
||||
## 2.9 Workspace lessons
|
||||
|
||||
- **#152, found before merge.** Model checking reproduced four concurrency issues from a review round, each in seconds:
|
||||
- a snapshot back-out marked another caller's published snapshot as deleting;
|
||||
- a claim check suffered an ABA across delete incarnations;
|
||||
- a lost CLI token left a reservation held;
|
||||
- CreateVolume released a lock before the create.
|
||||
- **Fix:** incarnation-bound commit, no snapshot cascade, request ids, and lock scope.
|
||||
- **Guards:** `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne` and `TestCatalog_DeleteVolumeLosesToAnAttachAtTheMark`.
|
||||
- **#157, clock skew (fixed in #158).** A forced move had no clock-skew margin, so with a slow host clock the old and new hosts could serve together. HEAD stayed safe.
|
||||
- **Fix:** blockmaster waits for expiry plus the skew bound; hosts fence half a bound early.
|
||||
- **Guard:** `TestWorkspaceSkewSeparatesOldServingFromForcedGrant`.
|
||||
- **#102 review, read-miss race.** A read miss that waited on a remote fetch could return a stale zero block while a WAL write landed.
|
||||
- **Fix:** re-resolve through the dirty map after the fetch.
|
||||
- **Guard:** `TestChunkLayer_WALOnlyOverlapReadNeverReturnsUntouchedZero` (`core/storage/chunk_layer_races_test.go`).
|
||||
- **#118 review, Recover and the barrier.** Recover must take the capture barrier. Otherwise a record at H+1 could be copied into a HEAD labelled H.
|
||||
- **Guard:** `TestChunkCut_RecoverWaitsForTheCaptureBarrier` (`core/storage/chunk_layer_precopy_test.go`).
|
||||
|
||||
---
|
||||
|
||||
# Part 3. Verification, lessons, known issues
|
||||
|
||||
## 3.1 Test methods
|
||||
## 2.1 Test methods
|
||||
|
||||
| Layer | Method | Example |
|
||||
|---|---|---|
|
||||
@@ -490,12 +342,12 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
| Crash tests | Real process SIGKILL, then reopen and compare | `TestWALStoreCheckpointSIGKILLCrashWindows` |
|
||||
| Real-service integration | Build tag `chunkstore_integration`; real SeaweedFS processes | `TestIntegration_DeleteVolumeThenGC` |
|
||||
| Binary tests | Real `blockvolume` and `blockmaster` binaries | `TestBinaryWorkspaceLeaseOptInOwnsCLEANShutdown` (`cmd/blockvolume/workspace_lease_binary_test.go`) |
|
||||
| Lab packets | Sealed scripts and expected results, run on lab hosts, with automatic teardown that reports a run as not clean if anything is left behind | the two-host lifecycle run (Part 2.7) |
|
||||
| Lab packets | Sealed scripts and expected results, run on lab hosts, with automatic teardown that reports a run as not clean if anything is left behind | the two-host lifecycle run ([agent workspace design §10](agent-workspace-design.md#10-tests)) |
|
||||
| Scenario runner (soak, chaos) | Test intent lives in YAML in this repo (`testops/`); the open-source `sw-test-runner` handles orchestration, cleanup and artifacts | `testops/README.md`, `testops/scenarios/` |
|
||||
| Model checking | TLA+ specifications for the chunk lifecycle, host takeover, WAL crash recovery, cut capture, the authority store, RF=2 failover and GC timing (the specifications in [`docs/spec/`](../spec/README.md)); each guard has a "remove it and get a counterexample" check | found the #152 issues, the torn-wrap loss (#159/#156) and the clock-skew gap (#158) |
|
||||
| Review | Independent review rounds per PR, each finding turned into a failing test first; an independent repository-wide review | see Known issues |
|
||||
|
||||
## 3.2 What is not covered
|
||||
## 2.2 What is not covered
|
||||
|
||||
- **CI runs the short suite only.** The test workflow (`.github/workflows/test.yml`) runs `go build`, `go vet` and `go test -short` on pull requests and on `main`. Integration (`chunkstore_integration`), kernel (ublk, NVMe initiator) and lab tests run on development and Linux test hosts.
|
||||
- **Fuzzing covers the on-disk and remote decoders, not the wire parsers.** #175 added Go fuzz targets: `FuzzDecodeWALEntry`, `FuzzWALEntryRoundTrip`, `FuzzDecodeWALEntryFields` (`core/storage/wal_entry_fuzz_test.go`); `FuzzSmartWALDecode`, `FuzzSmartWALRecordFields`, `FuzzSmartWALRoundTrip` (`core/storage/smartwal/record_fuzz_test.go`); `FuzzParallelWALDecodeRecord`, `FuzzParallelWALRecordRoundTrip`, `FuzzParallelWALDecodeHeader` (`core/storage/parallelwal/codec_fuzz_test.go`); `FuzzDecodeManifestJSON`, `FuzzDecodeHeadDocument` (`core/frontend/chunkstore/decode_fuzz_test.go`). Their seed corpora run as ordinary tests; open-ended runs use `go test -fuzz`. The NVMe/TCP and iSCSI PDU parsers are not fuzzed.
|
||||
@@ -504,7 +356,7 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
- **Environment-sensitive tests:** Linux-only tests, tests that need a SeaweedFS binary, and tests that need the kernel ublk driver. Two frontend process tests are flaky on `main`.
|
||||
- **Model checking is small-scale and design-level:** 2–3 volumes or hosts, 4–6 LSNs, bounded clocks. The specifications are mapped to code by reading, so every counterexample must also become a Go test.
|
||||
|
||||
## 3.3 Lessons learned
|
||||
## 2.3 Lessons learned
|
||||
|
||||
| Issue | Symptom | Root cause | Fix | Guard test |
|
||||
|---|---|---|---|---|
|
||||
@@ -517,16 +369,14 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
| torn wrap | Synced writes lost after a plain power cut | the WAL writer reused bytes the persisted superblock still retained, and replay used physical order | #159 (reuse only persisted-released bytes) and #156 (replay by LSN) | `TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords`, `TestWALStoreRecoverLastWriterWinsAcrossScanOrder` |
|
||||
| #152 | Four concurrency bugs in volume delete, caught before merge | rollback and claim checks not bound to one delete incarnation; a lost token; a lock released early | incarnation-bound commit, no cascade, request ids | `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne` |
|
||||
| #157 | Old and new hosts could serve together after a forced move | no clock-skew margin between the master's grant and the host's self-fence | #158: skew bound on both sides | `TestWorkspaceSkewSeparatesOldServingFromForcedGrant` |
|
||||
| #172 | After a failed `fsync`, the next `Sync` retried and acknowledged on success, although the kernel may have dropped the pages | `fsync` errors were not sticky | #172: the first failure latches a terminal fault for the open store | `TestWALStoreWALFsyncFailureIsSticky`, `TestWALStoreQueuedSyncAfterAFailedFsyncIsRefused` |
|
||||
|
||||
## 3.4 Known issues and work in progress
|
||||
## 2.4 Known issues and work in progress
|
||||
|
||||
These are tracked for fixes. Most were raised by an independent review of this repository.
|
||||
These are tracked for fixes. Most were raised by an independent review of this repository. Gaps specific to one product line are in that line's document: [agent workspace known gaps](agent-workspace-design.md#14-known-gaps) and [Kubernetes known gaps](kubernetes-block-design.md#12-known-gaps).
|
||||
|
||||
- **Moving a workspace back to a host with a surviving local file.** A fresh volume claims HEAD before serving. Since #167, a non-fresh attach reads HEAD first; if another holder published it, the attach fails closed with `ErrChunkStaleLocalRoot` (`core/frontend/durable/provider_chunk.go`): the volume is not served, and one log line and the status evidence name the local root to remove or quarantine, after which the next attach starts fresh from HEAD. **Follow-up:** recreate the local root from HEAD automatically instead of refusing.
|
||||
- **`fsync` errors are not sticky.** After a failed physical sync, the next `Sync` retries `fsync` and acknowledges on success (`walstore.go` `syncWALBatch`). On Linux the dirty pages may already be gone. **Planned fix:** a failed `fsync` puts the store into a terminal error state.
|
||||
- **NVMe/TCP H2CData offset overflow.** The `DATAO + length` bound check is done in 32-bit arithmetic and can wrap, so one malformed PDU can panic the process (`core/frontend/nvme/session.go` `recvH2CData`). Reachable from loopback by default. **Planned fix:** 64-bit arithmetic, offset and R2T consistency checks, and bounds on wire-supplied allocations.
|
||||
- **Process notes in source comments.** #162 removed reviewer names and decision timestamps from code comments. A few comments still cite internal review labels (for example "ruling F1") where a neutral design rationale would be clearer.
|
||||
- **Filer conditional update: multi-filer and old-filer cases.** Reading the open-source SeaweedFS filer: `UpdateEntry` takes an exclusive lock on the path before it validates `expected_extended`. The concurrent case against one pinned filer is tested (#163, see 3.2). Not tested: several filers sharing a store, and a filer that predates the field (there is no capability probe). **Planned:** a multi-filer test and a probe.
|
||||
- **fsync latency (about 7 ms against 3 ms local).** Leads to measure with the `/status/durable` histograms:
|
||||
- the group committer waits a full 1 ms unless 64 waiters are queued, so at queue depth 1 every `fsync` pays at least 1 ms;
|
||||
- the checkpoint superblock `fsync` runs under the exclusive store lock, stalling reads and writes each flush cycle.
|
||||
@@ -534,8 +384,5 @@ These are tracked for fixes. Most were raised by an independent review of this r
|
||||
- **Forged records in user data.** WAL records are not bound to a store incarnation or lap, so bytes inside user data that happen to decode as a valid record could be replayed by the defensive scan. **Planned:** an incarnation nonce and lap in the next format, plus a clean-shutdown marker in the meantime.
|
||||
- **Mid-history WAL corruption only warns** (§1.2 step 2). Fixing it needs the synced watermark in the next format.
|
||||
- **No authentication** on the control plane, the replication channel or the filer client. Frontends bind to loopback by default. **Planned:** mTLS and role checks for destructive operations.
|
||||
- **Default RPO is unbounded.** No automatic cut is enabled by default; the integrator cuts at semantic points (after an agent step, before a risky command, on detach).
|
||||
- **The master is a single point of failure.** A master outage longer than the lease stops I/O on every workspace, and recovery is a forced move.
|
||||
- **Cut cost.** The barrier pause includes copying every non-staged candidate chunk (up to the dirty threshold, 512 chunks by default), held in RAM until upload. A 4 KiB write re-uploads its 4 MiB chunk, and a read miss after a move fetches the whole chunk with no request coalescing.
|
||||
- **GC is manual.** Needles uploaded without a persisted key binding are never reclaimed. An intent stamped by a host clock running ahead of the GC runner fails the whole pass (liveness, not safety).
|
||||
- **blockmaster is a single instance.** There is no master high availability. A master outage longer than the lease stops I/O on every workspace, and recovery is then a forced move; Kubernetes volumes cannot fail over while it is down.
|
||||
- **Formats are exact-version.** The superblock, HEAD and segment formats are checked exactly and fail closed; the walstore superblock has no CRC. A format change needs a dual-reader release.
|
||||
@@ -0,0 +1,315 @@
|
||||
# Kubernetes block volumes: design
|
||||
|
||||
This document describes the Kubernetes block line: block volumes for app pods through a PVC and the CSI driver, with optional synchronous RF=2 or RF=3 replication. It covers how the code works, the invariants, where each is enforced, the tests, and what is not done yet.
|
||||
|
||||
**Status: alpha.** Supported lab clusters only, not production. What is available, gated, source-gated or planned, and which images go with which path, is maintained in [Kubernetes status](../kubernetes-status.md); this document does not repeat that table.
|
||||
|
||||
The three design documents:
|
||||
|
||||
| Document | Covers |
|
||||
|---|---|
|
||||
| [Core design](block-design.md) | The shared core: frontends and the Backend contract, walstore, smartwal (experimental), durability and `Sync`, authority and epochs, the replication engine, recovery; verification, lessons and known issues across the codebase |
|
||||
| [Agent workspace design](agent-workspace-design.md) | Agent workspace disks (proof of concept): one local replica per workspace, cuts to SeaweedFS, snapshots, forks, GC, host moves |
|
||||
| Kubernetes block design (this document) | The product view of Kubernetes volumes: CSI, Helm and the operator controllers, replication and failover, multipath, promotion, readiness, the operation layer |
|
||||
|
||||
The replication engine itself (shipping by LSN, barriers, durability modes, replica fencing, catch-up and rebuild decisions) is a core component and is described in [core §1.6](block-design.md#16-replication-and-failover). Conventions are those of the core document: code references name a file and a function; test references name the test function and its file.
|
||||
|
||||
## Contents
|
||||
|
||||
- [1. Topology](#1-topology)
|
||||
- [2. CSI driver lifecycle](#2-csi-driver-lifecycle)
|
||||
- [3. Helm chart and operator controllers](#3-helm-chart-and-operator-controllers)
|
||||
- [4. Replication and failover](#4-replication-and-failover)
|
||||
- [5. iSCSI ALUA, multipath and NVMe/TCP ANA](#5-iscsi-alua-multipath-and-nvmetcp-ana)
|
||||
- [6. Authority promotion](#6-authority-promotion)
|
||||
- [7. Readiness](#7-readiness)
|
||||
- [8. Operation layer](#8-operation-layer)
|
||||
- [9. Alpha scope and what is not supported](#9-alpha-scope-and-what-is-not-supported)
|
||||
- [10. Invariants and tests](#10-invariants-and-tests)
|
||||
- [11. Review directions](#11-review-directions)
|
||||
- [12. Known gaps](#12-known-gaps)
|
||||
|
||||
---
|
||||
|
||||
## 1. Topology
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph API["Kubernetes API"]
|
||||
PVC["PVC + StorageClass"]
|
||||
CRD["SwBlock* custom resources"]
|
||||
end
|
||||
subgraph CTRL["CSI controller Deployment"]
|
||||
CC["csi-provisioner, csi-attacher, blockcsi controller"]
|
||||
end
|
||||
OPS["operator controllers: sw-block ops (opt-in)"]
|
||||
BM["blockmaster, 1 replica: authority, launcher, evidence"]
|
||||
subgraph VOL["blockvolume Deployments, one per replica, applied by the launcher"]
|
||||
P["r1: primary"]
|
||||
R2["r2: replica"]
|
||||
R3["r3: replica"]
|
||||
P -->|"ship by LSN, barrier"| R2
|
||||
P -->|"ship by LSN, barrier"| R3
|
||||
end
|
||||
subgraph NODE["app node: CSI node DaemonSet"]
|
||||
CN["kubelet, blockcsi node"] --> INI["iscsiadm + dm-multipath, or nvme connect"]
|
||||
end
|
||||
PVC --> CC
|
||||
CC -->|"gRPC: LifecycleService, EvidenceService"| BM
|
||||
CC -->|"create SwBlockVolume"| CRD
|
||||
OPS -->|"gRPC: ClusterEvidenceService"| BM
|
||||
OPS -->|"status, Events, finalizer"| CRD
|
||||
BM -->|"apply Deployments, stream AssignmentFact"| VOL
|
||||
VOL -->|"gRPC: ReportHeartbeat"| BM
|
||||
CN -->|"gRPC: EvidenceService, current target"| BM
|
||||
INI -->|"iSCSI or NVMe/TCP: active path"| P
|
||||
INI -.->|"standby path, multipath opt-in"| R2
|
||||
```
|
||||
|
||||
| Component | What it is | Code |
|
||||
|---|---|---|
|
||||
| blockmaster | one Deployment (`replicas: 1`, host network). The only component that mints epochs; it records volume intent, places replicas, publishes assignments, collects heartbeats and serves evidence. All its gRPC services share one listener (Helm port 9333). | `cmd/blockmaster`; `core/host/master/host.go`; services in `core/rpc/proto/control.proto` |
|
||||
| blockvolume | one Deployment per volume replica, created by blockmaster's launcher, pinned to a node by `kubernetes.io/hostname`. Not a chart workload. | `core/launcher/k8s_renderer.go` `RenderBlockVolumeDeployments`; `k8s_reconciler.go` `ReconcileBlockVolumeDeployments` |
|
||||
| CSI controller | Deployment: `blockcsi` with csi-provisioner and csi-attacher | `cmd/blockcsi/main.go` `run`; `core/csi/controller.go` |
|
||||
| CSI node | privileged DaemonSet with node-driver-registrar; loads `iscsi_tcp`, `nvme_tcp`, `dm_multipath`, `scsi_dh_alua` | `core/csi/node.go` |
|
||||
| Custom resources | group `block.seaweedfs.com`, version `v1alpha1`: `SwBlockCluster`, `SwBlockVolume`, `SwBlockReplicaEligibility`, `SwBlockReplicaRebuild`, `SwBlockReplicaFailback`, `SwBlockFrontendPublication` | `charts/seaweed-block` |
|
||||
| Operator controllers | opt-in Deployments running `sw-block ops <name>` (§3) | `cmd/sw-block/main.go`; `core/ops` |
|
||||
|
||||
Wire protocols: blockvolume heartbeats are unary `ObservationService.ReportHeartbeat` calls; assignments arrive on the server stream `AssignmentService.SubscribeAssignments` as `AssignmentFact` (volume, replica, epoch, endpoint version, data and control addresses, peers). Primary to replica traffic is the replication protocol of `core/transport/protocol.go`. Node initiators reach blockvolume over iSCSI (Helm base port 3260) or NVMe/TCP (base port 4420). Every gRPC client dials with insecure credentials (§12).
|
||||
|
||||
## 2. CSI driver lifecycle
|
||||
|
||||
Driver `block.csi.seaweedfs.com`. Identity advertises `CONTROLLER_SERVICE` only (`core/csi/identity.go`). With `--master`, `blockcsi` builds three blockmaster clients: `ControlLifecycleProvisioner` (`LifecycleService`), `ControlStatusLookup` (`EvidenceService`) and `ControlEventReporter` (`ObservationService`) (`core/csi/master_backend.go`).
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
autonumber
|
||||
participant K as kubelet / CSI sidecars
|
||||
participant C as blockcsi controller
|
||||
participant N as blockcsi node
|
||||
participant M as blockmaster
|
||||
participant V as blockvolume (primary)
|
||||
K->>C: CreateVolume (StorageClass parameters)
|
||||
C->>M: LifecycleService.CreateVolume (desired intent only)
|
||||
C->>C: optional: create or patch the SwBlockVolume object
|
||||
M->>V: launcher applies Deployments, assignment at epoch 1
|
||||
K->>C: ControllerPublishVolume
|
||||
C->>M: EvidenceService.QueryVolumeStatus
|
||||
M-->>C: current target: iSCSI portals and IQN, or NVMe addresses and NQN
|
||||
K->>N: NodeStageVolume (publish context)
|
||||
N->>M: refresh the target before trusting the context
|
||||
N->>V: iSCSI login on every portal, or nvme connect per address
|
||||
N->>N: format if needed, mount, write .transport .volume .target
|
||||
K->>N: NodePublishVolume (bind mount into the pod)
|
||||
```
|
||||
|
||||
- **CreateVolume** (`ControllerServer.CreateVolume`): needs a name and a capacity; accepts Mount or Block access types with `SINGLE_NODE_WRITER` only. StorageClass parameters: `replicationFactor` (default 1), `sw-block.seaweedfs.com/protocol` (`iscsi` by default, or `nvme`; also accepted as `protocol` or `frontendProtocol`, and conflicting values are refused), `sw-block.seaweedfs.com/nvme-transport` (with nvme only, default `tcp`), and `stage2_multipath`. blockmaster records desired intent only; it does not mint an assignment or epoch on this call. The CR is created through `InClusterSwBlockVolumeRegistrar.EnsureVolumeObject`, with a merge-patch on conflict.
|
||||
- **DeleteVolume** calls `LifecycleService.DeleteVolume`.
|
||||
- **ControllerPublishVolume** looks up the current target (`LookupPublishTarget`) and returns a publish context with `protocol`, `iscsiAddr(s)`, `iqn`, `nvmeAddr(s)`, `nqn`, `nvmeTransport`, `stage2_multipath` (`backend.go` `publishContext`). With multipath on, it waits up to 90 s for at least two paths. No target is `NotFound`; no frontend fact is `FailedPrecondition`. `ControllerUnpublishVolume` does nothing.
|
||||
- **NodeStageVolume** (`NodeServer.NodeStageVolume`): `refreshPublishContext` asks blockmaster for the current target first, so a re-stage after failover finds the new primary. iSCSI (`stageISCSI`): discovery, optional CHAP from the node-stage secret, login on every portal, with multipath the dm device by IQN (`linux_util.go` `GetMultipathDeviceByIQN`), then `FormatAndMount` (ext4 by default). NVMe (`stageNVMe`): `nvme connect` per address, wait up to 60 s, mount; NVMe uses kernel native multipath, no dm layer. After a successful stage the node reports `csi_reattach_observed` (`reportCSIReattachObserved`).
|
||||
- **NodeUnstageVolume** unmounts, then logs out or disconnects; after a plugin restart it uses the files written into the staging directory.
|
||||
- **NodePublishVolume** bind-mounts the staged path. Capabilities: `STAGE_UNSTAGE_VOLUME` only; `NodeGetInfo` reports topology key `topology.block.csi.seaweedfs.com/node` and 256 volumes per node.
|
||||
|
||||
**Idempotency.** A repeated create with the same spec is a no-op; a different size, RF, protocol or transport is a conflict (`lifecycle.FileStore.CreateVolume`, `ErrVolumeConflict`). Stage onto a mounted path succeeds only for the same volume identity (`validateMountedStagingVolume`); a logged-in session with no staged identity fails closed; a failed mount or device lookup rolls back the login or connect; unstage with nothing mounted still succeeds.
|
||||
|
||||
## 3. Helm chart and operator controllers
|
||||
|
||||
The chart is `charts/seaweed-block`. It deploys blockmaster (with `--launcher-kubernetes-apply`), the CSI controller and node, the `CSIDriver` (`attachRequired: true`), the CRDs, RBAC, a StorageClass (default name `sw-block-dynamic`, `allowVolumeExpansion: false`), and the operator controllers below. `sw-block ops generate-helm-values` writes a values file for a cluster.
|
||||
|
||||
Key values: `blockNodes[]`; `ports.iscsiBase`, `ports.nvmeBase`, `ports.statusBase`; `network.externalISCSI` (requires `chap.enabled`), `network.externalNVMe`, `network.externalStatus`; `stage2Multipath.enabled` (false); `restartPersistence.mode` (ephemeral by default) and `blockmaster.stateHostPath`; `replication.expectedSlotsPerVolume`, `replication.ackProfile`, `compat.launcherReplicationAckFlag` (false); `blockmaster.launcherStatus`.
|
||||
|
||||
**Operator controllers.** Each is a Deployment running `sw-block ops <name>`; every one is off by default (`create: false`), and the executors also default to dry run.
|
||||
|
||||
| Controller | Reconciler | Writes |
|
||||
|---|---|---|
|
||||
| operator-status | `OperatorStatusReconciler` | `SwBlockCluster` and `SwBlockVolume` status and Events, from blockmaster `ClusterEvidenceService`. Read, status and events RBAC only. |
|
||||
| lifecycle-owner | `LifecycleOwnerReconciler` | the protection finalizer on `SwBlockVolume` (§8), boxed in by a ValidatingAdmissionPolicy |
|
||||
| authority-executor | `AuthorityExecutorReconciler` | eligibility and rebuild status; mutation classes `ack_eligibility` and `rebuild_traffic` |
|
||||
| rebuild, failback and frontend-publication target owners | (one per kind) | create their own CR kind |
|
||||
| failback-executor | `FailbackExecutorReconciler` | calls `FailbackService.ExecuteFailback` (gRPC or HTTP) |
|
||||
| frontend-publication-executor | (executor) | posts to blockmaster `/runtime/frontend-publication`, which checks the authority line and reports the result; it does not change a frontend |
|
||||
|
||||
## 4. Replication and failover
|
||||
|
||||
**Replication factor.** Per volume, from the StorageClass `replicationFactor` (default 1), passed to `LifecycleService.CreateVolume`. On the failover path one RF applies to the whole cluster: blockmaster `--expected-slots-per-volume` (default 3; Helm sets it from `replication.expectedSlotsPerVolume`, falling back to RF), and `core/authority/topology.go` `validateVolumeTopology` rejects a whole observation snapshot if any volume has a different slot count or two slots share a replica or server id (the anti-affinity rule).
|
||||
|
||||
**Durability mode.** Cluster-wide, not per StorageClass. `blockvolume --replication-ack best-effort|sync-quorum|sync-all` selects `replication.DurabilityBestEffort`, `DurabilitySyncQuorum` (a majority, the primary counts) or `DurabilitySyncAll` (`cmd/blockvolume/main.go` `parseReplicationAckProfile`; semantics in [core §1.6](block-design.md#16-replication-and-failover)). The launcher renders it from blockmaster `--launcher-replication-ack`, which the chart passes from `replication.ackProfile` only when `compat.launcherReplicationAckFlag: true`. A default install therefore runs best-effort.
|
||||
|
||||
**Detection.**
|
||||
- blockvolume heartbeats every 2 s (`--heartbeat-interval`; `core/host/volume/host.go` `buildReport`). Each slot carries reachable, `ready_for_primary`, eligible, withdrawn, incarnation, `unhealthy_reason` and its frontends.
|
||||
- blockmaster expires an observation after `--freshness-window` (30 s).
|
||||
- The volume reports `recovery_timeout` after `--recover-timeout` (30 s) and `wal_corrupt`, `io_error` or `role_admission_failed` at once (`core/host/volume/recovery_watchdog.go`; [core §1.7](block-design.md#17-recovery-and-typed-fail-closed-reasons)).
|
||||
- A restarted primary keeps its authority for one boot-grace period per incarnation, but not after 3 restarts in 10 minutes or an explicit unhealthy report (`core/authority/primary_boot_grace.go`; `topology.go` `PrimaryBootFlapRestarts`, `PrimaryBootFlapWindow`).
|
||||
|
||||
**Who decides.** blockmaster's product loop (`core/host/master/product_loop.go` `RunLifecycleProductTick`) builds a snapshot and submits it to the topology controller.
|
||||
- RF=2: `TopologyController.decideVolume` (`core/authority/controller.go`) keeps an acceptable primary; otherwise, unless boot grace holds, `chooseFailoverCandidate` picks a ready, eligible, reachable replica and asks for `IntentReassign`.
|
||||
- RF=3: in addition, `applyPromotionEvidenceGate` probes `/status` and `/status/durable` on every replica (`core/host/master/promotion_probe.go`) and picks a ready candidate with the highest durable LSN, ties broken by the lowest replica id (§6). The probe needs the status endpoints rendered (`--launcher-status`, Helm `blockmaster.launcherStatus`); without it RF=3 promotion is blocked with `no_promotion_ready_candidate`.
|
||||
|
||||
**Epoch and delivery.** `Publisher.applyWithWorkspaceMove` (`core/authority/authority.go`) mints the per-volume maximum epoch plus one for a reassignment, persists it (`AuthorityStore.Put` writes before the in-memory change), then pushes a new `AssignmentFact` to subscribers. The new primary fences its own listener and persists its epoch floor before it serves; replicas raise their floor, so frames from the old primary are refused (`fenceSelfWithPeers`, `ReplicaListener.FenceAsPrimary`, `raiseFloor`; [core §1.6](block-design.md#16-replication-and-failover)).
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
autonumber
|
||||
participant P1 as blockvolume r1 (primary, epoch N)
|
||||
participant M as blockmaster
|
||||
participant R2 as blockvolume r2
|
||||
participant R3 as blockvolume r3
|
||||
participant H as node initiator (multipath)
|
||||
P1--xM: heartbeats stop, or report unhealthy_reason
|
||||
Note over M: observation expires after the freshness window
|
||||
M->>R2: probe /status and /status/durable (RF=3 gate)
|
||||
M->>R3: probe /status and /status/durable
|
||||
M->>M: pick the ready candidate with the highest durable LSN
|
||||
M->>M: Publisher mints epoch N+1 and persists it
|
||||
M->>R2: AssignmentFact: primary at epoch N+1, peers
|
||||
R2->>R2: fence own listener, persist epoch floor, open frontend
|
||||
M->>R3: AssignmentFact: replica at epoch N+1
|
||||
R3->>R3: raise epoch floor to N+1
|
||||
opt old primary still running
|
||||
P1->>R3: ship frame at epoch N
|
||||
R3-->>P1: refused: below the floor
|
||||
end
|
||||
H->>R2: path state query: ALUA Active/Optimized or ANA Optimized
|
||||
H->>R2: I/O moves to the new active path
|
||||
```
|
||||
|
||||
**Returned replica.** When an old primary sees a fact that names another primary, it re-admits itself as a supporting replica if it is listed in the peers, with its frontend gated; otherwise it closes ingress (`core/host/volume/subscribe.go` `decodeSelfPeerAssignment`; `fenceSelfWithPeers`). Moving the primary back (failback) and rebuilding a returned replica are explicit, opt-in operator paths:
|
||||
- **Failback:** a `SwBlockReplicaFailback` CR → `FailbackExecutorReconciler` → `FailbackService.ExecuteFailback` → `core/authority/failback_runtime.go` `FailbackAuthorityRuntime.ExecuteFailback`, which checks the expected current replica and epoch, then reassigns through the publisher. blockmaster serves it only with `--failback-runtime-rpc`.
|
||||
- **Rebuild:** a `SwBlockReplicaRebuild` CR → `AuthorityExecutorReconciler` → `POST /runtime/rebuild` on the primary's status server (`core/host/volume/status_server.go` `handleRuntimeRebuild`) → a dual-lane rebuild ([core §1.6](block-design.md#16-replication-and-failover)) → eligibility after the rebuild is caught up. The blockvolume flag `--runtime-rebuild-endpoint` is not rendered by the launcher or the chart.
|
||||
|
||||
## 5. iSCSI ALUA, multipath and NVMe/TCP ANA
|
||||
|
||||
The frontends only report path state; they never decide it. The state is a projection of the volume's local view of its assignment (`volume.AdapterProjectionView`).
|
||||
|
||||
| Local view | iSCSI ALUA (`cmd/blockvolume/iscsi_alua_provider.go`) | NVMe ANA (`cmd/blockvolume/nvme_ana_provider.go`) | Data commands |
|
||||
|---|---|---|---|
|
||||
| frontend healthy (serving primary) | Active/Optimized | Optimized | served |
|
||||
| engine recovering | Transitioning | Change | rejected |
|
||||
| engine healthy or idle, frontend not primary | Standby | Non-optimized | rejected |
|
||||
| engine degraded | Unavailable | Inaccessible | rejected |
|
||||
| no view, or volume or replica mismatch | Unavailable | Inaccessible | rejected |
|
||||
|
||||
- **iSCSI** (`core/frontend/iscsi/alua.go`, `scsi.go`): with a provider, standard INQUIRY advertises implicit ALUA (TPGS = 01b); VPD page 0x83 adds target-port-group and relative-port designators; REPORT TARGET PORT GROUPS returns one descriptor. Every path shows the same device identifier (hashed from IQN and volume), and each replica has its own target port group. On a non-active path, READ, WRITE and SYNCHRONIZE CACHE return NOT READY with ASCQ 0x0B, target port in standby (`aluaDataReject`). A standby path can still log in through a probe backend (`cmd/blockvolume/iscsi_probe_provider.go`). Active/Non-optimized is never reported, and explicit ALUA (SET TARGET PORT GROUPS) is not implemented.
|
||||
- **NVMe/TCP** (`core/frontend/nvme/ana.go`, `admin_log.go` `handleANALogPage`, `admin_features.go` `watchANAChangeNotice`): the ANA log page 0x0c, one ANA group, and an asynchronous event when the state changes (the change count follows epoch and endpoint version). A path that is not Optimized rejects data commands with a path-related status (`io.go` `metadataOnlyReject`).
|
||||
- **Node multipath:** opt-in with `stage2Multipath.enabled` (`blockcsi --stage2-multipath`). The controller then groups the frontends of all replicas by IQN into one multi-path publish context (`ControlStatusLookup`, `WithMultipathPublishTargets`), and `stageISCSI` logs into every portal and mounts the dm-multipath device. The chart does not ship a `multipath.conf`; the node's multipath configuration is the operator's.
|
||||
|
||||
## 6. Authority promotion
|
||||
|
||||
The volume computes whether it may become primary; blockmaster decides; only the publisher mints the epoch.
|
||||
|
||||
**Promotion-ready fact** (`core/engine/promotion_ready.go` `BuildPromotionReadyFact`), reported in heartbeats as `ready_for_primary`. The first failing check wins:
|
||||
|
||||
| Order | Reason | Condition |
|
||||
|---|---|---|
|
||||
| 1 | `not_member` | the replica is not a member of the current assignment |
|
||||
| 2 | `not_reachable` | the reachability probe has not succeeded |
|
||||
| 3 | `not_caught_up` | the recovery decision is not "none" (catch-up or rebuild pending) |
|
||||
| 4 | `fence_pending` | its fence has not completed at the current epoch |
|
||||
| 5 | `post_close_durable_ack_needed` | a recovered replica has not delivered its post-rebuild durable acknowledgement |
|
||||
| 6 | `promotion_ready` | all checks pass |
|
||||
|
||||
**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 effective rule is "ready, highest durable LSN" (§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.
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Serving: assignment at epoch N
|
||||
Serving --> Suspect: heartbeat expired or unhealthy_reason
|
||||
Suspect --> Serving: boot grace holds, or current primary probes ready
|
||||
Suspect --> Blocked: no promotion-ready candidate
|
||||
Blocked --> Suspect: next product tick
|
||||
Suspect --> Reassigned: candidate chosen, IntentReassign
|
||||
Reassigned --> Serving: publisher persists epoch N+1, new primary fences and serves
|
||||
```
|
||||
|
||||
(The states in this diagram are descriptive names for the decision in `RunLifecycleProductTick` and `decideVolume`; they are not code types.)
|
||||
|
||||
## 7. Readiness
|
||||
|
||||
**blockvolume process readiness.** At start, blockvolume blocks local readiness ("awaiting durable recovery") and opens and recovers its store (`cmd/blockvolume/durable_startup.go` `openAndRecoverDurable`). Three outcomes: ready (the block clears), faulted (the process stays up and reports a typed reason: `wal_corrupt`, `io_error`, or `recovery_timeout` from the watchdog) or fatal (the process exits). While blocked, `applyFact` admits nothing, primary or supporting, and stores the assignment to replay once readiness clears. The status server (`core/host/volume/status_server.go`) exposes `/status`, `/status/peers`, `/status/durable`, `/status/nvme`, `/status/frontend-capabilities`; its projection carries `Healthy`, `FrontendPrimaryReady`, `AuthorityRole` (primary, superseded, unknown), `ReplicationRole` (none, recovering, not_ready, replica_ready, unknown), `UnhealthyReason` and catch-up lag.
|
||||
|
||||
**Managed volume readiness** (`core/ops/managed_volume_model.go` `classifyManagedVolume`): one status per volume (invalid, unsafe, blocked, recovering, recovered, degraded, ready, unknown) over sub-states for Kubernetes, authority, CSI, host path, recovery and workload. Known blockers win before staleness, and stale evidence is never ready:
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["evidence for one volume"] --> B{"multiple primaries observed?"}
|
||||
B -->|yes| INV["invalid"]
|
||||
B -->|no| C{"known blocker?"}
|
||||
C -->|yes| BLK["unsafe or blocked"]
|
||||
C -->|no| D{"evidence stale or status unreachable?"}
|
||||
D -->|yes| UNK["unknown (Ready=Unknown)"]
|
||||
D -->|no| E{"recovered transparently or by reattach?"}
|
||||
E -->|yes| REC["recovered"]
|
||||
E -->|no| F{"primary available?"}
|
||||
F -->|no| BLK2["blocked"]
|
||||
F -->|yes| G{"first volume verified?"}
|
||||
G -->|yes| RDY["ready"]
|
||||
G -->|no| RCV["recovering or unknown"]
|
||||
```
|
||||
|
||||
Known blockers, in priority order: a returned replica serving its frontend (unsafe), a publish target on loopback across nodes, a CSI image pull failure, a WAL integrity fault, an NVMe or multipath identity problem, a blocked CSI node, a failed writer mount, a host path not multipathed after failover, an unbound PVC.
|
||||
|
||||
Conditions (`Ready`, `Blocked`, `Recovered`, `Invalid`, `Recovering`, evidence stale) are written to the CR status by operator-status (`managedVolumeConditionsForProjection`).
|
||||
|
||||
## 8. Operation layer
|
||||
|
||||
The operation layer is read-only except for one mutation: the finalizer `block.seaweedfs.com/swblockvolume-protection` on `SwBlockVolume` (`core/ops/delete_safety_contract.go`).
|
||||
|
||||
- **Decision:** `EvaluateSwBlockVolumeDeleteSafety` returns not requested; requested with unknown safety (cleanup evidence missing or stale); blocked (residue left); or releasable, which allows the finalizer release. Evidence older than 15 minutes is stale (`MaxEvidenceAge`).
|
||||
- **Flow:** operator-status writes `status.deleteSafety`; `LifecycleOwnerReconciler.Reconcile` adds the finalizer, and releases it only when the release is allowed (`PatchSwBlockVolumeFinalizers`); otherwise it holds and emits a Warning Event.
|
||||
- **Idempotency:** reconciliation is level-based (it re-reads every pass and skips objects that already carry the finalizer); there is no operation journal. Dry run is the default.
|
||||
- **Admission:** a ValidatingAdmissionPolicy (fail closed) lets the lifecycle-owner service account change nothing on a `SwBlockVolume` except adding or removing its own finalizer.
|
||||
- **Action vocabulary** (`managed_volume_model.go`, evaluated by `managed_volume_action_evaluator.go` `EvaluateManagedVolumeAction`): `observe.*`, `safe_k8s.*`, and `authority.*` actions (request promotion, reintegrate, rebuild or fail back a returned replica), in read-only, dry-run or scripted mode; unknown, disabled or under-specified actions fail closed. The executors added later (§3) are off by default and guard their CRs with the expected current replica and epoch.
|
||||
|
||||
## 9. Alpha scope and what is not supported
|
||||
|
||||
Status per feature is in [Kubernetes status](../kubernetes-status.md) and [what you should not expect yet](../kubernetes-status.md#what-you-should-not-expect-yet). Confirmed in the code at this revision:
|
||||
|
||||
- **Not implemented:** snapshots, clones and restore (`VolumeContentSource` is not read), expansion (no `EXPAND_VOLUME`; the StorageClass sets `allowVolumeExpansion: false`), `ListVolumes`, `GetCapacity`, `NodeGetVolumeStats`. They fall through to the CSI "unimplemented" stubs.
|
||||
- **Access modes:** `ReadWriteOnce` only (`SINGLE_NODE_WRITER`); RWX and ROX are refused.
|
||||
- **Raw block volumes** are accepted at create, but stage always formats and mounts, and publish is a bind mount (code reading; no test covers raw block).
|
||||
- **No topology-aware provisioning**, one RF per cluster on the failover path, and a single blockmaster (no master high availability).
|
||||
- **Security:** iSCSI CHAP is the only authentication. CSI, blockvolume and the controllers talk to blockmaster over plaintext, unauthenticated gRPC; NVMe/TCP has no authentication; there is no encryption.
|
||||
|
||||
## 10. Invariants and tests
|
||||
|
||||
| Invariant | Enforced in | Test |
|
||||
|---|---|---|
|
||||
| Only the publisher mints epochs; a reassignment is the per-volume maximum plus one | `core/authority/authority.go` `Publisher.applyWithWorkspaceMove` | `TestG8_0_Publisher_ReassignAdvancesPerVolumeEpochAcrossReplicaSlots` (`core/authority/g8_0_authority_failover_test.go`); `TestG9F2_AssignmentRequestShapeHasNoEpochOrEndpointVersion` (`core/host/master/authority_request_bridge_test.go`) |
|
||||
| CSI never constructs authority facts; create records intent only | import boundary; `ControlLifecycleProvisioner` | `TestG15a_CSI_DoesNotImportAuthorityOrConstructAssignmentFacts` (`core/csi/boundary_guard_test.go`); `TestG15c_ControllerCreateVolume_RecordsDesiredIntentOnly` (`core/csi/controller_test.go`) |
|
||||
| An epoch is persisted before it is published | `AuthorityStore.Put` | `TestDurableAuthority_PutFailureRollsBackInMemoryState` (`core/authority/authority_restart_test.go`) |
|
||||
| Failover only to a ready, eligible, reachable candidate; no candidate mints nothing | `candidateAcceptable`, `chooseFailoverCandidate` | `TestG8_0_TopologyController_FailoverRequiresReadyEligibleReachableCandidate` (`core/authority/g8_0_authority_failover_test.go`) |
|
||||
| RF=3 promotes only with a fresh probe, to a candidate covering the frontier | `applyPromotionEvidenceGate` | `TestMountedFailover_ProductLoopRF3PromotesCandidateCoveringSyncAckProbe`, `TestMountedFailover_ProductLoopRF3BlocksFailoverWithoutFreshPromotionProbe` (`core/host/master/product_loop_test.go`) |
|
||||
| A superseded replica never feeds the adapter and reports not ready | `applyFact` | `TestHost_ApplyFact_Supersede_NeverCallsAdapterOrReplication` (`core/host/volume/apply_fact_test.go`); `TestHost_BuildReport_SupersededReplicaNotReadyForPrimary` (`core/host/volume/frontend_targets_test.go`) |
|
||||
| A new primary fences its listener before it serves; replicas refuse frames below their floor | `ReplicaListener.FenceAsPrimary`; `raiseFloor` | `TestG2_PromotedHostRefusesShipFromDeposedPrimary` (`core/host/volume/g2_self_fence_test.go`); `TestG1_RestartedReplicaRefusesShipBelowItsAcknowledgedEpoch` (`core/transport/g1_durable_floor_test.go`) |
|
||||
| A killed primary's acknowledged write is readable from the new primary | failover path end to end | `TestG8B_L2PrimaryKill_ReassignsAuthorityToReplica`, `TestG8B_L2PrimaryKill_NewPrimaryReadsAcknowledgedISCSIWrite` (`cmd/blockvolume/g8_l2_failover_test.go`) |
|
||||
| Path state only reports; a mismatch fails closed; a non-active path never completes data I/O | ALUA and ANA providers; `aluaDataReject`; `metadataOnlyReject` | `TestP6ALUA_NonActiveStatesRejectDataPath` (`core/frontend/iscsi/p6_alua_test.go`); `TestProjectionALUAProvider_FailsClosedOnIdentityMismatch` (`cmd/blockvolume/iscsi_alua_provider_test.go`); `TestP4NVMe_StandbyProbePathRejectsDataCommands` (`core/frontend/nvme/p4_probe_backend_test.go`) |
|
||||
| A re-stage after failover uses the fresh target, not the stale context | `refreshPublishContext` | `TestG15e_CSIReattachUsesFreshPublishTargetAfterUnstage`, `TestNodeStage_UsesPortalSpecificISCSISessionAfterFailover` (`core/csi/node_test.go`) |
|
||||
| Stale evidence is never ready; dual primaries are invalid | `classifyManagedVolume` | `TestManagedVolumeProjection_InvalidDualPrimaryBeatsReady` (`core/ops/managed_volume_model_test.go`); `TestManagedVolumeProjection_EvidenceStaleIsNotReady` (`core/ops/managed_volume_conditions_test.go`) |
|
||||
| The lifecycle owner touches only its finalizer, and releases it only when allowed | reconciler; admission policy | `TestLifecycleOwnerReconcilerReleasesOnlyProtectionFinalizerWhenAllowed` (`core/ops/lifecycle_owner_controller_test.go`); the admission policy is covered by TestOps scenarios only |
|
||||
|
||||
**Test methods.** Unit and component tests per package; binary tests with real `blockvolume` and `blockmaster` (`cmd/blockvolume`); manifest tests that render the chart's templates and check RBAC and packaging (`core/ops/kubernetes_crd_manifests_test.go`, `cmd/blockcsi/g15d_manifest_test.go`); and scenario runs in supported lab clusters, whose intent lives in `testops/` and whose results are in the [release notes](../releases/README.md). Mounted failover, multipath and restart persistence are lab-gated, not CI.
|
||||
|
||||
## 11. Review directions
|
||||
|
||||
- Nothing outside the publisher may construct an epoch or an assignment; CSI and the operator controllers only record intent or read evidence.
|
||||
- A new path-state or readiness source must fail closed on an identity mismatch and on stale evidence.
|
||||
- Any new data command on a frontend must pass the same path-state gate.
|
||||
- An opt-in executor must check the expected current replica and epoch, and must stay off by default.
|
||||
- A chart change that affects durability or promotion must say which flags reach blockvolume and blockmaster.
|
||||
|
||||
## 12. Known gaps
|
||||
|
||||
These are found by reading the code at this revision; most are tracked for fixes. Gaps that apply to the whole codebase are in the [core known issues](block-design.md#24-known-issues-and-work-in-progress).
|
||||
|
||||
- **No primary lease on the Kubernetes path.** A primary cut off from blockmaster keeps admitting I/O under its last assignment until it observes a newer one. The replicas' epoch floors refuse its shipped frames, which fails its `Sync` under `sync_quorum` or `sync_all`; under best-effort, the chart default, its local `fsync` still acknowledges. Its frontend also keeps reporting Active/Optimized, so a node that still reaches it may keep using that path. The workspace lease (`--workspace-lease`) requires `walstore-chunk` and is not rendered for Kubernetes volumes.
|
||||
- **Synchronous durability needs two settings.** `replication.ackProfile` reaches blockvolume only with `compat.launcherReplicationAckFlag: true`.
|
||||
- **The RF=3 required frontier is not wired.** `RequiredLSNByVolume` is never set by `cmd/blockmaster`, so promotion picks the ready candidate with the highest durable LSN without checking it against the last acknowledged sync.
|
||||
- **Returned-replica rebuild is not deployable through Helm.** The executor exists, but `--runtime-rebuild-endpoint` is not rendered.
|
||||
- **CSI publish is not fenced per node.** `ControlStatusLookup` ignores the node id.
|
||||
- **The CSI node uses the controller's service account**, with write access to PVs, PVCs and `SwBlockVolume` objects.
|
||||
- **A create conflict surfaces as `Internal`.** blockmaster returns gRPC `AlreadyExists`, which `ControllerServer.CreateVolume` does not map to its conflict error.
|
||||
- **Nothing in Go code deletes the `SwBlockVolume` CR**; the gate scripts do.
|
||||
- **No authentication or encryption** on the control plane (see §9).
|
||||
- **Single blockmaster.** Volumes cannot fail over while it is down.
|
||||
@@ -288,7 +288,7 @@ For a new contributor:
|
||||
2. `deploy/k8s/alpha/README.md`
|
||||
3. `docs/architecture.md`
|
||||
4. this document
|
||||
5. `docs/roadmap.md`
|
||||
5. `docs/design/block-design.md`, `docs/design/kubernetes-block-design.md`
|
||||
|
||||
For implementation work:
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Fsync latency breakdown
|
||||
|
||||
For walstore and walstore-chunk, read the existing volume-host endpoint:
|
||||
**Use this when:** you need to find where `fsync` time goes on a walstore or
|
||||
walstore-chunk volume, stage by stage, from the volume host's status endpoint.
|
||||
|
||||
Read the volume-host endpoint:
|
||||
|
||||
```sh
|
||||
curl -fsS 'http://127.0.0.1:PORT/status/durable?volume=VOLUME'
|
||||
@@ -22,12 +25,12 @@ Each distribution exposes `Count`, `SumNanos`, 64 non-cumulative `Buckets`, `P50
|
||||
|
||||
`Frontend.Writes` includes FUA, `FUAWrites` is its subset, `Flushes` counts Flush commands and `Failed` counts unsuccessful handler results. Invalid ublk range/buffer requests are rejected before the timing hook or provider lookup: they remain counted by the device-level error/request counters, but add no backend-owned frontend sample. NVMe handler refusal counts retain their existing instrumentation. Non-durable backends retain their existing dispatch behavior. ublk and NVMe/TCP use the same optional backend timing seam; no guest filesystem or hardware is required for accounting tests.
|
||||
|
||||
A guest fsync may produce two Flush commands; compare command counts and physical Sync samples before attributing two disk syncs. Shared physical Sync and per-request queue samples have different populations. Do not add p50/p99 values, or subtract one stage's p99 from another's. Large queue time suggests batching/scheduling; large FileSync suggests local file/disk latency; large BackendSync with small local stages can include replication or metadata work. This diagnostic does not separately time each replication/checkpoint operation. Kernel transport completion and guest scheduling require the M5 external measurement. No frontend tuning or durability-policy change is included.
|
||||
A guest fsync may produce two Flush commands; compare command counts and physical Sync samples before attributing two disk syncs. Shared physical Sync and per-request queue samples have different populations. Do not add p50/p99 values, or subtract one stage's p99 from another's. Large queue time suggests batching/scheduling; large FileSync suggests local file/disk latency; large BackendSync with small local stages can include replication or metadata work. This diagnostic does not separately time each replication/checkpoint operation. Kernel transport completion and guest scheduling are outside these histograms and need an external measurement.
|
||||
|
||||
## Verification and overhead scope
|
||||
|
||||
Unit controls cover known histogram quantiles, concurrent counters, failed/refused requests, both frontend dispatchers, batch waiter-versus-physical counts and dedup. The initial status contract test fails on unmodified main because the existing JSON has no durability histograms.
|
||||
Unit tests cover known histogram quantiles, concurrent counters, failed/refused requests, both frontend dispatchers, batch waiter-versus-physical counts and dedup.
|
||||
|
||||
The PR records an interleaved main-versus-instrumented comparison of the existing file-backed TCP paired-Flush proxy (`SW_BLOCK_SYNC_PERF=1`, `TestNVMePairedFlushLatency`), using prebuilt binaries on tp04. It measures request-path default-on overhead; it is not mounted fio, a guest fsync result, or a device-specific latency promise. M5 may proceed independently if this PR has not landed.
|
||||
Default-on overhead was checked with an interleaved before-versus-after comparison of the file-backed TCP paired-Flush proxy (`SW_BLOCK_SYNC_PERF=1`, `TestNVMePairedFlushLatency`). That measures request-path overhead only; it is not mounted fio, a guest fsync result, or a device-specific latency promise.
|
||||
|
||||
The ublk Target forwards the optional timing hook through its lazy providerBackend to the actual durable backend. Initial provider lookup is included in ReceiveToBackend. If provider open fails before a durable backend is available, the request returns that error without a second open attempt, and no backend-owned frontend histogram exists for that failure. The device-level error counters remain the source for such failures. A later request may retry normally. Caller tests start the real Target with only the kernel device constructor replaced; NVMe uses a real TCP target and FUA capsule.
|
||||
@@ -1,5 +1,10 @@
|
||||
# Kubernetes App Demo
|
||||
|
||||
**Use this when:** you present Seaweed Block on Kubernetes with local images
|
||||
and want viewers to see an ordinary app pod write a PVC and a replacement pod
|
||||
read it back. For the supported install path, use the
|
||||
[Kubernetes quickstart](quickstart-kubernetes.md).
|
||||
|
||||
This demo shows `seaweed-block` from the application's point of view.
|
||||
|
||||
The app is a normal Kubernetes pod using a normal PVC. The storage stack is the
|
||||
@@ -109,6 +114,8 @@ This demo does not claim:
|
||||
|
||||
- multi-node production readiness,
|
||||
- failover while the app remains mounted,
|
||||
- durable state across blockvolume pod restart,
|
||||
- durable state across blockvolume pod restart (restart persistence with a
|
||||
hostPath state root is a separate gated path, see
|
||||
[Kubernetes status](kubernetes-status.md)),
|
||||
- real operator reconciliation,
|
||||
- performance or soak readiness.
|
||||
@@ -8,9 +8,6 @@ matches which release line.
|
||||
evidence for every claim below. [User capabilities](user-capabilities.md)
|
||||
describes current behavior and the read-only operations commands.
|
||||
|
||||
This page holds the detailed Kubernetes claim lists that used to be in the
|
||||
top-level README. The text is unchanged.
|
||||
|
||||
The Kubernetes path is focused on one user-visible loop:
|
||||
|
||||
```text
|
||||
|
||||
@@ -1,27 +1,47 @@
|
||||
# `docs/` Overview
|
||||
# `docs/` overview
|
||||
|
||||
This directory contains public and technical documentation.
|
||||
An index of this directory. Internal planning and historical design notes
|
||||
belong under `internal/docs/`, not here.
|
||||
|
||||
## Public / Contributor Docs
|
||||
## Design and evidence
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `architecture.md` | Short product architecture overview. |
|
||||
| `developer-architecture.md` | Deeper module-by-module architecture for contributors. |
|
||||
| `runtime-state-machines.md` | Mermaid state-machine and loop overview. |
|
||||
| `roadmap.md` | Alpha roadmap and non-claims. |
|
||||
| `quickstart-kubernetes.md` | First-volume Kubernetes quickstart. |
|
||||
| `user-capabilities.md` | User-facing current capabilities, operations commands, status vocabulary, and non-claims. |
|
||||
| `operations-v1.md` | Legacy V1 alpha operations manual; use quickstart and release notes for current claims. |
|
||||
| `kubernetes-app-demo.md` | Presentation-friendly Kubernetes app + PVC demo. |
|
||||
| `design/block-design.md` | Core design: frontends, walstore and smartwal, durability, authority, replication engine, recovery; verification and known issues |
|
||||
| `design/agent-workspace-design.md` | Agent workspace disks: chunk backend, cuts, snapshots, forks, GC, host moves, security model |
|
||||
| `design/kubernetes-block-design.md` | Kubernetes block volumes: CSI, Helm and operator, replication and failover, multipath, readiness |
|
||||
| `spec/` | TLA+ specifications of the protocols where a bug would lose data |
|
||||
| `workspace-measurements.md` | Measured workspace results and how each was measured |
|
||||
| `kubernetes-status.md` | Kubernetes feature status, claims, non-claims and release images |
|
||||
| `releases/` | Release notes: what each release claimed and the run evidence behind it |
|
||||
|
||||
## Calibration Evidence
|
||||
## Operations
|
||||
|
||||
`calibration/` contains evidence documents still referenced by calibration code.
|
||||
Keep them here until those references move to the shared design archive.
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `standalone-deployment.md` | Run `blockmaster` and `blockvolume` with systemd, outside Kubernetes |
|
||||
| `quickstart-kubernetes.md` | Kubernetes first-volume path with Helm |
|
||||
| `user-capabilities.md` | Kubernetes capabilities, read-only operations commands, status vocabulary |
|
||||
| `kubernetes-app-demo.md` | Presentation demo: an app pod writes and a replacement pod reads one PVC |
|
||||
| `chunk-manifests.md` | Chunk upload settings and the HEAD/segment manifest format |
|
||||
| `workspace-lease.md` | Workspace host lease, clean and forced moves, clock skew |
|
||||
| `fsync-latency.md` | Reading the per-stage `fsync` histograms under `/status/durable` |
|
||||
|
||||
## Documentation Rule
|
||||
## Engineering references (Kubernetes line)
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `architecture.md` | Short Kubernetes product architecture |
|
||||
| `developer-architecture.md` | Module-by-module boundaries for contributors |
|
||||
| `runtime-state-machines.md` | Control-plane, CSI and frontend loops |
|
||||
| `operations-v1.md` | Legacy V1 alpha operations manual; use the quickstart and release notes for current claims |
|
||||
| `wiki/` | Engineering wiki (MkDocs): code map, state machines, deep dives |
|
||||
|
||||
## Calibration evidence
|
||||
|
||||
`calibration/` contains evidence documents still referenced by calibration
|
||||
code (`core/calibration`, `cmd/sparrow`).
|
||||
|
||||
## Documentation rule
|
||||
|
||||
If a document is meant for external users, avoid internal phase or gate labels.
|
||||
Internal planning, readiness tracking, audits, and historical design notes
|
||||
belong under `internal/docs/`, not in this public docs entry path.
|
||||
@@ -1,6 +1,7 @@
|
||||
# Kubernetes Quick Start
|
||||
|
||||
This guide is the current alpha path for Seaweed Block on Kubernetes.
|
||||
**Use this when:** you install the Kubernetes alpha with Helm on a supported
|
||||
test cluster and want to create, verify and clean up a first PVC-backed volume.
|
||||
|
||||
It shows the user loop:
|
||||
|
||||
@@ -37,10 +38,8 @@ The quickstart proves:
|
||||
- The example resources and host-side residue are cleaned up.
|
||||
|
||||
It does not prove production HA, backup/restore, broad upgrade safety, broad
|
||||
platform compatibility, broad mutating operator lifecycle, mutating admin
|
||||
workflows, or production UI. The separate v0.5 beta-candidate lifecycle-owner
|
||||
path is limited to the Seaweed Block `SwBlockVolume` protection finalizer and
|
||||
requires matching release images.
|
||||
platform compatibility, a mutating operator, or a production UI; see
|
||||
[what you should not expect yet](kubernetes-status.md#what-you-should-not-expect-yet).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -140,12 +139,8 @@ sw-block ops generate-helm-values \
|
||||
```
|
||||
|
||||
Current validated published quickstart image tag:
|
||||
`sha-dc2972d0059b`.
|
||||
|
||||
This tag covers the v0.4 read-only/status foundation path. The v0.5
|
||||
bounded lifecycle-owner path requires matching `sw-block` and `sw-block-csi`
|
||||
images published from the Phase 44 release commit; do not use the older
|
||||
quickstart tag to validate lifecycle-owner behavior.
|
||||
`sha-dc2972d0059b`. It covers the v0.4 read-only/status path; later paths
|
||||
need matching images, see [release images](kubernetes-status.md#release-images).
|
||||
|
||||
Published image digests:
|
||||
|
||||
@@ -351,8 +346,7 @@ bash scripts/run-basic-app-example.sh "$PWD"
|
||||
|
||||
The `"$PWD"` argument is the repository root for both helper scripts.
|
||||
|
||||
Use Helm for the v0.3 alpha release path unless you are specifically testing
|
||||
local script activation.
|
||||
Use Helm unless you are specifically testing local script activation.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -425,14 +419,8 @@ other run owns the resources.
|
||||
|
||||
## Current Alpha Limitations
|
||||
|
||||
- This is an alpha Helm path, not a production installer or operator.
|
||||
- The dashboard is local and read-only, not a production hosted UI.
|
||||
- Mutating admin workflows are not exposed: no promote, repair, rebuild,
|
||||
failback, delete, backup, restore, or cleanup button.
|
||||
- Broad upgrade and rollback safety are not claimed beyond the gated alpha
|
||||
smoke path.
|
||||
- Backup, snapshot, and restore are not claimed.
|
||||
- Broad distro/kernel/initiator compatibility is not claimed.
|
||||
- Performance, RTO, and SLO numbers are not claimed.
|
||||
- Transparent Kubernetes node-loss without pod recreate is not claimed by this
|
||||
quickstart.
|
||||
This is an alpha Helm path, not a production installer or operator. The
|
||||
dashboard is local and read-only. Broad upgrade and rollback safety are not
|
||||
claimed beyond the gated alpha smoke path, and performance, RTO and SLO numbers
|
||||
are not claimed. The full list is in
|
||||
[what you should not expect yet](kubernetes-status.md#what-you-should-not-expect-yet).
|
||||
@@ -20,6 +20,11 @@ is still outside the supported boundary.
|
||||
- [NVMe/RDMA Capability Boundary](nvme-rdma-capability-boundary.md)
|
||||
- [WAL Multi-Block Record Opt-In Boundary](wal-multiblock-opt-in.md)
|
||||
|
||||
Agent workspace disks (`walstore-chunk`) are not part of any release yet; they
|
||||
are a proof of concept. Their measurements are in
|
||||
[workspace measurements](../workspace-measurements.md) and their design in the
|
||||
[agent workspace design](../design/agent-workspace-design.md).
|
||||
|
||||
## Version Boundary
|
||||
|
||||
- `v0.1-alpha` is the engineering alpha foundation: CSI/PVC plumbing,
|
||||
|
||||
@@ -19,8 +19,8 @@ compatibility, performance improvement, and production SLOs remain non-claims.
|
||||
## Implemented Standalone Path
|
||||
|
||||
```text
|
||||
Linux nvme-rdma initiator on m01
|
||||
-> RoCE data-plane address 10.0.0.3 on m02
|
||||
Linux nvme-rdma initiator on lab host A
|
||||
-> RoCE data-plane address 10.0.0.3 on lab host B
|
||||
-> Linux kernel nvmet-rdma target
|
||||
-> configfs namespace backed by /dev/nbdX
|
||||
-> Seaweed Block NBD request bridge
|
||||
@@ -130,7 +130,7 @@ cleanup_status=ok
|
||||
|
||||
TestOps run `20260718-025048-9d6a` passed 14/14 actions with fresh matching
|
||||
product and CSI images. A dynamic PVC selected `nvmeTransport: rdma`, the target
|
||||
published `10.0.0.3:4420`, CSI mounted it on m01, and writer/reader verification
|
||||
published `10.0.0.3:4420`, CSI mounted it on lab host A, and writer/reader verification
|
||||
passed.
|
||||
|
||||
```text
|
||||
@@ -178,6 +178,6 @@ must not be described as an acceleration path or used for an SLO claim.
|
||||
|
||||
## Related External RDMA Work
|
||||
|
||||
`C:\work\rdma\seaweed-mono-rdma-refresh` and `C:\work\rdma\sra-next` provide
|
||||
useful VFS/object/RustVolume/RDMA/NIXL evidence. They do not implement the
|
||||
standard Linux NVMe/RDMA target used here and remain separate product surfaces.
|
||||
Other SeaweedFS RDMA work (file, object and volume-server data paths) is
|
||||
separate. It does not implement the standard Linux NVMe/RDMA target used here
|
||||
and remains a separate product surface.
|
||||
@@ -763,6 +763,31 @@ report_dashboard_agree=true
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
## Later Write-Path Experiments (Not Adopted)
|
||||
|
||||
Results of the experiments that followed Phase 165.
|
||||
None of them changes a claim on this page.
|
||||
|
||||
- Phase 166 implements the RF2 NVMe/RDMA reconnect and exact path-replacement
|
||||
contract, but its live close gate is blocked by lab topology: a third remote
|
||||
RoCE-capable Kubernetes initiator is required before mounted RDMA multipath
|
||||
survival or reconnect can be claimed.
|
||||
- Phase 167 (`parallel-walstore`, a parallel write engine) preserves its tested
|
||||
global LSN/frontier, crash recovery and catch-up/rebuild semantics, but
|
||||
remains explicit and opt-in because its 4 KiB throughput/scaling gate failed.
|
||||
- Phase 168 tested a bounded Linux `io_uring` submission/completion owner.
|
||||
Correctness passed, but native execution reached only 0.96x the legacy
|
||||
single-writer path and 0.96x four-writer scaling, so the candidate was
|
||||
removed.
|
||||
- Phase 169 changed the persistence unit to checksummed multi-entry segments.
|
||||
Format, recovery, Sync and failure semantics passed, but the optimistic gate
|
||||
measured four-writer scaling of only `0.772x` its one-writer rate and
|
||||
`0.990x` the positioned control, so the candidate was removed before
|
||||
checkpoint/rebuild integration.
|
||||
- Phase 170 moved performance work back to the default `walstore` path and its
|
||||
existing-format `appendBatch` seam. Direct I/O, fixed buffers, FUA and device
|
||||
atomic-write support remain evidence-gated follow-ups.
|
||||
|
||||
## Representative Release Smoke
|
||||
|
||||
When matching release images exist, the smoke should use the exact image pair:
|
||||
@@ -824,8 +849,8 @@ This evidence does not claim:
|
||||
- Performance, throughput, latency, or production SLO.
|
||||
- Broad Linux distro, kernel, initiator, or cloud compatibility.
|
||||
- Production HA, node-loss survival, or arbitrary unbounded path churn.
|
||||
- Broad Linux host AER/ANA notification compatibility beyond the m02 supported
|
||||
lab gate.
|
||||
- Broad Linux host AER/ANA notification compatibility beyond the supported
|
||||
lab host gate.
|
||||
- Published-image Kubernetes dynamic NVMe reconnect after control-plane desired
|
||||
path-set replacement/failover until matching release images pass a release
|
||||
smoke. The current evidence is source-gated.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,8 +1,15 @@
|
||||
# Seaweed Block User Capabilities
|
||||
# Seaweed Block User Capabilities (Kubernetes)
|
||||
|
||||
This page describes what a user can do with the current Seaweed Block alpha,
|
||||
what evidence is available, and what is still outside the product boundary.
|
||||
For the exact release evidence, see [`releases/README.md`](releases/README.md).
|
||||
**Use this when:** you operate the Kubernetes alpha and need to know what it
|
||||
does today, which read-only operations commands exist, and what its status
|
||||
vocabulary means.
|
||||
|
||||
This page covers Kubernetes block volumes. Agent workspace disks (chunk
|
||||
snapshots, forks and host moves, a proof of concept) are described in the
|
||||
[README](../README.md#agent-workspace-disks-chunk-lifecycle) and the
|
||||
[standalone deployment](standalone-deployment.md) guide. Feature status is in
|
||||
[Kubernetes status](kubernetes-status.md); the exact release evidence is in
|
||||
[`releases/README.md`](releases/README.md).
|
||||
|
||||
## Primary User Loop
|
||||
|
||||
@@ -233,15 +240,9 @@ The current status model is negative-first:
|
||||
|
||||
## Cleanup
|
||||
|
||||
The documented cleanup path is:
|
||||
|
||||
```bash
|
||||
helm uninstall sw-block --namespace kube-system
|
||||
bash scripts/uninstall-k8s-alpha.sh "$PWD"
|
||||
bash scripts/verify-helm-cleanup.sh
|
||||
```
|
||||
|
||||
The verifier checks:
|
||||
The cleanup commands and the expected clean output are in the
|
||||
[quickstart](quickstart-kubernetes.md#cleanup). `scripts/verify-helm-cleanup.sh`
|
||||
checks:
|
||||
|
||||
- Helm and Kubernetes resources,
|
||||
- iSCSI sessions,
|
||||
@@ -251,17 +252,6 @@ The verifier checks:
|
||||
- product processes,
|
||||
- hostPath residue.
|
||||
|
||||
Expected clean shape:
|
||||
|
||||
```text
|
||||
cleanup_status=ok
|
||||
k8s_residue_count=0
|
||||
iscsi_residue_count=0
|
||||
multipath_residue_count=0
|
||||
process_residue_count=0
|
||||
hostpath_residue_count=0
|
||||
```
|
||||
|
||||
## Recommended Learning Path
|
||||
|
||||
1. Run the quickstart: install, first PVC, writer/reader, cleanup.
|
||||
@@ -275,21 +265,13 @@ hostpath_residue_count=0
|
||||
|
||||
## Explicit Non-Claims
|
||||
|
||||
- Not production-ready.
|
||||
- No production-grade operator or controller-manager lifecycle.
|
||||
- No broad mutating admin/dashboard workflow. The current bounded mutations are
|
||||
limited to lifecycle-owner finalizer ownership and authority-executor ACK
|
||||
eligibility target status.
|
||||
- No finalizer ownership by operator-status.
|
||||
- No automatic cleanup execution.
|
||||
- No upgrade or rollback execution.
|
||||
- No promote, repair, rebuild, failback, delete, backup, restore, or cleanup
|
||||
The full list is in
|
||||
[what you should not expect yet](kubernetes-status.md#what-you-should-not-expect-yet).
|
||||
In addition:
|
||||
|
||||
- The current bounded mutations are limited to lifecycle-owner finalizer
|
||||
ownership and authority-executor ACK eligibility target status. There is no
|
||||
promote, repair, rebuild, failback, delete, backup, restore, or cleanup
|
||||
mutation through UI/API/operator.
|
||||
- No backup/snapshot/restore workflow.
|
||||
- No returned-replica rebuild traffic, frontend publication, or automated
|
||||
failback.
|
||||
- No transparent Kubernetes node-loss failover without pod recreate.
|
||||
- No NVMe ANA parity for the transparent failover path.
|
||||
- No broad distro/kernel/initiator compatibility matrix.
|
||||
- No upgrade or rollback execution.
|
||||
- No performance, RTO, RPO, or SLO claim.
|
||||
@@ -3,13 +3,15 @@
|
||||
This page maps product responsibilities to code entry points. It is a guide for
|
||||
developers; it is not a complete API reference.
|
||||
|
||||
**Use this when:** you look for the package or file that owns a behavior.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Responsibility | Key files |
|
||||
|---|---|---|
|
||||
| `sw-block` | operations CLI, report/dashboard/explain, operator-status, lifecycle-owner | `cmd/sw-block/main.go` |
|
||||
| `blockmaster` | control-plane master and launcher coordination | `cmd/blockmaster/main.go`, `core/host/master/` |
|
||||
| `blockvolume` | per-volume data-plane process, status endpoint, readiness publishing | `cmd/blockvolume/main.go`, `core/storage/` |
|
||||
| `blockvolume` | per-volume-replica data-plane process, frontends, status endpoint, readiness publishing | `cmd/blockvolume/main.go`, `core/storage/` |
|
||||
| `blockcsi` | Kubernetes CSI controller/node integration | `cmd/blockcsi/main.go`, `core/csi/` |
|
||||
|
||||
## Core Packages
|
||||
@@ -18,10 +20,25 @@ developers; it is not a complete API reference.
|
||||
|---|---|
|
||||
| `core/ops` | ManagedVolume model, status projection, CRD writer, action evaluator, lifecycle-owner |
|
||||
| `core/csi` | CSI CreateVolume/DeleteVolume, Kubernetes metadata registration, target staging |
|
||||
| `core/storage` | WAL/store behavior and dirty-failure handling |
|
||||
| `core/lifecycle` | desired volumes, node inventory, placement intent, verified placement |
|
||||
| `core/authority` | assignment and epoch publication, workspace moves |
|
||||
| `core/launcher` | renders and reconciles per-replica `blockvolume` workloads |
|
||||
| `core/host/master` | blockmaster observation and volume coordination |
|
||||
| `core/host/volume` | blockvolume host: assignment, projection bridge, status, workspace lease |
|
||||
| `core/frontend/iscsi`, `nvme`, `ublk` | block frontends over one Read / Write / Sync backend contract |
|
||||
| `core/frontend/durable` | durable provider and the per-I/O lineage gate |
|
||||
| `core/frontend/chunkstore` | SeaweedFS chunk backend: HEAD CAS, catalog, snapshots, GC |
|
||||
| `core/storage` | walstore (WAL plus extent), chunk layer, recovery |
|
||||
| `core/storage/smartwal` | experimental in-place engine |
|
||||
| `core/replication`, `core/recovery`, `core/transport` | RF>1 shipping, catch-up and rebuild, replica fencing |
|
||||
| `testops` | scenario descriptions and release gates |
|
||||
|
||||
The [core design](../design/block-design.md) explains the storage,
|
||||
durability, authority and replication packages in depth; the
|
||||
[agent workspace design](../design/agent-workspace-design.md) covers the
|
||||
workspace packages and the [Kubernetes block design](../design/kubernetes-block-design.md)
|
||||
the CSI, operator and promotion packages.
|
||||
|
||||
## Ownership Split
|
||||
|
||||
The current operation layer uses three separate owners:
|
||||
@@ -41,10 +58,9 @@ mutation and prevents lifecycle ownership from becoming a broad operator.
|
||||
|---|---|
|
||||
| Write operator CRD status | `core/ops/operator_status_controller.go` |
|
||||
| Patch Kubernetes status | `core/ops/kubernetes_status_writer.go` |
|
||||
| Evaluate safe actions | `core/ops/action_model.go` |
|
||||
| Evaluate safe actions | `core/ops/managed_volume_action_evaluator.go` |
|
||||
| Add/release protection finalizer | `core/ops/lifecycle_owner_controller.go` |
|
||||
| Register `SwBlockVolume` from CSI | `core/csi/kubernetes_metadata.go` |
|
||||
| Evaluate future read-write action maturity | `core/ops/action_model.go`, future owner executors |
|
||||
| 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` |
|
||||
@@ -54,7 +70,6 @@ mutation and prevents lifecycle ownership from becoming a broad operator.
|
||||
| CRD/RBAC status conformance | `core/ops/kubernetes_status_writer.go`, `core/ops/kubernetes_status_conformance_test.go`, `charts/seaweed-block/crds/` |
|
||||
| blockvolume process readiness | `cmd/blockvolume/main.go`, `core/host/volume/host.go`, `core/frontend/durable/` |
|
||||
| Release image/chart compatibility | `charts/seaweed-block/templates/`, `charts/seaweed-block/values.yaml`, `docs/releases/`, `docs/quickstart-kubernetes.md` |
|
||||
| Future GPUDirect/cuFile probes | no current product code; expected first home is a TestOps/helper utility plus later `core/ops` evidence ingestion |
|
||||
|
||||
## Development Rule
|
||||
|
||||
@@ -71,7 +86,3 @@ failure bundle evidence
|
||||
```
|
||||
|
||||
If any item is missing, the feature is not ready for product code.
|
||||
|
||||
Future GPU data-path work has an additional rule: identify whether the claim is
|
||||
file path (`cuFile` over a mounted PVC), object path (`cuObject`/S3-style), or
|
||||
transport path (RDMA/NVMe). Do not mix those claims in one code path or test.
|
||||
@@ -1,81 +0,0 @@
|
||||
# Engineering Coverage Matrix
|
||||
|
||||
This matrix is the review checklist for whether the wiki covers the last
|
||||
several months of Seaweed Block work. It is domain-based rather than phase-based
|
||||
because developers need to understand subsystems, ownership, and invariants, not
|
||||
just the order in which phases happened.
|
||||
|
||||
Coverage levels:
|
||||
|
||||
| Level | Meaning |
|
||||
|---|---|
|
||||
| `linked` | source docs are linked, but wiki explanation is thin |
|
||||
| `mapped` | wiki explains the domain, ownership, code area, and source evidence |
|
||||
| `deep` | wiki includes background, contract, ownership, state transitions, code entry points, evidence, failure taxonomy, implementation checklist, and QA gates |
|
||||
|
||||
## Domain Coverage
|
||||
|
||||
| Domain | Why it matters | Source evidence | Current wiki coverage | Next doc work |
|
||||
|---|---|---|---|---|
|
||||
| Product positioning and claims | Prevents over-claiming and release confusion | `docs/releases/`, `docs/roadmap.md`, `docs/user-capabilities.md` | mapped | claim-boundary page by release |
|
||||
| Day-1 Kubernetes install and first PVC | User entry path and release smoke | Phase 20, 25, 40, 44 finished plans; quickstart | mapped | install flow diagram and troubleshooting |
|
||||
| CSI lifecycle | PVC/PV path, CreateVolume/DeleteVolume, node stage/publish | `core/csi`, `docs/runtime-state-machines.md`, Phase 44 D2 | deep | expand DeleteVolume details later |
|
||||
| SwBlockVolume CR identity | Bridge from CSI to operation layer | Phase 44 D2 sign-off, `core/csi/kubernetes_metadata.go` | deep | add field-by-field CRD contract later |
|
||||
| operator-status | CRD status, Events, node evidence, cleanup/delete-safety | Phases 35-40, `core/ops` | deep initial | add status writer/schema conformance page |
|
||||
| lifecycle-owner | bounded finalizer add/release | Phases 41-44, lifecycle-owner refs | deep initial | add admission policy field matrix |
|
||||
| Admission/RBAC boundary | Prevents finalizer owner from becoming broad operator | Phase 42 sign-off, Helm templates | linked | VAP/RBAC decision diagram |
|
||||
| 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 | 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 |
|
||||
| Read-write control-plane maturity | Prevents broad operator mutation from outrunning facts/evidence/admission | Phases 38-44, action/finalizer/delete-safety contracts | deep initial | split future safe_k8s, host_cleanup, authority, and data-lifecycle pages when each starts |
|
||||
| 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 |
|
||||
| GPUDirect/cuFile/cuObject | Future GPU data paths need separate block/file/object/transport claims | NVIDIA GDS/cuFile docs, roadmap | deep initial | add hardware-backed compatibility evidence when available |
|
||||
| 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, 44 | deep | keep artifact list aligned with collect script |
|
||||
| Release engineering | Image/chart skew prevention | Phases 40, 44, release notes | deep | keep current release checklist aligned |
|
||||
| Status writer conformance | Real CRD/RBAC/admission validation | Phases 35-42, Phase 40 | deep | turn remaining schema-aware gates into envtest/live |
|
||||
| blockvolume process/readiness | Separates process liveness, diagnostics, durable recovery, and frontend readiness | Phase 34, `cmd/blockvolume` | deep | add flag matrix examples as needed |
|
||||
| Docker volume plugin idea | Future non-K8s adapter | roadmap | linked | investigation page later |
|
||||
|
||||
## Coverage Decision
|
||||
|
||||
The wiki is useful when each major domain has:
|
||||
|
||||
```text
|
||||
problem statement
|
||||
industry/product pattern
|
||||
Seaweed Block ownership model
|
||||
state machine or protocol diagram
|
||||
publish/API shape
|
||||
main code entry points
|
||||
evidence contract
|
||||
failure taxonomy
|
||||
implementation checklist
|
||||
QA gates and failure evidence
|
||||
explicit non-claims
|
||||
```
|
||||
|
||||
## Priority For Deep Pages
|
||||
|
||||
1. CSI lifecycle and `SwBlockVolume` ownership.
|
||||
2. Operation layer v0.5: operator-status + lifecycle-owner + admission.
|
||||
3. ManagedVolume readiness and negative-first priority rules.
|
||||
4. SmartWAL dirty-failure path.
|
||||
5. TestOps authoring and evidence realism.
|
||||
6. Authority/promotion/restart persistence.
|
||||
7. iSCSI ALUA/multipath frontend.
|
||||
8. WAL/frontier/barrier/recovery.
|
||||
9. Live node/CSI evidence.
|
||||
10. Support bundle cold-reader path.
|
||||
11. Returned-replica rebuild readiness.
|
||||
12. Future read-write control-plane maturity.
|
||||
13. GPUDirect/cuFile/cuObject future design.
|
||||
|
||||
These pages cover most of the hard-earned knowledge from the last
|
||||
few months. The rest can remain linked until those are reviewed.
|
||||
@@ -1,281 +0,0 @@
|
||||
# GPUDirect, cuFile, And cuObject Future Design
|
||||
|
||||
This page is a future design note for GPU-oriented data paths. It is not a
|
||||
current Seaweed Block capability.
|
||||
|
||||
## Reader Orientation
|
||||
|
||||
You need this page before proposing:
|
||||
|
||||
- GPUDirect Storage support,
|
||||
- cuFile-based reads/writes from a Seaweed Block PVC,
|
||||
- GPU-to-object-store data paths,
|
||||
- cuObject-like object access,
|
||||
- RDMA/NVMe protocol changes for GPU workloads.
|
||||
|
||||
The product question is:
|
||||
|
||||
```text
|
||||
Can Seaweed storage serve GPU workloads without unnecessary CPU bounce buffers,
|
||||
while preserving the same evidence, fencing, and lifecycle model as the block
|
||||
product?
|
||||
```
|
||||
|
||||
## External Background
|
||||
|
||||
NVIDIA GPUDirect Storage (GDS) is the family of technology that lets supported
|
||||
storage paths move data between storage and GPU memory with reduced CPU
|
||||
copying. cuFile is the user-space API commonly associated with GDS file I/O.
|
||||
|
||||
Useful external references:
|
||||
|
||||
- [NVIDIA GPUDirect Storage documentation](https://docs.nvidia.com/gpudirect-storage/)
|
||||
- [NVIDIA cuFile API reference](https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html)
|
||||
|
||||
Important practical point:
|
||||
|
||||
```text
|
||||
cuFile is a file API path.
|
||||
Seaweed Block is currently a Kubernetes block/PVC path.
|
||||
SeaweedFS object is a different object/API path.
|
||||
```
|
||||
|
||||
So GPUDirect work must not be treated as one flag on the existing block
|
||||
frontend. It is a product train with separate prerequisites and gates.
|
||||
|
||||
## Vocabulary
|
||||
|
||||
| Term | Meaning in this design |
|
||||
|---|---|
|
||||
| GPU memory | CUDA device memory used by training/inference jobs |
|
||||
| GPUDirect Storage | storage-to-GPU path that avoids normal CPU bounce behavior where supported |
|
||||
| cuFile | NVIDIA API for file I/O involving GPU memory |
|
||||
| cuObject | future object-storage style API concept for GPU-oriented object reads/writes |
|
||||
| cuObject path | not current code; design placeholder for SeaweedFS object/S3 integration |
|
||||
| block path | Seaweed Block PVC mounted as filesystem |
|
||||
| object path | SeaweedFS object/S3-style object access |
|
||||
|
||||
## Product Tracks
|
||||
|
||||
### Track A: cuFile Over A Seaweed Block PVC
|
||||
|
||||
Shape:
|
||||
|
||||
```text
|
||||
Kubernetes pod
|
||||
-> mounted Seaweed Block PVC
|
||||
-> filesystem path
|
||||
-> cuFile reads/writes
|
||||
-> GPU memory
|
||||
```
|
||||
|
||||
This is the most natural bridge from Seaweed Block to GPU workloads, but it is
|
||||
not automatically supported just because a PVC mounts. GDS compatibility depends
|
||||
on OS, driver, kernel, filesystem, mount options, device path, and NVIDIA
|
||||
software stack.
|
||||
|
||||
The first question is compatibility:
|
||||
|
||||
```text
|
||||
Can a supported GDS/cuFile stack use the mounted Seaweed Block volume path?
|
||||
```
|
||||
|
||||
Only after compatibility is proven should we optimize the backend.
|
||||
|
||||
### Track B: cuObject / GPU Object Path
|
||||
|
||||
Shape:
|
||||
|
||||
```text
|
||||
GPU workload
|
||||
-> cuObject-like client/API
|
||||
-> SeaweedFS object/S3 path
|
||||
-> object storage data
|
||||
```
|
||||
|
||||
This is not the same product as Seaweed Block. It belongs closer to SeaweedFS
|
||||
object/KV/VFS design. It may share:
|
||||
|
||||
- authentication,
|
||||
- object metadata,
|
||||
- RDMA/network transport ideas,
|
||||
- support-bundle methodology,
|
||||
- TestOps evidence realism.
|
||||
|
||||
But it should not borrow block-volume authority/finalizer semantics without a
|
||||
separate object lifecycle model.
|
||||
|
||||
### Track C: Protocol-Level GPU/RDMA Data Path
|
||||
|
||||
Shape:
|
||||
|
||||
```text
|
||||
GPU memory
|
||||
-> RDMA/NVMe/RoCE capable transport
|
||||
-> storage target
|
||||
```
|
||||
|
||||
This is the deepest path and should come after Track A compatibility and Track
|
||||
B object API shape are understood. It touches transport, memory registration,
|
||||
security, flow control, and failure semantics.
|
||||
|
||||
## Product Contract For A First Gate
|
||||
|
||||
A minimal first claim should be narrow:
|
||||
|
||||
```text
|
||||
On one supported Linux GPU node, a pod can use cuFile against a mounted
|
||||
Seaweed Block PVC and verify byte-correct data transfer with documented
|
||||
environment prerequisites.
|
||||
```
|
||||
|
||||
It should not claim:
|
||||
|
||||
- broad GDS support,
|
||||
- multi-node failover with GPU memory,
|
||||
- GPU-direct over iSCSI unless proven,
|
||||
- object API support,
|
||||
- performance/SLO,
|
||||
- production compatibility across distros/drivers.
|
||||
|
||||
## Architecture Boundary
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[GPU workload] --> B{Access shape}
|
||||
B -->|file path| C[cuFile / GDS]
|
||||
C --> D[Mounted filesystem on PVC]
|
||||
D --> E[Seaweed Block CSI + frontend]
|
||||
B -->|object path| F[cuObject-style client]
|
||||
F --> G[SeaweedFS object/S3 path]
|
||||
B -->|transport path| H[Future RDMA/NVMe data path]
|
||||
H --> I[Storage target]
|
||||
```
|
||||
|
||||
The three branches have different APIs and should have different claims.
|
||||
|
||||
## Required Facts Before Implementation
|
||||
|
||||
Track A needs:
|
||||
|
||||
```text
|
||||
gpu_present=true
|
||||
nvidia_driver_version=<version>
|
||||
cuda_version=<version>
|
||||
gds_installed=true
|
||||
nvidia_fs_loaded=true
|
||||
cufile_available=true
|
||||
filesystem_type=<ext4|xfs|...>
|
||||
mount_options=<...>
|
||||
volume_protocol=<iscsi|nvme>
|
||||
direct_io_supported=<true|false>
|
||||
byte_check_passed=<true|false>
|
||||
```
|
||||
|
||||
Track B needs:
|
||||
|
||||
```text
|
||||
object_api=<s3|native|future>
|
||||
gpu_client_api=<cuObject placeholder>
|
||||
auth_model=<...>
|
||||
object_consistency_model=<...>
|
||||
range_read_semantics=<...>
|
||||
write_commit_semantics=<...>
|
||||
```
|
||||
|
||||
Track C needs:
|
||||
|
||||
```text
|
||||
rdma_device=<...>
|
||||
memory_registration=<...>
|
||||
queue_pair_or_nvme_queue=<...>
|
||||
fencing_model=<...>
|
||||
backpressure_model=<...>
|
||||
data_integrity_check=<...>
|
||||
```
|
||||
|
||||
## State Machine For Track A
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> PrereqProbe
|
||||
PrereqProbe --> Unsupported: missing GPU/driver/GDS/cuFile
|
||||
PrereqProbe --> MountProbe: prerequisites present
|
||||
MountProbe --> Unsupported: filesystem or mount not usable by cuFile
|
||||
MountProbe --> CuFileOpen: file path accepted
|
||||
CuFileOpen --> TransferTest: buffer registration and read/write start
|
||||
TransferTest --> Verified: checksum matches
|
||||
TransferTest --> Blocked: I/O error, fallback, or mismatch
|
||||
Verified --> [*]
|
||||
```
|
||||
|
||||
## Evidence Contract
|
||||
|
||||
A first cuFile gate should emit:
|
||||
|
||||
```text
|
||||
gpu_direct_gate_status=<ok|blocked|unsupported>
|
||||
gpu_model=<name>
|
||||
nvidia_driver_version=<version>
|
||||
cuda_version=<version>
|
||||
gds_version=<version>
|
||||
nvidia_fs_loaded=<true|false>
|
||||
cufile_open=<ok|failed>
|
||||
cufile_read=<ok|failed>
|
||||
cufile_write=<ok|failed>
|
||||
checksum_cpu_path=<hash>
|
||||
checksum_gpu_path=<hash>
|
||||
fallback_detected=<true|false|unknown>
|
||||
volume_protocol=<iscsi|nvme>
|
||||
filesystem=<ext4|xfs|...>
|
||||
mount_path=<path>
|
||||
```
|
||||
|
||||
If fallback cannot be detected reliably, the claim must say only
|
||||
"cuFile API compatibility", not "zero-copy" or "GPUDirect accelerated".
|
||||
|
||||
## Code / Project Map
|
||||
|
||||
| Area | Likely owner |
|
||||
|---|---|
|
||||
| K8s PVC mount path | Seaweed Block CSI |
|
||||
| cuFile smoke utility | new test utility, likely outside core storage first |
|
||||
| GPU environment probe | TestOps runner action or helper script |
|
||||
| object path / cuObject | SeaweedFS object/VFS design, not `core/csi` |
|
||||
| RDMA/NVMe transport | future protocol/transport work |
|
||||
| status/report integration | `core/ops` once evidence format stabilizes |
|
||||
|
||||
## Failure Taxonomy
|
||||
|
||||
| Reason | Meaning |
|
||||
|---|---|
|
||||
| `gpu_not_present` | no usable GPU in test node |
|
||||
| `nvidia_driver_missing` | driver stack absent |
|
||||
| `gds_not_installed` | GPUDirect Storage/cuFile unavailable |
|
||||
| `nvidia_fs_not_loaded` | kernel module/runtime missing |
|
||||
| `filesystem_unsupported` | mounted volume path not compatible |
|
||||
| `direct_path_fallback` | cuFile may be falling back through CPU path |
|
||||
| `checksum_mismatch` | data correctness failed |
|
||||
| `protocol_path_unsupported` | iSCSI/NVMe path not supported for this gate |
|
||||
| `object_semantics_undefined` | cuObject track lacks consistency/commit model |
|
||||
|
||||
## Implementation Checklist
|
||||
|
||||
1. Start with a read-only environment probe; do not change storage code first.
|
||||
2. Write a standalone cuFile smoke utility that can run inside a pod.
|
||||
3. Mount a normal Seaweed Block PVC and run CPU checksum baseline.
|
||||
4. Run cuFile read/write checksum against the same file.
|
||||
5. Record whether the path is API-compatible versus truly accelerated.
|
||||
6. Add TestOps gate with explicit unsupported/blocked reasons.
|
||||
7. Only after compatibility is proven, decide whether iSCSI, NVMe, or a new
|
||||
transport needs optimization.
|
||||
8. Keep cuObject/object-path design separate from PVC/block semantics.
|
||||
9. Add support-bundle evidence before any user-facing claim.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
- No current Seaweed Block release supports GPUDirect/cuFile.
|
||||
- cuFile API success would not automatically prove zero-copy acceleration.
|
||||
- cuObject is a future object-path design placeholder, not current code.
|
||||
- GPU/RDMA transport work must not bypass authority, fencing, recovery, or
|
||||
evidence requirements.
|
||||
@@ -1,186 +0,0 @@
|
||||
# Developer Guide
|
||||
|
||||
The engineering wiki exists to reduce rediscovery. It should answer:
|
||||
|
||||
```text
|
||||
Why was this built?
|
||||
What invariant does it protect?
|
||||
Where is the code?
|
||||
How is it tested?
|
||||
What is still out of scope?
|
||||
```
|
||||
|
||||
## Documentation Layers
|
||||
|
||||
| Layer | Purpose | Source |
|
||||
|---|---|---|
|
||||
| README / quickstart | first user path and narrow claims | `README.md`, `docs/quickstart-kubernetes.md` |
|
||||
| Release notes | exact user-visible claims and image boundary | `docs/releases/` |
|
||||
| Wiki | developer navigation and explanation | `docs/wiki/` |
|
||||
| Finished plans | phase completion and historical decisions | `internal/docs/finished-plans/` |
|
||||
| Ref docs | contracts, audits, design notes | `internal/docs/ref/` |
|
||||
| Protocol docs | invariants and control-model reviews | `internal/docs/protocol/` |
|
||||
| QA sign-offs | evidence that a gate passed or failed | `internal/docs/qa-assignments/` |
|
||||
| TestOps | executable scenario definitions | `testops/` |
|
||||
|
||||
## Writing Rule
|
||||
|
||||
Do not copy a finished plan into the wiki. Instead, write the explanation a new
|
||||
developer needs and link to the source evidence.
|
||||
|
||||
Assume the reader:
|
||||
|
||||
- can read Go, YAML, and shell,
|
||||
- understands basic Kubernetes objects,
|
||||
- does not yet understand block storage, CSI, iSCSI/NVMe, authority, fencing,
|
||||
WAL recovery, or why finalizers are dangerous,
|
||||
- has not followed the phase history.
|
||||
|
||||
Good wiki content:
|
||||
|
||||
- problem context,
|
||||
- short domain primer,
|
||||
- industry terms and standards involved,
|
||||
- what Seaweed Block must deliver,
|
||||
- why the problem is harder than it looks,
|
||||
- ownership boundary,
|
||||
- state transition,
|
||||
- package/function entry point,
|
||||
- gate name that proves the behavior,
|
||||
- explicit non-claim.
|
||||
|
||||
Bad wiki content:
|
||||
|
||||
- phase diary copied line-by-line,
|
||||
- PM wording without code references,
|
||||
- claims that are not backed by QA,
|
||||
- TODO lists without an owner or phase.
|
||||
|
||||
## Deep-Dive Page Standard
|
||||
|
||||
Each deep-dive page should use this shape:
|
||||
|
||||
```text
|
||||
1. Reader orientation
|
||||
What domain is this? Why should a developer care?
|
||||
|
||||
2. Domain background
|
||||
Explain industry terms and standards at a practical level.
|
||||
|
||||
3. Product problem
|
||||
What does Seaweed Block need to deliver? What can go wrong?
|
||||
|
||||
4. Methodology
|
||||
What facts are observed? What constraints matter? Who decides? Where does
|
||||
execution happen? What evidence closes the loop?
|
||||
|
||||
5. State machine / protocol diagram
|
||||
Mermaid first, prose second.
|
||||
|
||||
6. Implementation map
|
||||
Main packages, key structs/functions, commands, Helm/RBAC surfaces.
|
||||
|
||||
7. Phase history
|
||||
Which phases solved which part? Name the meaningful failures too.
|
||||
|
||||
8. QA evidence
|
||||
Which gates prove the behavior? What would fail the gate?
|
||||
|
||||
9. Non-claims and future work
|
||||
What is explicitly not delivered yet?
|
||||
```
|
||||
|
||||
This standard matters because historical design notes can be stale. Use them as
|
||||
source material for explanation and vocabulary, not as current release claims.
|
||||
|
||||
## Implementation-Grade Density
|
||||
|
||||
A deep-dive page is not `deep` because it is long. It is `deep` only if a
|
||||
developer could use it to make a correct code change, write the right gate, and
|
||||
diagnose a failed run.
|
||||
|
||||
For a feature or subsystem page, require these sections:
|
||||
|
||||
| Section | Required content |
|
||||
|---|---|
|
||||
| Protocol / domain background | Industry terms, standards involved, and the Linux/Kubernetes objects that actually participate |
|
||||
| Product contract | The narrow user-visible claim, exact non-claims, and the condition that would make the claim false |
|
||||
| Ownership model | Which component decides, which component executes, which component only observes, and which fields each may write |
|
||||
| State machine | Mermaid state or sequence diagram with success, blocked, stale/unknown, and cleanup paths |
|
||||
| Publish / API shape | CRD fields, CSI publish context, CLI flags, Helm values, Events, status fields, or bundle artifacts |
|
||||
| Code map | Concrete packages, key structs/functions, scripts, charts, and scenarios |
|
||||
| Evidence contract | Stable lines or JSON fields that prove the behavior; not just log examples |
|
||||
| Failure taxonomy | Named blocker reasons, timeouts, and what a cold reader should inspect next |
|
||||
| Implementation checklist | Ordered engineering steps and fail-closed checks needed to implement or change the feature |
|
||||
| QA history | The gates that proved the behavior and the important failures that shaped the design |
|
||||
|
||||
If a page only answers "what is this feature?" it is `summary`. If it also
|
||||
answers "how would I safely implement or modify this feature?" it can be
|
||||
`deep`.
|
||||
|
||||
Use this density especially for storage-path features such as iSCSI ALUA,
|
||||
SmartWAL recovery, authority promotion, returned-replica rebuild, CSI lifecycle,
|
||||
delete safety, and node evidence. Those areas have enough implicit domain
|
||||
knowledge that a short summary hides the real engineering cost.
|
||||
|
||||
## Local Preview
|
||||
|
||||
Install MkDocs Material and serve the site:
|
||||
|
||||
```bash
|
||||
pip install mkdocs-material
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
Open:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8000
|
||||
```
|
||||
|
||||
Docker alternative:
|
||||
|
||||
```bash
|
||||
docker run --rm -it -p 8000:8000 -v "$PWD:/docs" squidfunk/mkdocs-material
|
||||
```
|
||||
|
||||
The site is static. It can be served internally with any static file server
|
||||
after:
|
||||
|
||||
```bash
|
||||
mkdocs build
|
||||
```
|
||||
|
||||
## Diagrams
|
||||
|
||||
Use Mermaid for state machines and sequence diagrams:
|
||||
|
||||
````markdown
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
Ready --> Blocked: evidence fault
|
||||
Blocked --> Unknown: evidence stale
|
||||
Unknown --> Ready: fresh verified evidence
|
||||
```
|
||||
````
|
||||
|
||||
Avoid screenshots for state machines. Mermaid diagrams stay reviewable in Git
|
||||
and can be updated with the code.
|
||||
|
||||
## Code Links
|
||||
|
||||
For links to Markdown docs inside `docs/`, use normal relative Markdown links.
|
||||
MkDocs renders those as site links.
|
||||
|
||||
For links to source code under `cmd/`, `core/`, `charts/`, `scripts/`, or
|
||||
`testops/`, prefer GitHub source links when the target should be clickable in
|
||||
the built site:
|
||||
|
||||
```markdown
|
||||
[operator_status_controller.go](https://github.com/seaweedfs/seaweed-block/blob/main/core/ops/operator_status_controller.go)
|
||||
```
|
||||
|
||||
MkDocs' default site only serves files under `docs_dir`. It does not render
|
||||
repo-root source files as pages unless we add a source-link plugin or copy
|
||||
generated code references into `docs/`. Keep wiki pages as explanations and
|
||||
link to source-of-truth code rather than duplicating code.
|
||||
@@ -1,90 +0,0 @@
|
||||
# Historical Knowledge Sources
|
||||
|
||||
This wiki is built on two generations of design material:
|
||||
|
||||
1. current repo docs under `docs/` and `internal/docs/`;
|
||||
2. older design/tutorial/methodology notes under
|
||||
`C:\work\seaweedfs\sw-block\design`.
|
||||
|
||||
The older material is important because it explains why the system is shaped the
|
||||
way it is. Many current docs record what passed QA; the older docs often explain
|
||||
the block-storage method behind the decisions.
|
||||
|
||||
## Tutorial Series
|
||||
|
||||
Source directory:
|
||||
|
||||
```text
|
||||
C:\work\seaweedfs\sw-block\design\tutorial
|
||||
```
|
||||
|
||||
Important files:
|
||||
|
||||
| File | Use |
|
||||
|---|---|
|
||||
| `01-project-map-and-terms.md` | terminology and mental model |
|
||||
| `02-daemons-flags-and-process-layout.md` | daemon/process layout |
|
||||
| `03-host-master-stream-and-assignment.md` | heartbeat, assignment, master stream |
|
||||
| `04-adapter-single-route-and-async-callbacks.md` | adapter event route and callbacks |
|
||||
| `05-engine-control-protocol.md` | deterministic engine Event/Command loop |
|
||||
| `06-persistence-wal-logical-storage.md` | WAL and logical storage |
|
||||
| `07-replication-volume-and-peers.md` | primary fan-out and peers |
|
||||
| `08-transport-lineage-barrier.md` | lineage, barrier, transport facts |
|
||||
| `09-recovery-walshipper-dual-lane.md` | recovery / rebuild / catch-up mechanics |
|
||||
| `10-frontend-projection-iscsi-nvme.md` | frontend readiness projection |
|
||||
| `11-master-authority-and-grpc.md` | blockmaster and authority |
|
||||
| `12-inter-server-wire-protocols.md` | wire protocols and messages |
|
||||
| `13-data-and-recovery-plane-messages.md` | data-plane vs recovery-plane messages |
|
||||
| `14-core-code-groups-and-files.md` | core package/file map |
|
||||
|
||||
## Methodology Series
|
||||
|
||||
Source directory:
|
||||
|
||||
```text
|
||||
C:\work\seaweedfs\sw-block\design\methdology
|
||||
```
|
||||
|
||||
Important files:
|
||||
|
||||
| File | Use |
|
||||
|---|---|
|
||||
| `01-problem-shape-and-method.md` | observe -> constrain -> decide -> execute -> close method |
|
||||
| `02-block-clump-initiator-target-session-lineage-barrier-recovery.md` | block-storage vocabulary and obligations |
|
||||
| `03-csi-clump-lifecycle-compiler.md` | CSI lifecycle thinking |
|
||||
| `04-iscsi-nvme-clump-wire-state-machines.md` | protocol wire-state concerns |
|
||||
| `05-code-landings-engine-adapter-frontend-transport-recovery-storage.md` | implementation landing zones |
|
||||
| `06-authority-placement-clump.md` | authority and placement |
|
||||
| `07-replication-sync-clump.md` | replication/sync |
|
||||
| `08-recovery-clump.md` | recovery mechanics |
|
||||
| `09-storage-wal-clump.md` | WAL and local storage |
|
||||
| `10-projection-readiness-clump.md` | projection vs readiness |
|
||||
| `11-observability-clump.md` | observability method |
|
||||
|
||||
## Core Vocabulary To Carry Forward
|
||||
|
||||
| Term | Meaning |
|
||||
|---|---|
|
||||
| initiator | client side that sends block commands, e.g. host OS or kube node path |
|
||||
| target/controller | server side accepting protocol commands |
|
||||
| session | bounded protocol conversation with identity and lifecycle |
|
||||
| lineage | generation identity; old generation must not override new generation |
|
||||
| barrier/fence | explicit durability or ordering checkpoint |
|
||||
| frontier | durable progress boundary that recovery can trust |
|
||||
| projection | semantic publication of state |
|
||||
| readiness | execution permission derived from semantic state |
|
||||
|
||||
## Method Rule
|
||||
|
||||
For any subsystem, answer four questions:
|
||||
|
||||
```text
|
||||
what facts does it observe?
|
||||
what constraints must those facts satisfy?
|
||||
who is allowed to decide?
|
||||
where does the decision become real?
|
||||
```
|
||||
|
||||
This is the lens the deep-dive pages should use. If a page only lists code
|
||||
files, it is not deep enough.
|
||||
|
||||
@@ -1,53 +1,23 @@
|
||||
# Seaweed Block Engineering Wiki
|
||||
|
||||
This wiki is the engineering map for Seaweed Block development. It is not a
|
||||
replacement for finished plans, QA sign-offs, or release notes. It is the entry
|
||||
point that explains how those documents fit together.
|
||||
This wiki explains how the Kubernetes line of Seaweed Block works, for
|
||||
developers changing it. It is not a release-claim source: the
|
||||
[release notes](../releases/README.md) and
|
||||
[Kubernetes status](../kubernetes-status.md) hold the claims, and the
|
||||
design documents are the canonical description: the
|
||||
[core design](../design/block-design.md) (core block service, verification,
|
||||
known issues), the [agent workspace design](../design/agent-workspace-design.md)
|
||||
and the [Kubernetes block design](../design/kubernetes-block-design.md).
|
||||
|
||||
Seaweed Block has passed through more than ninety phases. A single architecture
|
||||
document cannot explain the accumulated product model. The useful structure is:
|
||||
## Pages
|
||||
|
||||
```text
|
||||
problem background
|
||||
-> industry pattern
|
||||
-> Seaweed Block implementation
|
||||
-> state machine / invariant
|
||||
-> code entry points
|
||||
-> QA gates and failure evidence
|
||||
-> current limits and next work
|
||||
```
|
||||
|
||||
## How To Read This Wiki
|
||||
|
||||
Start here:
|
||||
|
||||
- [Developer Guide](developer-guide.md) - what belongs in the wiki and what
|
||||
remains in source evidence.
|
||||
- [Coverage Matrix](coverage-matrix.md) - whether the wiki covers the major
|
||||
months-long engineering domains and where deeper docs are still needed.
|
||||
- [Topic Inventory](topic-inventory.md) - full topic backlog and whether each
|
||||
topic is implementation-grade, summary-level, mapped, missing, or future.
|
||||
- [Historical Sources](historical-sources.md) - older tutorial and methodology
|
||||
material that explains the block-storage method behind the current design.
|
||||
- [Code Map](code-map.md) - main packages, commands, and responsibility
|
||||
- [Code Map](code-map.md) - main commands, packages and responsibility
|
||||
boundaries.
|
||||
- [State Machines](state-machines.md) - the product states developers must not
|
||||
violate.
|
||||
- [Protocol Catalog](protocol-catalog.md) - the current catalog of mini
|
||||
protocols and state machines that deserve Mermaid diagrams.
|
||||
- [Phase Map](phase-map.md) - how the early storage phases, operation-layer
|
||||
closure, and returned-replica failback line connect.
|
||||
- [Phase Recap](phase-recap.md) - what each phase solved and how the feature
|
||||
logic accumulated.
|
||||
- [QA and TestOps Map](testops-map.md) - which gates prove which claims.
|
||||
|
||||
Related local docs:
|
||||
|
||||
- [Seaweed RDMA Engineering Wiki](http://192.168.1.135:8011/wiki/) - Rust RDMA
|
||||
data path, native RC/DC, UCX, pull-RDMA, and future GPU-style destinations.
|
||||
- [sw-test-runner TestOps Wiki](http://192.168.1.135:8012/wiki/) -
|
||||
cross-product scenario runner, product testing guides, and live run
|
||||
dashboard docs.
|
||||
- [Runtime State Machines](../runtime-state-machines.md) - control-plane, CSI
|
||||
and frontend loops.
|
||||
|
||||
## Current Product Loop
|
||||
|
||||
@@ -68,33 +38,52 @@ Helm install
|
||||
This is a bounded operation-layer capability. It is not automatic cleanup, not a
|
||||
production operator, and not backup/NVMe expansion.
|
||||
|
||||
Recent returned-replica work adds a separately gated, opt-in failback runtime
|
||||
path. See [Returned Replica Failback Runtime](deep-dives/returned-replica-failback.md)
|
||||
Returned-replica work adds a separately gated, opt-in failback runtime path.
|
||||
See [Returned Replica Failback Runtime](deep-dives/returned-replica-failback.md)
|
||||
for the authority owner, target CR, executor, gRPC service, terminal evidence,
|
||||
and non-claims. As of Phase 97, that line can plan a frontend-publication
|
||||
target from terminal failback evidence and invoke the publication runtime only
|
||||
under explicit policy; workload-visible path switching remains a separate gate.
|
||||
and non-claims. That line can plan a frontend-publication target from terminal
|
||||
failback evidence and invoke the publication runtime only under explicit
|
||||
policy; workload-visible path switching remains a separate gate.
|
||||
|
||||
## Deep Dives
|
||||
|
||||
New pages follow the [deep-dive template](deep-dives/template.md). A page is
|
||||
deep only if a developer could use it to make a correct code change, write the
|
||||
right gate and diagnose a failed run.
|
||||
|
||||
- [CSI Lifecycle](deep-dives/csi-lifecycle.md)
|
||||
- [Operation Layer v0.5](deep-dives/operation-layer-v05.md)
|
||||
- [Status Writer Conformance](deep-dives/status-writer-conformance.md)
|
||||
- [ManagedVolume Readiness](deep-dives/managed-volume-readiness.md)
|
||||
- [SmartWAL Dirty Failure](deep-dives/smartwal-dirty-failure.md)
|
||||
- [WAL Frontier Recovery](deep-dives/wal-frontier-recovery.md)
|
||||
- [blockvolume Process Readiness](deep-dives/blockvolume-process-readiness.md)
|
||||
- [Authority And Promotion](deep-dives/authority-promotion.md)
|
||||
- [iSCSI ALUA Multipath](deep-dives/iscsi-alua-multipath.md)
|
||||
- [Live Node Evidence](deep-dives/live-node-evidence.md)
|
||||
- [Support Bundle Cold Reader](deep-dives/support-bundle-cold-reader.md)
|
||||
- [Release Engineering Image Skew](deep-dives/release-engineering-image-skew.md)
|
||||
- [Returned Replica Rebuild](deep-dives/returned-replica-rebuild.md)
|
||||
- [Returned Replica Failback](deep-dives/returned-replica-failback.md)
|
||||
- [Read-Write Control Plane](deep-dives/read-write-control-plane-roadmap.md)
|
||||
- [TestOps Authoring](deep-dives/testops-authoring.md)
|
||||
|
||||
## Source Evidence
|
||||
|
||||
The wiki links to these source areas:
|
||||
|
||||
- `docs/` - public and user-facing docs.
|
||||
- `internal/docs/finished-plans/` - phase-by-phase completion records.
|
||||
- `internal/docs/ref/` - design references and product contracts.
|
||||
- `internal/docs/protocol/` - control-model and invariant documents.
|
||||
- `internal/docs/qa-assignments/` - gate assignments and QA sign-offs.
|
||||
- `internal/docs/` - phase plans, design references and QA sign-offs.
|
||||
- `testops/` - scenario definitions and suite structure.
|
||||
|
||||
When a wiki page conflicts with a finished plan or QA sign-off, the finished
|
||||
plan or QA sign-off wins.
|
||||
When a wiki page conflicts with the code, a release note or a QA sign-off, the
|
||||
wiki page is wrong.
|
||||
|
||||
## Depth Standard
|
||||
## Local Preview
|
||||
|
||||
For storage/control-plane topics, a page is only considered deep if it can guide
|
||||
a code change and a QA gate. It should include protocol or domain background,
|
||||
product contract, ownership model, state machine, publish/API shape, code
|
||||
entry points, evidence contract, failure taxonomy, implementation checklist,
|
||||
QA history, and non-claims.
|
||||
```bash
|
||||
pip install mkdocs-material
|
||||
mkdocs serve # http://127.0.0.1:8000
|
||||
```
|
||||
|
||||
A correct summary is still useful, but it is not enough for feature work.
|
||||
Use Mermaid for state machines and sequence diagrams. Link Markdown pages under
|
||||
`docs/` with relative links, and source code with GitHub links, since MkDocs
|
||||
serves only files under `docs/`.
|
||||
@@ -1,116 +0,0 @@
|
||||
# Phase Map
|
||||
|
||||
The phases form a product-learning sequence. They should not be read as a flat
|
||||
changelog.
|
||||
|
||||
For a per-phase explanation of the problem, feature logic, and remaining gap,
|
||||
see [Phase Recap](phase-recap.md).
|
||||
|
||||
## Phase Groups
|
||||
|
||||
| Phases | Theme | Outcome |
|
||||
|---|---|---|
|
||||
| 1-8 | protocol readiness and beta hardening seed | early frontend/control-plane gates |
|
||||
| 9-12 | light-use operations and product-owned blockvolume lifecycle | first user-facing operations loop |
|
||||
| 13-18 | restart, placement, mounted failover, node loss | data-plane recovery semantics |
|
||||
| 19-24 | observation, ManagedVolume model, dashboard | AI/cold-reader operations surfaces |
|
||||
| 25-32 | Helm, multi-volume, restart persistence, status surfaces | productized Kubernetes alpha loop |
|
||||
| 33-34 | failure hardening and test realism | live dirty-failure gates, no false Ready |
|
||||
| 35-40 | Kubernetes-native read-only operator foundation | CRD status, Events, node evidence, action model, release hardening |
|
||||
| 41-44 | bounded lifecycle owner | finalizer add/release, delete-safety hold/release, integrated close gate |
|
||||
| 47-67 | returned-replica ACK/rebuild planning and runtime | eligibility, rebuild target, catch-up runtime, terminal evidence |
|
||||
| 68-74 | frontend publication and failback contract separation | publication stays blocked until authority-owned failback exists |
|
||||
| 75-97 | returned-replica failback control path | target CR, executor, runtime, blockmaster RPC, deployed-suite smoke, frontend-publication call-site |
|
||||
|
||||
## The Important Pivot
|
||||
|
||||
The major pivot was from "model looks coherent" to "live product capability is
|
||||
closed":
|
||||
|
||||
```text
|
||||
live fact
|
||||
-> judgment
|
||||
-> status/action
|
||||
-> real Kubernetes API boundary
|
||||
-> QA gate
|
||||
-> failure evidence
|
||||
```
|
||||
|
||||
This pivot explains why many later phases are operation-layer hardening rather
|
||||
than new protocol features. Without this closure, rebuild, NVMe, backup, and
|
||||
failback would add more states than the product can safely explain.
|
||||
|
||||
## Current Closure
|
||||
|
||||
Phase 44 closes this path:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[Helm install] --> B[First PVC]
|
||||
B --> C[CSI creates SwBlockVolume CR]
|
||||
C --> D[lifecycle-owner adds protection finalizer]
|
||||
D --> E[operator-status writes status and Events]
|
||||
E --> F[Delete requested]
|
||||
F --> G{cleanup evidence}
|
||||
G -->|missing/stale/residue| H[hold finalizer]
|
||||
G -->|fresh clean| I[release protection finalizer]
|
||||
H --> E
|
||||
I --> J[CR deletion completes]
|
||||
J --> K[uninstall zero residue]
|
||||
```
|
||||
|
||||
```text
|
||||
install
|
||||
-> first PVC
|
||||
-> CSI-created SwBlockVolume CR
|
||||
-> lifecycle-owner protection finalizer
|
||||
-> operator-status status/Events
|
||||
-> delete request
|
||||
-> hold on unsafe evidence
|
||||
-> release on clean evidence
|
||||
-> zero residue
|
||||
```
|
||||
|
||||
The remaining release step is artifact validation: publish matching immutable
|
||||
images and rerun pinned-image smoke.
|
||||
|
||||
Returned-replica failback now has a separately gated control path:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[Live authority facts] --> B[Returned replica terminal evidence]
|
||||
B --> C[SwBlockVolume failback contract]
|
||||
C --> D[Failback target owner]
|
||||
D --> E[SwBlockReplicaFailback target]
|
||||
E --> F[Failback executor]
|
||||
F --> G[blockmaster FailbackService]
|
||||
G --> H[Publisher IntentReassign]
|
||||
H --> I[failed_back terminal target status]
|
||||
I --> J[disabled SwBlockFrontendPublication target]
|
||||
J --> K[explicit-policy frontend publication runtime]
|
||||
```
|
||||
|
||||
The Phase 97 boundary is explicit:
|
||||
|
||||
```text
|
||||
authority control path can run when opt-in
|
||||
frontend publication target can be planned from terminal failback evidence
|
||||
frontend publication runtime can be called only under explicit policy
|
||||
workload-visible path switch is still not claimed
|
||||
```
|
||||
|
||||
## Next Feature Rule
|
||||
|
||||
A new storage feature should not enter product scope unless it can answer:
|
||||
|
||||
```text
|
||||
Who owns the facts?
|
||||
Who judges safety?
|
||||
Who owns the action?
|
||||
What admission/RBAC boundary confines it?
|
||||
Where does the user see hold/release/progress/failure?
|
||||
Which gate proves no false Ready=True?
|
||||
```
|
||||
|
||||
Returned-replica rebuild/failback is the natural next major product capability
|
||||
because it can reuse the operation-layer model built in Phases 35-44.
|
||||
@@ -1,144 +0,0 @@
|
||||
# Phase Recap
|
||||
|
||||
This page explains what each phase solved. It is not a full changelog. The
|
||||
goal is to show the product logic: which user or engineering problem existed,
|
||||
what capability was added, and why the next phase was necessary.
|
||||
|
||||
Source note: Phases with finished plans link to `internal/docs/finished-plans/`.
|
||||
Phases without a finished-plan file are summarized from release notes,
|
||||
TestOps scenarios, QA assignments, and adjacent protocol documents.
|
||||
|
||||
## Reading Pattern
|
||||
|
||||
Each phase should be read as:
|
||||
|
||||
```text
|
||||
problem -> feature/capability -> product logic -> remaining gap
|
||||
```
|
||||
|
||||
The late operation phases are not random polish. They turned a model that could
|
||||
describe storage into a product loop that Kubernetes users can observe,
|
||||
delete, block, and release safely.
|
||||
|
||||
## Recap Table
|
||||
|
||||
| Phase | Problem solved | Capability added | Product logic / why it mattered |
|
||||
|---|---|---|---|
|
||||
| 1 | The frontend protocol surface was not ready for real initiators. | iSCSI/NVMe frontend readiness gates. | Before Kubernetes claims, the target protocol had to speak enough wire behavior to be testable by real clients. |
|
||||
| 2 | Early beta gates were too broad and slow to guide daily work. | Seed beta-hardening gate. | Created the habit of defining a release gate instead of relying on ad hoc manual smoke tests. |
|
||||
| 3 | The first beta seed still had unstable or expensive checks. | Stabilized and reduced gate cost. | Made the gate repeatable enough to use as engineering feedback, not just release ceremony. |
|
||||
| 4 | Fast operations contracts were not separated from long protocol validation. | Fast gates and operations contract prep. | Split "is the code basically safe to merge" from "is the whole product releaseable." |
|
||||
| 5 | Users had no compact read-only status/report path. | Read-only operations status report. | First step toward explaining the product without SSH log spelunking or internal grep knowledge. |
|
||||
| 6 | The iSCSI target needed real Linux initiator compatibility. | OS initiator compatibility checks. | Proved the block target could interact with the host stack, not only with synthetic protocol tests. |
|
||||
| 7 | iSCSI sessions and backend pressure could fail in ambiguous ways. | Session/backend pressure hardening. | Tightened the boundary between frontend sessions and storage backend behavior. |
|
||||
| 8 | Main merge needed a clear readiness bar. | Merge-readiness plan and gate cleanup. | Made "ready for main" a concrete state rather than a subjective review. |
|
||||
| 9 | The project needed a first light-use operations story. | Light-use operations MVP. | Established a minimal user path around installing, observing, and cleaning the system. |
|
||||
| 10 | Install and lifecycle operations were still fragmented. | Light-use install/lifecycle MVP. | Connected install, use, and cleanup into one small lifecycle, exposing where product ownership was missing. |
|
||||
| 11 | Operators could not inventory the cluster and volume lifecycle clearly. | Cluster ops inventory and lifecycle visibility. | Added the ability to list what exists and why, which is prerequisite to any safe action. |
|
||||
| 12 | `blockvolume` processes were product side effects, not owned objects. | Product-owned blockvolume lifecycle MVP. | Started moving from helper-launched processes to product-owned lifecycle semantics. |
|
||||
| 13 | Restart could lose usable volume state. | Durable volume restart and reattach MVP. | Introduced restart persistence as a product concern, not just a process restart. |
|
||||
| 14 | Multi-node placement and attach were not proven. | Multi-node attach and placement MVP. | Proved the product had to reason about node identity, placement, and frontend reachability. |
|
||||
| 15 | Basic failover existed below the user surface but not as mounted recovery. | Basic mounted failover and reattach. | Connected authority change to workload-visible recovery behavior. |
|
||||
| 16 | Mounted recovery needed an ACK/readiness profile. | Stage-1 mounted recovery ACK profile. | Made recovery safer by distinguishing "process alive" from "safe to acknowledge/serve." |
|
||||
| 17 | Transparent mounted failover needed host multipath evidence. | Stage-2 iSCSI ALUA/dm-multipath failover. | Proved that a mounted workload can survive path change only when host path state is part of evidence. |
|
||||
| 18 | Whole-node loss could break assumptions about authority and placement. | Node-loss survival MVP. | Forced the product to treat missing nodes as first-class state instead of accidental process failures. |
|
||||
| 19 | Control-plane facts were not AI/cold-reader readable. | Control-plane observation and AI-readable ops. | Began the shift from logs to structured evidence and explanations. |
|
||||
| 20 | Day-1 activation was not packaged as a user loop. | Activation / Day-1 ops MVP. | Produced a first install -> first volume -> verify -> cleanup story. |
|
||||
| 21 | Helm activation needed runner-native proof. | Helm first-volume scenarios. | Moved Day-1 activation toward Kubernetes-native packaging and repeatable TestOps. |
|
||||
| 22 | Observability lacked a central product object. | `ManagedVolume` operations model. | Defined the volume as users experience it: PVC, replicas, frontend, readiness, blockers, and safe actions. |
|
||||
| 23 | The ManagedVolume model was not visible enough. | Report/explain/dashboard/operator-readiness surfaces. | Turned the internal read model into user-facing status and Conditions. |
|
||||
| 24 | The dashboard was local and not hosted as a simple read-only surface. | Hosted read-only dashboard. | Made support/debug information available through a browser without mutation. |
|
||||
| 25 | Helm and observable first-volume release had to converge. | v0.3 Helm observable first-volume release. | Tied packaging, first PVC, report, dashboard, and cleanup into a release-shaped path. |
|
||||
| 26 | Helm lifecycle and support diagnostics needed runner coverage. | Helm release hygiene, upgrade/rollback, multi-volume day-1, support bundle gates. | Converted release packaging assumptions into executable scenarios. |
|
||||
| 27 | RF=3 and failover had to hold under multi-volume pressure. | Multi-volume RF=3 readiness, reattach, mounted failover, interleaved failover. | Proved identity isolation: one volume's recovery must not corrupt another's authority or publish target. |
|
||||
| 28 | Productized operations close needed consistent surfaces. | Phase 28 productized ops close and support-bundle/dashboard route hardening. | Made README, quickstart, release notes, report, dashboard, and operator snapshot agree on narrow claims. |
|
||||
| 29 | Cleanup reliability still depended on helper timing and residue assumptions. | Deterministic cleanup evidence and vocabulary. | Made cleanup itself an evidence object with residue counts, failure counts, and downstream report/dashboard carry-through. |
|
||||
| 30 | CRD/status protocols needed a stable field contract. | ManagedVolume field/status contract alignment. | Prevented each surface from inventing its own vocabulary for the same product state. |
|
||||
| 31 | Kubernetes restart could resurrect stale authority. | Restart persistence for single-node and RF=3 promoted authority. | Proved primary, publish target, epoch, and data survive k3s restart without old-primary resurrection. |
|
||||
| 32 | Status surfaces could disagree or over-claim readiness. | CRD/Condition/Event model and surface agreement gates. | Established negative-first behavior across healthy, blocked, restart, multi-volume, and stale evidence surfaces. |
|
||||
| 33 | TestOps still had self-proving or weak failure checks. | Failure hardening review and scenario realism plan. | Started classifying tests by evidence strength rather than action count. |
|
||||
| 34 | Dirty storage failures could be hidden behind false Ready. | SmartWAL corruption live gate and no-false-Ready fix chain. | Forced the storage, process readiness, and projection layers to fail closed when WAL integrity evidence is bad. |
|
||||
| 35 | Kubernetes users needed native CRD status and Events. | Read-only operator-status foundation. | Added `SwBlockCluster`/`SwBlockVolume` status writes, Events, and RBAC-confined status-only behavior. |
|
||||
| 36 | Status was visible but not actionable enough. | Node readiness, support evidence refs, cleanup visibility, cross-surface actionability. | Turned "something is blocked" into "why, where is evidence, and what safe next step exists." |
|
||||
| 37 | Live node evidence was incomplete and replay-only in negative cases. | Live K8s node/CSI/image/host-prereq/loopback blockers. | Closed false node-ready masking: cordon, NotReady, missing CSI driver/image, and loopback cross-node blockers surface live. |
|
||||
| 38 | Actions were still suggestions without an executable contract. | Action model evaluator: allowed dry-run, rejected unsafe, required facts/evidence. | Defined the bridge from read-only observation toward future mutation without enabling broad mutation. |
|
||||
| 39 | Delete safety needed status before any finalizer mutation. | Delete-safety status boundary and multi-volume isolation. | Proved blocked/releasable/unknown delete decisions could be shown per volume with zero finalizer mutation. |
|
||||
| 40 | Operator-status needed release-grade hardening. | Production hardening, release candidate gates, image/chart skew detection. | Caught that a chart can be correct against source but broken against published images; release artifacts became part of the gate. |
|
||||
| 41 | Lifecycle ownership needed role separation before mutation. | Observer/lifecycle-owner/executor foundation. | Separated who observes, who decides, and who may eventually mutate, avoiding a broad operator role. |
|
||||
| 42 | Finalizer mutation boundary had to be proven against a real API server. | ValidatingAdmissionPolicy/RBAC admission gate and delete-safety decision model. | Proved lifecycle-owner can only patch the protection finalizer, while operator-status remains status/events-only. |
|
||||
| 43 | The first real product mutation needed bounded add and release. | Protection finalizer add/release gates. | Added the first admitted metadata mutation: hold on missing/blocked/stale delete safety, release only clean/releasable, preserve foreign finalizers. |
|
||||
| 44 | The integrated delete lifecycle still had manual gaps. | CSI-created protected CR, status publication, delete-request hold/release, multi-volume close gate. | Closed the user-visible loop: PVC -> CR -> finalizer -> status -> delete hold/release -> zero residue. |
|
||||
|
||||
## Recap Addendum: Phases 45-95
|
||||
|
||||
Phases after 44 reuse the operation-layer closure instead of bypassing it. The
|
||||
important line is returned-replica recovery:
|
||||
|
||||
| Phase range | Problem solved | Capability added | Product logic / why it mattered |
|
||||
|---|---|---|---|
|
||||
| 45-54 | A returned replica could not be admitted back through a bounded executor path. | ACK eligibility CRs, executor preflight/status schema, terminal-evidence gate, first bounded ACK eligibility mutation. | Reintegrating a returned replica starts as evidence and eligibility, not as automatic primary movement. |
|
||||
| 56-67 | Returned-replica rebuild/catch-up needed a target and runtime loop before failback. | Rebuild target CR, target owner, planned/running/caught-up status, terminal catch-up evidence. | A replica may only become useful after durable frontier evidence proves it caught up. |
|
||||
| 68-73 | Frontend publication was too dangerous to couple directly to returned-replica eligibility. | Frontend publication target/executor boundaries that deliberately block returned-replica publication. | Publishing a frontend path is separated from ACK/rebuild evidence so the product cannot accidentally expose an unsafe target. |
|
||||
| 74-88 | Failback needed an authority-owned path rather than frontend-publication inference. | `authority.failback_returned_replica`, `SwBlockReplicaFailback`, failback executor, typed runtime, blockmaster RPC, Helm packaging. | Authority reassignment belongs to blockmaster/Publisher and remains default-off until explicit evidence and policy exist. |
|
||||
| 89-95 | The packaged failback path still needed current authority facts and live deployed proof. | Authority facts in `SwBlockVolume.status`, expected-current guards, activation policy, handoff isolation, real gRPC smoke, live k3s deployed-suite gate. | The deployable failback control path can now run end-to-end without claiming frontend publication or workload-visible data-path switch. |
|
||||
| 96 | Terminal failback evidence existed, but frontend publication had no post-failback source object. | `SwBlockReplicaFailback.status=failed_back/failback_completed` can create a disabled `SwBlockFrontendPublication` target with failback-source fields. | The next publication step is explicit, but executor publication and workload-visible path switching remain separate later gates. |
|
||||
| 97 | The publication target existed, but executor execution flags were not wired through CLI/Helm for post-failback publication. | Explicit-policy CLI/Helm flags invoke the frontend publication runtime for a failback-source target and require terminal `frontend_published` evidence. | Runtime handoff is proven; workload-visible I/O after publication remains the next gate. |
|
||||
|
||||
## Product Logic Across The Phases
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[Protocol can serve bytes] --> B[Host can mount bytes]
|
||||
B --> C[Kubernetes can create and attach a volume]
|
||||
C --> D[Product can observe the volume]
|
||||
D --> E[Status surfaces agree]
|
||||
E --> F[Negative evidence blocks false Ready]
|
||||
F --> G[Actions are typed and dry-run first]
|
||||
G --> H[Admission confines first mutation]
|
||||
H --> I[Delete lifecycle closes with evidence]
|
||||
```
|
||||
|
||||
The important transition is between D and I. The project spent many phases
|
||||
there because a storage product cannot safely add rebuild, failback, backup,
|
||||
NVMe expansion, or GPU paths if it cannot first explain:
|
||||
|
||||
- which facts are live,
|
||||
- which facts are stale,
|
||||
- why a volume is ready, blocked, unknown, or releasable,
|
||||
- who owns each mutation,
|
||||
- what admission/RBAC boundary confines it,
|
||||
- and what evidence proves the mutation completed safely.
|
||||
|
||||
## Why The Operation Loop Was Necessary
|
||||
|
||||
Earlier engine work built useful protocol and recovery pieces, but some of it
|
||||
was still a logical loop rather than a capability loop. A logical loop can say
|
||||
"if facts are X, decide Y." A capability loop must prove:
|
||||
|
||||
```text
|
||||
live system produces fact X
|
||||
status writes decision Y
|
||||
user sees Y consistently
|
||||
unsafe action is rejected
|
||||
safe action is bounded
|
||||
terminal evidence closes the loop
|
||||
cleanup leaves no residue
|
||||
```
|
||||
|
||||
Phases 35-44 were about closing that capability loop. That is why the roadmap
|
||||
now says new storage features should reuse the same fact -> judgment -> action
|
||||
-> evidence structure instead of creating new isolated engines.
|
||||
|
||||
## Source Index
|
||||
|
||||
Representative source files:
|
||||
|
||||
- `internal/docs/finished-plans/phase1_finishedplan_frontend_protocol_readiness.md`
|
||||
- `internal/docs/finished-plans/phase22_finishedplan_managed_volume_operations_model.md`
|
||||
- `internal/docs/finished-plans/phase34_finishedplan_test_realism_dirty_failure_hardening.md`
|
||||
- `internal/docs/finished-plans/phase35_finishedplan_kubernetes_native_read_only_operator_foundation.md`
|
||||
- `internal/docs/finished-plans/phase41_finishedplan_lifecycle_owner_foundation.md`
|
||||
- `internal/docs/finished-plans/phase44_finishedplan_delete_lifecycle_close_gate.md`
|
||||
- `docs/releases/`
|
||||
- `internal/docs/qa-assignments/`
|
||||
- `testops/scenarios/`
|
||||
@@ -1,77 +0,0 @@
|
||||
# Protocol And State-Machine Catalog
|
||||
|
||||
This page catalogs the state machines and mini-protocols that should be
|
||||
documented with Mermaid diagrams. It links to the current source references and
|
||||
names the code or gate area that owns the behavior.
|
||||
|
||||
The catalog is intentionally broader than the current release claim. Some
|
||||
protocols are implemented and gated; others are planned but need the same
|
||||
fact -> judgment -> action -> evidence structure before becoming product
|
||||
claims.
|
||||
|
||||
## Existing Source References
|
||||
|
||||
- [Runtime State Machines](../runtime-state-machines.md)
|
||||
- `internal/docs/protocol/README.md`
|
||||
- `internal/docs/protocol/invariant-ledger.md`
|
||||
- `internal/docs/protocol/managed-volume-operations-model.md`
|
||||
- `internal/docs/protocol/operator-readiness-contract.md`
|
||||
- `internal/docs/protocol/finalizer-delete-safety-contract.md`
|
||||
- `internal/docs/ref/lifecycle-owner-control-contract.md`
|
||||
- `internal/docs/ref/operation-layer-v0.5-release-train.md`
|
||||
|
||||
## Catalog
|
||||
|
||||
| # | Protocol / state machine | Current source | Main code area | Mermaid status |
|
||||
|---|---|---|---|---|
|
||||
| 1 | Control-plane placement to authority publication | `docs/runtime-state-machines.md` | `core/host/master`, launcher/authority code | existing diagram |
|
||||
| 2 | Data-plane write / sync / WAL boundary | `docs/runtime-state-machines.md` | `cmd/blockvolume`, `core/storage` | existing diagram |
|
||||
| 3 | Recovery / replication peer lifecycle | `docs/runtime-state-machines.md`, `internal/docs/ref/rf2-promotion-ready-recovery-contract.md` | recovery / replication paths | existing high-level diagram; needs productized rebuild version |
|
||||
| 4 | Frontend eligibility / stale-owner fencing | `docs/runtime-state-machines.md`, `internal/docs/protocol/invariant-ledger.md` | frontend projection, authority bridge | existing high-level diagram |
|
||||
| 5 | CSI node stage/publish flow | `docs/runtime-state-machines.md`, `core/csi` | `cmd/blockcsi`, `core/csi` | existing sequence diagram |
|
||||
| 6 | ManagedVolume readiness projection | `internal/docs/protocol/managed-volume-operations-model.md` | `core/ops` | needs detailed Mermaid |
|
||||
| 7 | Kubernetes node readiness evidence | `internal/docs/protocol/operator-readiness-contract.md` | `core/ops` live node evidence | needs detailed Mermaid |
|
||||
| 8 | Cleanup visibility / cleanup verifier evidence | `internal/docs/protocol/operator-readiness-contract.md`, `internal/docs/ref/operation-layer-v0.5-release-train.md` | cleanup verifier, `core/ops/cleanup_evidence.go` | needs detailed Mermaid |
|
||||
| 9 | Delete-safety decision model | `internal/docs/protocol/finalizer-delete-safety-contract.md` | `core/ops` delete-safety projection | initial diagram in [State Machines](state-machines.md) |
|
||||
| 10 | Lifecycle-owner finalizer add/release | `internal/docs/ref/lifecycle-owner-finalizer-strategy.md`, `internal/docs/ref/lifecycle-owner-control-contract.md` | `core/ops/lifecycle_owner_controller.go` | initial sequence in [State Machines](state-machines.md) |
|
||||
| 11 | Kubernetes admission boundary for lifecycle-owner | `internal/docs/ref/phase42-lifecycle-owner-api-admission-gate.md` | Helm VAP/RBAC templates | needs VAP decision diagram |
|
||||
| 12 | Action model evaluator | `internal/docs/protocol/engine-design-guidelines.md`, Phase 38 docs | `core/ops/action_model.go` | needs Mermaid decision tree |
|
||||
| 13 | Status writer / CRD schema conformance | Phase 40 status API docs | `core/ops/kubernetes_status_writer.go` | needs request/validation diagram |
|
||||
| 14 | SmartWAL corruption fail-closed path | Phase 34 finished plan and QA sign-offs | `core/storage`, `cmd/blockvolume`, `core/ops` projection | needs detailed failure-path diagram |
|
||||
| 15 | iSCSI ALUA / dm-multipath path state | `internal/docs/ref/iscsi-alua-technical-note.md`, `stage2-transparent-multipath-host-failover-spec.md` | iSCSI frontend and host path evidence | needs protocol diagram |
|
||||
| 16 | NVMe ANA parity path | `internal/docs/ref/nvme-ana-technical-note.md`, `nvme-ana-parity-plan.md` | future NVMe frontend path | planned diagram |
|
||||
| 17 | Returned-replica rebuild / reintegration | roadmap + recovery refs | recovery + future lifecycle action owner | planned diagram |
|
||||
| 18 | TestOps run lifecycle and evidence bundle | `internal/docs/ref/testops-control-data-contract.md`, `testops/` | runner/scenarios | needs run-state diagram |
|
||||
| 19 | Future read-write action execution | Phase 38-44 contracts + roadmap | future safe_k8s/host_cleanup/authority/data lifecycle executors | initial diagram in read-write control-plane deep dive |
|
||||
| 20 | GPUDirect/cuFile compatibility gate | future design + NVIDIA GDS/cuFile docs | future TestOps helper + ops evidence ingestion | initial diagram in GPUDirect deep dive |
|
||||
|
||||
## Diagram Priority
|
||||
|
||||
The first detailed Mermaid expansions should be:
|
||||
|
||||
1. Operation layer v0.5: facts -> judgment -> action -> admission -> evidence.
|
||||
2. ManagedVolume readiness projection: how ready/blocked/unknown wins.
|
||||
3. CSI lifecycle: PVC -> CreateVolume -> `SwBlockVolume` CR -> status/finalizer.
|
||||
4. SmartWAL dirty-failure path: storage fault -> local readiness block ->
|
||||
projection no false Ready.
|
||||
5. TestOps gate lifecycle: live/replay/adversarial gates and evidence bundles.
|
||||
6. Future mutating action execution: preconditions -> policy -> executor ->
|
||||
terminal evidence.
|
||||
7. GPUDirect/cuFile compatibility: GPU/GDS prereq -> mount probe -> transfer
|
||||
checksum -> supported/blocked/unsupported.
|
||||
|
||||
## Rule For Adding A Diagram
|
||||
|
||||
Every Mermaid diagram should name:
|
||||
|
||||
```text
|
||||
state names
|
||||
transition trigger
|
||||
owner component
|
||||
evidence artifact
|
||||
failure state
|
||||
QA gate
|
||||
```
|
||||
|
||||
If a diagram cannot name the evidence artifact or gate, it is probably still a
|
||||
design sketch rather than a product behavior.
|
||||
@@ -4,9 +4,10 @@ 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 the broader list of mini-protocols and diagrams still to add, see
|
||||
[Protocol Catalog](protocol-catalog.md). For existing runtime diagrams, see
|
||||
[Runtime State Machines](../runtime-state-machines.md).
|
||||
For runtime diagrams, see
|
||||
[Runtime State Machines](../runtime-state-machines.md). Storage state machines are in the
|
||||
[core design](../design/block-design.md); HEAD, lease and snapshot state
|
||||
machines are in the [agent workspace design](../design/agent-workspace-design.md).
|
||||
|
||||
## Managed Volume Readiness
|
||||
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
# Topic Inventory
|
||||
|
||||
This inventory lists the topics the engineering wiki should eventually cover.
|
||||
It is broader than current release scope.
|
||||
|
||||
Status meanings:
|
||||
|
||||
| Status | Meaning |
|
||||
|---|---|
|
||||
| `deep` | implementation-grade: background, contract, ownership, state machine, code map, evidence, failures, checklist, QA |
|
||||
| `tutorial` | strong explanatory page, but may still miss one or two implementation-grade sections |
|
||||
| `summary` | page exists but cannot yet guide a safe code change |
|
||||
| `mapped` | topic appears in catalog/coverage but has no dedicated deep page |
|
||||
| `missing` | no useful wiki coverage yet |
|
||||
| `future` | intentionally deferred feature area |
|
||||
|
||||
## Product And Release
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| Product positioning / claim boundary | mapped | `docs/releases/`, coverage matrix |
|
||||
| Release train and image/chart skew | mapped | release docs, Phase 40 references |
|
||||
| User quickstart and Day-1 path | mapped | quickstart, README |
|
||||
| Feature/status table for public readers | mapped | README/release docs |
|
||||
| Docker volume plugin idea | future | roadmap only |
|
||||
| Windows developer path / WSL / remote lab | missing | scattered notes only |
|
||||
|
||||
## Kubernetes / CSI / Operator Layer
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| CSI lifecycle / SwBlockVolume identity | tutorial | `deep-dives/csi-lifecycle.md` |
|
||||
| CSI ControllerPublish/NodeStage/NodePublish details | summary | CSI page |
|
||||
| CSI DeleteVolume and CR delete ordering | summary | CSI page + operation layer page |
|
||||
| SwBlockVolume CRD field ownership | summary | CSI page + operation layer page |
|
||||
| operator-status CRD status writer | deep draft | `deep-dives/status-writer-conformance.md` |
|
||||
| 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 + 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 | deep draft | `deep-dives/release-engineering-image-skew.md` |
|
||||
| Kubernetes Events identity/dedupe | mapped | Phase 35 docs |
|
||||
| CRD schema conformance/envtest gap | deep draft | `deep-dives/status-writer-conformance.md` |
|
||||
| read-write control-plane maturity | future design | `deep-dives/read-write-control-plane-roadmap.md` |
|
||||
|
||||
## Storage / Data Plane
|
||||
|
||||
| Topic | Status | Current 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 |
|
||||
| blockvolume process layout and flags | deep draft | `deep-dives/blockvolume-process-readiness.md` |
|
||||
| frontend projection/readiness | mapped | SmartWAL + ManagedVolume pages |
|
||||
| local storage adapter readiness | missing | source/code only |
|
||||
| SCSI command handling / sense errors | missing | `core/frontend/iscsi` only |
|
||||
| dirty restart / recovery fail-closed | summary | SmartWAL page |
|
||||
|
||||
## Authority / Recovery
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| authority / epoch / promotion | tutorial | `deep-dives/authority-promotion.md` |
|
||||
| stale-primary fencing | summary | authority page |
|
||||
| restart authority persistence | summary | authority page |
|
||||
| recovery/catch-up/rebuild mechanics | mapped | returned-replica page + historical tutorial |
|
||||
| returned-replica rebuild productization | tutorial initial | `deep-dives/returned-replica-rebuild.md` |
|
||||
| returned-replica failback runtime | deep | `deep-dives/returned-replica-failback.md` |
|
||||
| automatic deployed failback policy | future | roadmap only |
|
||||
| promotion readiness probes | summary | authority page |
|
||||
| multi-volume authority isolation | mapped | QA/phase docs |
|
||||
|
||||
## Protocol Frontends
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| iSCSI basics | summary | iSCSI ALUA page |
|
||||
| iSCSI ALUA / dm-multipath | deep draft | `deep-dives/iscsi-alua-multipath.md` |
|
||||
| iSCSI OS initiator compatibility | mapped | ref/QA docs |
|
||||
| iSCSI CHAP / auth path | mapped | chart values + quickstart |
|
||||
| iSCSI stale path write rejection | mapped | ALUA/failover QA docs |
|
||||
| NVMe-oF basics | missing | ref docs only |
|
||||
| NVMe ANA parity | future | roadmap/ref docs |
|
||||
| protocol selection in CSI | mapped | roadmap/ref docs |
|
||||
| GPUDirect Storage / cuFile | future design | `deep-dives/gpudirect-cufile-cuobject.md` |
|
||||
| cuObject / GPU object path | future design | `deep-dives/gpudirect-cufile-cuobject.md` |
|
||||
|
||||
## Operations / Observability
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| ManagedVolume readiness | tutorial | `deep-dives/managed-volume-readiness.md` |
|
||||
| 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 |
|
||||
| negative-first rule | tutorial | ManagedVolume + SmartWAL pages |
|
||||
| cold-reader explain path | mapped | Phase 32/36/44 docs |
|
||||
| cleanup visibility | mapped | Phase 36/39/44 docs |
|
||||
| action precondition/evidence model | mapped | Phase 38 docs |
|
||||
| future mutating action execution | future design | `deep-dives/read-write-control-plane-roadmap.md` |
|
||||
|
||||
## TestOps / QA
|
||||
|
||||
| Topic | Status | Current page |
|
||||
|---|---|---|
|
||||
| TestOps authoring | tutorial | `deep-dives/testops-authoring.md` |
|
||||
| scenario registry | mapped | TestOps page |
|
||||
| evidence realism levels | tutorial | TestOps page |
|
||||
| release smoke gates | mapped | release docs |
|
||||
| failure bundle standard | mapped | Phase 32 docs |
|
||||
| live-vs-mock CRD/RBAC gap | mapped | Phase 35-40 docs |
|
||||
| dirty-failure scenario design | mapped | Phase 34 docs |
|
||||
| runner action reference | missing | source/testops only |
|
||||
|
||||
## Priority Gaps
|
||||
|
||||
The highest-value missing or summary-only pages are:
|
||||
|
||||
1. NVMe-oF / ANA background.
|
||||
2. runner action reference.
|
||||
3. WAL SmartWAL file-layout detail diagrams.
|
||||
4. support bundle artifact examples from real runs.
|
||||
5. returned-replica rebuild concrete future gate plan.
|
||||
6. field-by-field SwBlockVolume CRD contract.
|
||||
7. first concrete cuFile/GDS compatibility gate once GPU lab hardware exists.
|
||||
|
||||
## Review Rule
|
||||
|
||||
When reviewing this wiki, do not ask only whether a topic is present. Ask:
|
||||
|
||||
```text
|
||||
Could a developer implement or safely change this feature from the page?
|
||||
Could QA derive the required evidence and failure reasons from the page?
|
||||
Could a cold reviewer map the user claim to code and gates?
|
||||
```
|
||||
|
||||
If the answer is no, the page remains `summary` even if it is accurate.
|
||||
@@ -5,8 +5,7 @@ summary: the workload comparison, `fsync` behavior, snapshot and fork cost, cut
|
||||
upload time, and the two-host lifecycle run, with how each was measured.
|
||||
|
||||
**Source of truth:** lab runs on Firecracker microVMs and a host-side proxy, as
|
||||
described below. This text moved from the top-level README; only the `fsync`
|
||||
bullet was updated to say which frontend the runs used.
|
||||
described below.
|
||||
|
||||
The workload and lifecycle numbers come from lab runs with Firecracker
|
||||
microVMs (4 vCPU, 4 GiB, guest kernel 6.1). The snapshot, fork and cut numbers
|
||||
@@ -69,4 +68,4 @@ In the same proxy, a cut that writes 64 dirty chunks (256 MiB) took a median
|
||||
|
||||
These results cover the chunk path (`walstore-chunk`), which is a proof of
|
||||
concept: not yet a default, a release claim or a production path. The
|
||||
[design reference](design/block-design.md), Part 2, describes how it works.
|
||||
[agent workspace design](design/agent-workspace-design.md) describes how it works.
|
||||
+15
-16
@@ -1,5 +1,5 @@
|
||||
site_name: Seaweed Block Engineering Wiki
|
||||
site_description: Internal engineering knowledge base for Seaweed Block.
|
||||
site_description: Engineering documentation for Seaweed Block.
|
||||
repo_url: https://github.com/seaweedfs/seaweed-block
|
||||
docs_dir: docs
|
||||
site_dir: site
|
||||
@@ -31,20 +31,13 @@ markdown_extensions:
|
||||
|
||||
nav:
|
||||
- Home: wiki/index.md
|
||||
- Wiki Links:
|
||||
- Block Wiki: http://192.168.1.135:8010/wiki/
|
||||
- RDMA Wiki: http://192.168.1.135:8011/wiki/
|
||||
- TestOps Wiki: http://192.168.1.135:8012/wiki/
|
||||
- Developer Guide:
|
||||
- Wiki Structure: wiki/developer-guide.md
|
||||
- Coverage Matrix: wiki/coverage-matrix.md
|
||||
- Topic Inventory: wiki/topic-inventory.md
|
||||
- Historical Sources: wiki/historical-sources.md
|
||||
- Design:
|
||||
- Design Reference: design/block-design.md
|
||||
- TLA+ Specifications: spec/README.md
|
||||
- Workspace Measurements: workspace-measurements.md
|
||||
- Wiki:
|
||||
- Code Map: wiki/code-map.md
|
||||
- State Machines: wiki/state-machines.md
|
||||
- Protocol Catalog: wiki/protocol-catalog.md
|
||||
- Phase Map: wiki/phase-map.md
|
||||
- Phase Recap: wiki/phase-recap.md
|
||||
- QA and TestOps Map: wiki/testops-map.md
|
||||
- Deep Dives:
|
||||
- Template: wiki/deep-dives/template.md
|
||||
@@ -61,17 +54,23 @@ nav:
|
||||
- Support Bundle Cold Reader: wiki/deep-dives/support-bundle-cold-reader.md
|
||||
- Release Engineering Image Skew: wiki/deep-dives/release-engineering-image-skew.md
|
||||
- Returned Replica Rebuild: wiki/deep-dives/returned-replica-rebuild.md
|
||||
- Returned Replica Failback: wiki/deep-dives/returned-replica-failback.md
|
||||
- Read-Write Control Plane: wiki/deep-dives/read-write-control-plane-roadmap.md
|
||||
- GPUDirect cuFile cuObject: wiki/deep-dives/gpudirect-cufile-cuobject.md
|
||||
- TestOps Authoring: wiki/deep-dives/testops-authoring.md
|
||||
- Product:
|
||||
- Overview: overview.md
|
||||
- Kubernetes Status: kubernetes-status.md
|
||||
- User Capabilities: user-capabilities.md
|
||||
- Roadmap: roadmap.md
|
||||
- Releases: releases/README.md
|
||||
- Operations:
|
||||
- Standalone Deployment: standalone-deployment.md
|
||||
- Kubernetes Quickstart: quickstart-kubernetes.md
|
||||
- Kubernetes App Demo: kubernetes-app-demo.md
|
||||
- Chunk Manifests: chunk-manifests.md
|
||||
- Workspace Lease: workspace-lease.md
|
||||
- Fsync Latency: fsync-latency.md
|
||||
- Architecture:
|
||||
- Architecture: architecture.md
|
||||
- Developer Architecture: developer-architecture.md
|
||||
- Runtime State Machines: runtime-state-machines.md
|
||||
- Operations v1: operations-v1.md
|
||||
- Quickstart: quickstart-kubernetes.md
|
||||
@@ -51,7 +51,6 @@ require_grep "docs/releases/nvme-rdma-capability-boundary.md" "read-only capabil
|
||||
|
||||
require_grep "docs/releases/README.md" "NVMe/RDMA Capability Boundary" "release_index_links_rdma_boundary_doc"
|
||||
require_grep "docs/releases/nvme-tcp-supported-lab.md" "RoCE or NVMe/RDMA data path" "nvme_tcp_doc_keeps_rdma_non_claim"
|
||||
require_grep "docs/roadmap.md" "Phase 157 keeps RoCE/NVMe-RDMA as a product non-claim" "roadmap_phase157_boundary_documented"
|
||||
require_grep "internal/docs/product-roadmap.md" "Phase 157 keeps RoCE/NVMe-RDMA as a product non-claim" "product_roadmap_phase157_boundary_documented"
|
||||
|
||||
write_summary "rdma_host_capability_inputs_documented=true"
|
||||
|
||||
@@ -37,7 +37,6 @@ require_text "wiki_names_terminal_evidence" "docs/wiki/deep-dives/returned-repli
|
||||
require_text "wiki_names_code_entry_points" "docs/wiki/deep-dives/returned-replica-failback.md" "core/ops/failback_executor_controller.go"
|
||||
require_text "wiki_names_current_limits" "docs/wiki/deep-dives/returned-replica-failback.md" "automatic deployed Kubernetes failback"
|
||||
require_text "wiki_index_links_failback" "docs/wiki/index.md" "deep-dives/returned-replica-failback.md"
|
||||
require_text "topic_inventory_classifies_failback" "docs/wiki/topic-inventory.md" "returned-replica failback runtime | deep"
|
||||
require_text "product_roadmap_names_phase86" "internal/docs/product-roadmap.md" "Phases 74-86 add"
|
||||
require_text "product_roadmap_names_opt_in" "internal/docs/product-roadmap.md" "opt-in/source-gated failback"
|
||||
require_text "product_roadmap_defers_automatic" "internal/docs/product-roadmap.md" "automatic deployed failback"
|
||||
|
||||
Reference in new issue
Block a user