mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
Merge pull request #176 from seaweedfs/docs/readme-v2
docs: README v2 with standalone deployment, Kubernetes status and workspace measurements
This commit is contained in:
commit
942019201c
14 files changed
+1208
-462
No files matched your search
+184
-363
@@ -1,408 +1,229 @@
|
||||
# Seaweed Block
|
||||
|
||||
Block storage written in Go: a local-speed block device whose ownership is
|
||||
fenced by epochs. It serves agent workspace disks backed by
|
||||
[SeaweedFS](https://github.com/seaweedfs/seaweedfs) snapshots, and Kubernetes
|
||||
block volumes (alpha).
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/assets/seaweed-block-agent-workspace.svg" alt="Seaweed Block agent workspace disks: a local-speed disk per agent microVM, incremental snapshots to SeaweedFS, fork and resume on any host" width="100%">
|
||||
<img src="docs/assets/seaweed-block-hero.svg" alt="Seaweed Block: a shared core (blockvolume with ublk, NVMe/TCP and iSCSI frontends and the walstore WAL engine, plus blockmaster as the epoch authority) used for agent workspace disks with chunk snapshots in SeaweedFS and for Kubernetes PVCs, with optional RF=2 or RF=3 replication" width="100%">
|
||||
</p>
|
||||
|
||||
Seaweed Block is a block storage service written in Go. It has two uses:
|
||||
## What it is
|
||||
|
||||
1. **Agent workspace disks (new).** Each agent sandbox or microVM gets a
|
||||
local-speed block device. Snapshots, forks and host moves are cheap because
|
||||
the data is stored as content chunks in [SeaweedFS](https://github.com/seaweedfs/seaweedfs).
|
||||
2. **Kubernetes block volumes (alpha).** PVC-backed volumes through a CSI driver,
|
||||
with RF=3 replication, iSCSI or NVMe/TCP, and read-only operations evidence.
|
||||
See [Kubernetes block storage](#kubernetes-block-storage-alpha).
|
||||
| | Agent workspace disks | Kubernetes block volumes |
|
||||
|---|---|---|
|
||||
| Consumer | an agent sandbox or microVM, as a plain virtio block device | an app pod, through a PVC and the CSI driver |
|
||||
| Frontend | NVMe/TCP loopback or ublk | iSCSI, or NVMe/TCP (source-gated) |
|
||||
| Durability | one local replica, with cuts to SeaweedFS | RF=1 with best-effort ack by default; synchronous RF=2 or RF=3 (`sync-quorum`, `sync-all`) when configured, in a supported lab |
|
||||
| Maturity | proof of concept | alpha |
|
||||
|
||||
## Agent workspace disks
|
||||
Both uses share one core. `blockvolume` serves one volume replica; its
|
||||
frontends turn block requests into a single Read / Write / Sync contract, and
|
||||
`Sync` is the only durability point. Writes land in a local WAL engine,
|
||||
`walstore` (a WAL plus an extent). `blockvolume --durable-impl` defaults to
|
||||
auto: a new volume is created as `walstore` and an existing one opens with its
|
||||
on-disk format; auto refuses a `walstore-chunk` root, which needs
|
||||
`--durable-impl=walstore-chunk` with its remote configuration. `smartwal` is
|
||||
experimental. `blockmaster` is the only component that mints epochs. Each
|
||||
`blockvolume` admits I/O only while its local view of the assignment is
|
||||
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.
|
||||
|
||||
An agent sandbox needs a disk that works like a laptop disk (`npm ci`,
|
||||
`git clone`, compilers, SQLite), and it also needs snapshot, fork, rollback and
|
||||
restore-on-another-host. Seaweed Block gives each workspace:
|
||||
## Highlights
|
||||
|
||||
- **A local-speed disk.** The volume runs next to the VM. The guest sees a
|
||||
plain virtio block device through NVMe/TCP loopback or a ublk device. Writes
|
||||
and `fsync` complete against a local write-ahead log, and nothing waits on
|
||||
the network.
|
||||
- **Durable, incremental snapshots in SeaweedFS.** A cut uploads only the 4 MiB
|
||||
chunks changed since the last cut. Chunks are immutable. The volume's state
|
||||
is a small HEAD manifest, a root of about 2 KB that points at segment
|
||||
manifests, and every publish is a fenced, conditional update of that root.
|
||||
- **Cheap snapshot and fork.** A snapshot or fork copies only the HEAD root;
|
||||
chunks are shared. Unreferenced chunks are reclaimed by a two-phase, graced
|
||||
GC.
|
||||
- **Move to any host.** Detach on one host. Another host takes over with a
|
||||
higher epoch, starts from the HEAD alone and fetches chunks lazily on first
|
||||
read. A stale holder cannot publish after takeover, because every HEAD
|
||||
update is conditional on `{gen, epoch}`.
|
||||
- **Single replica by design.** Workspaces run with one local replica, and
|
||||
durability comes from SeaweedFS snapshots, so there is no synchronous
|
||||
replication on the write path. Losing a host loses at most the writes since
|
||||
the last cut. Cut on semantic points: after an agent step, before a risky
|
||||
**Agent workspace disks**
|
||||
|
||||
- **Local-speed disk.** Writes and `fsync` complete against the local WAL;
|
||||
nothing on the write path waits on the network.
|
||||
- **Incremental snapshots.** A cut uploads only the changed 4 MiB chunks.
|
||||
Chunks are immutable; the volume's state is a HEAD root of about 2 KB, and
|
||||
every publish is a conditional update on `{gen, epoch}`.
|
||||
- **Cheap snapshot and fork.** Both copy only the HEAD root; chunks are shared.
|
||||
A two-phase, graced GC reclaims unreferenced chunks.
|
||||
- **Move to any host.** Another host takes over with a higher epoch and fetches
|
||||
chunks lazily on first read. A stale holder cannot publish.
|
||||
- **Single replica by design.** Losing a host loses at most the writes since
|
||||
the last cut. Cut at semantic points: after an agent step, before a risky
|
||||
command, on detach.
|
||||
|
||||
```text
|
||||
agent microVM ──virtio-blk──> blockvolume (local WAL + extent)
|
||||
│ cut: changed chunks only
|
||||
▼
|
||||
SeaweedFS (immutable chunks + HEAD manifest)
|
||||
│ snapshot / fork = copy HEAD root
|
||||
▼
|
||||
another host: take over HEAD (epoch+1), lazy-load chunks
|
||||
**Kubernetes block volumes (alpha)**: Helm install, dynamic PVCs, RF=3
|
||||
recovery gates in a supported lab, support-bundle replay, and negative-first
|
||||
read-only status (stale evidence is `Ready=Unknown`, never a false ready).
|
||||
|
||||
## Measured results
|
||||
|
||||
Lab runs, median of 3; not SLOs. Workloads: Firecracker microVMs (4 vCPU,
|
||||
4 GiB) on one bare-metal host over NVMe/TCP loopback, against a local
|
||||
file-backed disk. Snapshot and fork: a host-side proxy without network
|
||||
latency, guest `fsync` or the block frontend.
|
||||
|
||||
| Measurement | Seaweed Block | Local disk |
|
||||
|---|---|---|
|
||||
| `npm ci` (617 packages, offline) / `git clone` (Go 1.23, local) | 2.14 s / 7.10 s | 2.14 s / 6.99 s |
|
||||
| Untar 100,000 files / cold `find` + `stat` over them | 1.10 s / 0.32 s | 1.06 s / 0.33 s |
|
||||
| 2,000 × create + write + `fsync` | 14.33 s | 6.09 s |
|
||||
| Snapshot / fork of a 10 GiB volume (2,560 chunks) | 0.18 ms / 0.29 ms | |
|
||||
| Two-host lifecycle: create, snapshot, fork, move, stale holder, delete, GC | 35 of 35 checks | |
|
||||
|
||||
Metadata-heavy workloads run at local-disk speed. The cost in these runs is
|
||||
`fsync` latency, about 7 ms against 3 ms local, measured with the NVMe/TCP
|
||||
loopback frontend. The ublk frontend and per-stage `fsync` histograms are on
|
||||
`main` now; latency improvement is in progress.
|
||||
[Workspace measurements](docs/workspace-measurements.md) has every number and
|
||||
how each was measured.
|
||||
|
||||
## Install
|
||||
|
||||
The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI; there is
|
||||
no versioned release yet. **Option 1:** copy them from the image that every
|
||||
push to `main` publishes (`sha-<12-character commit>`; this one is `04e76603`,
|
||||
not a release):
|
||||
|
||||
```bash
|
||||
TAG=sha-04e7660398c3
|
||||
docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:$TAG
|
||||
for b in blockmaster blockvolume sw-block; do docker cp swb-extract:/usr/local/bin/$b .; done
|
||||
docker rm swb-extract && ./blockvolume --version
|
||||
```
|
||||
|
||||
### Measured
|
||||
**Option 2:** build from source (the Go version in `go.mod`):
|
||||
```bash
|
||||
git clone https://github.com/seaweedfs/seaweed-block && cd seaweed-block
|
||||
for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done
|
||||
```
|
||||
|
||||
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
|
||||
come from a host-side proxy, described with their table. Each number is the
|
||||
median of 3 runs. They are measurements, not SLOs.
|
||||
**Option 3:** Helm, see the [Kubernetes quick start](#quick-start-kubernetes-alpha).
|
||||
Services: [standalone deployment](docs/standalone-deployment.md).
|
||||
|
||||
**Workspace workloads, Seaweed Block disk vs a local file-backed disk** (one
|
||||
bare-metal host; NVMe/TCP loopback; seconds):
|
||||
## Try it
|
||||
|
||||
| Workload | Seaweed Block | Local disk |
|
||||
|---|---|---|
|
||||
| `npm ci` (617 packages, offline) | 2.14 | 2.14 |
|
||||
| `git clone` (Go 1.23 repository, local) | 7.10 | 6.99 |
|
||||
| Untar 5,000 files | 0.31 | 0.31 |
|
||||
| Untar a 100,000-file tree | 1.10 | 1.06 |
|
||||
| `find` + `stat` over 100,000 files (cold) | 0.32 | 0.33 |
|
||||
| 2,000 × create + write + `fsync` | 14.33 | 6.09 |
|
||||
The [first volume check](docs/standalone-deployment.md#first-volume-read-only-check)
|
||||
starts `blockmaster` and one `blockvolume`, attaches a 256 MiB volume over
|
||||
NVMe/TCP on loopback, shows the device and its status, and stops. It does
|
||||
not format or write the attached device; it only creates local backing files
|
||||
and logs. It needs Linux, bash, `nvme-cli`, `sudo` and the binaries
|
||||
above. To format and write, use the [write test](docs/standalone-deployment.md#write-test-scratch-host-only) (scratch host only).
|
||||
|
||||
- Metadata-heavy agent workloads run at local-disk speed, because the guest
|
||||
kernel absorbs metadata and the block device only sees batched writes.
|
||||
- Every guest `fsync` was verified to reach the backend sync: about 2 NVMe
|
||||
flushes per `fsync`, and zero in an unsafe-cache control.
|
||||
- The cost today is `fsync` latency, about 7 ms against 3 ms local. Work in
|
||||
progress to close that gap: the ublk frontend, group commit, and a per-stage
|
||||
`fsync` latency breakdown (`/status` histograms).
|
||||
- The same comparison on an Azure `D16s_v5` nested-virtualization host gives
|
||||
the same picture.
|
||||
## Agent workspace disks: chunk lifecycle
|
||||
|
||||
**Snapshot and fork cost** (a 10 GiB volume written as 2,560 chunks of 4 MiB;
|
||||
median of 3). This is a host-side proxy, not a guest or network run: chunks are
|
||||
local files on a native Linux host, and filer metadata calls use a
|
||||
deterministic model, so network latency, guest `fsync` and the block frontend
|
||||
are excluded.
|
||||
The workspace path runs `blockvolume` with `--durable-impl=walstore-chunk`,
|
||||
`--chunk-filer <filer>` and `--chunk-control-endpoint`, against a SeaweedFS
|
||||
cluster. The `sw-block ops chunk` commands drive the lifecycle:
|
||||
|
||||
| | Flat manifest | Two-level manifest (current) |
|
||||
|---|---|---|
|
||||
| HEAD size | 261,531 B | 2,172 B |
|
||||
| Snapshot | 5.79 ms | 0.18 ms |
|
||||
| Fork | 10.67 ms | 0.29 ms |
|
||||
|
||||
In the same proxy, a cut that writes 64 dirty chunks (256 MiB) took a median
|
||||
624 ms with one upload at a time and 434 ms with 8 parallel uploads.
|
||||
|
||||
**Workspace lifecycle on two hosts** (Firecracker VMs, SeaweedFS chunk backend):
|
||||
|
||||
- 35 of 35 checks passed:
|
||||
- create;
|
||||
- write;
|
||||
- snapshot S1 and S2;
|
||||
- fork from S1, which is independent of its parent;
|
||||
- a clean move to the second host;
|
||||
- a stale-holder replay, which is refused;
|
||||
- delete the fork and S1, then GC.
|
||||
- GC reclaimed 38 of 38 candidate chunks, and every reclaimed chunk returns 404.
|
||||
- Everything still referenced read back byte-identical, including the moved
|
||||
workspace's digest before and after GC.
|
||||
|
||||
### Try the chunk lifecycle
|
||||
|
||||
The `sw-block ops chunk` commands drive the workspace lifecycle against a
|
||||
running blockmaster and blockvolume (`--durable-impl=walstore-chunk`,
|
||||
`--chunk-filer <filer>`):
|
||||
|
||||
| Command | What it does |
|
||||
|---|---|
|
||||
| `sw-block ops chunk cut` | Publish the changed chunks and advance HEAD |
|
||||
| `sw-block ops chunk snapshot` / `snapshots` | Name a snapshot / list snapshots |
|
||||
| `sw-block ops chunk fork` | Create a new volume from a snapshot (root copy only) |
|
||||
| `sw-block ops chunk detach` | Final cut and release, ready to resume elsewhere |
|
||||
| `sw-block ops chunk volume-delete` | Delete a volume; refused while it is attached or has snapshots |
|
||||
| `sw-block ops chunk gc` | Preview or apply two-phase GC of unreferenced chunks |
|
||||
```bash
|
||||
sw-block ops chunk cut --volume v1 --status-addr <status> # publish changed chunks, advance HEAD
|
||||
sw-block ops chunk snapshot --volume v1 --status-addr <status> --name s1 # name a snapshot
|
||||
sw-block ops chunk snapshots --volume v1 --chunk-filer <filer> # list snapshots
|
||||
sw-block ops chunk fork --chunk-filer <filer> --source v1 --snapshot s1 --target v2 # root copy only
|
||||
sw-block ops chunk detach --volume v1 --status-addr <status> # final cut and release; resume elsewhere
|
||||
sw-block ops chunk volume-delete --volume v2 --chunk-filer <filer> --master <blockmaster> --request-id del-v2
|
||||
sw-block ops chunk gc --chunk-filer <filer> --master <blockmaster> # preview; --apply to reclaim
|
||||
```
|
||||
|
||||
`volume-delete` is refused while the volume is attached or has snapshots.
|
||||
The chunk path (`walstore-chunk`) is a proof of concept. It is not yet a
|
||||
default, a release claim or a production path.
|
||||
|
||||
### Correctness work
|
||||
## Quick start: Kubernetes (alpha)
|
||||
|
||||
- **Formal models.** The chunk lifecycle, host takeover, and WAL crash
|
||||
recovery protocols are model-checked with TLA+ and TLC. Counterexamples found
|
||||
this way became fixes and regression tests, for example the persisted-tail
|
||||
WAL reuse fix and last-writer-wins recovery replay.
|
||||
- **Fail closed.** Recovery reports typed reasons such as `wal_corrupt` and
|
||||
`io_error` instead of serving uncertain data.
|
||||
For supported lab clusters, not production. From the repository root, with
|
||||
`kubectl` and `helm` configured:
|
||||
|
||||
```bash
|
||||
go build -o sw-block ./cmd/sw-block && export PATH="$PWD:$PATH"
|
||||
sw-block ops generate-helm-values --out values.day1.yaml \
|
||||
--image ghcr.io/seaweedfs/seaweed-block:sha-dc2972d0059b \
|
||||
--csi-image ghcr.io/seaweedfs/seaweed-block-csi:sha-dc2972d0059b
|
||||
helm install sw-block charts/seaweed-block --namespace kube-system \
|
||||
--create-namespace -f values.day1.yaml --wait --timeout 10m
|
||||
SW_BLOCK_INSTALL_MODE=helm SW_BLOCK_HELM_RELEASE=sw-block \
|
||||
SW_BLOCK_HELM_NAMESPACE=kube-system SW_BLOCK_HELM_VALUES_FILE=values.day1.yaml \
|
||||
bash scripts/run-basic-app-example.sh "$PWD"
|
||||
```
|
||||
|
||||
The last command writes a PVC from one pod and reads it from a replacement
|
||||
pod; expect `first_volume_status=ok` in
|
||||
`/tmp/sw-block-basic-app-*/first-volume-summary.txt`. `sha-dc2972d0059b` is
|
||||
the validated tag for the v0.4 read-only status path; later paths need
|
||||
matching [release images](docs/kubernetes-status.md#release-images), and
|
||||
`:alpha` is for smoke tests only. Each step's output is in the [Kubernetes
|
||||
quickstart](docs/quickstart-kubernetes.md). To clean up:
|
||||
|
||||
```bash
|
||||
helm uninstall sw-block --namespace kube-system
|
||||
bash scripts/uninstall-k8s-alpha.sh "$PWD" && bash scripts/verify-helm-cleanup.sh
|
||||
```
|
||||
|
||||
|
||||
## Status
|
||||
|
||||
| Area | Status |
|
||||
|---|---|
|
||||
| Agent workspace disks (`walstore-chunk`) | Proof of concept |
|
||||
| Kubernetes: Helm install, PVC provisioning, writer/reader check, read-only report and dashboard, CRD status and Events, support-bundle replay | Available (alpha) |
|
||||
| Kubernetes: RF=3 multi-volume, CSI reattach recovery, iSCSI ALUA/dm-multipath mounted failover, restart persistence with hostPath | Gated (supported lab) |
|
||||
| Kubernetes: `SwBlockVolume` finalizer lifecycle owner, returned-replica ACK eligibility executor | Beta candidate |
|
||||
| Kubernetes: NVMe/TCP CSI multipath, returned-replica failback runtime, WAL multi-block record opt-in | Source-gated |
|
||||
| Kubernetes: backup, snapshot and restore; returned-replica rebuild traffic | Planned |
|
||||
|
||||
Full table and conditions: [Kubernetes status](docs/kubernetes-status.md);
|
||||
run evidence: [release notes](docs/releases/README.md).
|
||||
|
||||
### Not claimed yet
|
||||
|
||||
- Production readiness, SLOs, or a published performance claim.
|
||||
- `fsync` parity with local disk. That is work in progress, as described above.
|
||||
- Production readiness, SLOs, or a published performance, RTO or RPO claim.
|
||||
- `fsync` parity with local disk (in progress, see Measured results).
|
||||
- ublk at high density. Unprivileged per-volume servers need a privileged
|
||||
control broker, which is not done.
|
||||
- Crash-restart recovery of a ublk server. A crashed server fails closed.
|
||||
- Multi-replica workspaces combined with chunk snapshots.
|
||||
- The `smartwal` storage engine. It is experimental: in-place overwrites
|
||||
have no rollback on a torn write, blocks lose their per-block CRC once
|
||||
their ring records recycle, the handling of a corrupted committed record
|
||||
is still open, and it has no chunk-snapshot support. New volumes use
|
||||
`walstore`; `blockvolume --durable-impl` defaults to auto, which creates
|
||||
new volumes as `walstore` and opens an existing volume with its on-disk
|
||||
format. A `walstore-chunk` volume is refused under auto and needs
|
||||
`--durable-impl=walstore-chunk` with its remote configuration.
|
||||
- The `smartwal` engine, which is experimental: no rollback for a torn
|
||||
in-place overwrite, no per-block CRC once its ring record recycles, open
|
||||
handling of a corrupted committed record, and no chunk snapshots.
|
||||
- Kubernetes: backup and restore, a production operator, automatic failback
|
||||
or cleanup, upgrade execution, broad compatibility, and more: see
|
||||
[what you should not expect yet](docs/kubernetes-status.md#what-you-should-not-expect-yet).
|
||||
|
||||
## Kubernetes block storage (alpha)
|
||||
## Correctness and verification
|
||||
|
||||
The Kubernetes path is focused on one user-visible loop:
|
||||
|
||||
```text
|
||||
install on Kubernetes
|
||||
-> create a PVC-backed block volume
|
||||
-> mount it in an app pod
|
||||
-> write/read data
|
||||
-> inspect status and support evidence
|
||||
-> clean up
|
||||
```
|
||||
|
||||
This is an **alpha** product path for supported lab clusters, not production.
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/assets/seaweed-block-hero.svg" alt="Seaweed Block alpha architecture: Kubernetes PVC to CSI, blockmaster, blockvolume, iSCSI, and WAL-backed recovery" width="100%">
|
||||
</p>
|
||||
|
||||
### Kubernetes feature & status
|
||||
|
||||
| Feature | Status | Feature | Status |
|
||||
|---|---|---|---|
|
||||
| Kubernetes PVC provisioning | Available | Helm install path | Available |
|
||||
| First PVC writer/reader verification | Available | Read-only report/dashboard | Available |
|
||||
| Support-bundle replay | Available | Negative-first status reasons | Available |
|
||||
| Multi-volume RF=3 lab path | Gated | CSI reattach recovery | Gated |
|
||||
| iSCSI ALUA/dm-multipath mounted failover | Gated | Restart persistence with hostPath | Gated |
|
||||
| Actionable read-only CRD status + Events | Available | Bounded SwBlockVolume finalizer lifecycle | Beta candidate |
|
||||
| Returned-replica ACK eligibility executor | Beta candidate | Returned-replica failback runtime | Source-gated |
|
||||
| Returned-replica rebuild traffic | Planned | Frontend publication after failback | Planned |
|
||||
| NVMe/TCP CSI multipath + backend write batching | Source-gated | NVMe/RDMA Kubernetes CSI publish/attach | Source-gated |
|
||||
| WAL multi-block record opt-in | Source-gated | WAL format default change | Not claimed |
|
||||
| Backup/snapshot/restore | Planned | NVMe/RDMA failover or performance SLO | Not claimed |
|
||||
| Production SLO/performance claims | Not claimed | Hosted production UI | Not claimed |
|
||||
|
||||
### What You Can Do Today
|
||||
|
||||
- Install Seaweed Block through Helm on a supported Kubernetes/k3s lab.
|
||||
- Create and mount PVC-backed block volumes through normal Kubernetes PVCs.
|
||||
- Verify writer/reader persistence with ordinary app pods.
|
||||
- Run multiple RF=3 volumes in the gated lab path.
|
||||
- Validate gated recovery paths:
|
||||
- CSI reattach with pod recreate,
|
||||
- iSCSI ALUA + dm-multipath transparent mounted failover on the proven
|
||||
Stage-2 path,
|
||||
- interleaved multi-volume failover isolation.
|
||||
- Inspect cluster, volume, replica, primary, frontend, timeline, and reason
|
||||
evidence through read-only CLI/report/dashboard surfaces.
|
||||
- Publish the same read-only status into Kubernetes-native `SwBlockCluster` /
|
||||
`SwBlockVolume` `.status` and Events on the gated operator-status path.
|
||||
- Inspect node readiness, support evidence refs, cleanup-required status, and
|
||||
safe read-only/scripted next-step hints through that same status model.
|
||||
- Use the beta-candidate lifecycle-owner path to protect `SwBlockVolume` CRs
|
||||
with a Seaweed Block finalizer and release it only after clean externally
|
||||
supplied cleanup evidence.
|
||||
- Inspect install drift status for current versus desired chart/app/image
|
||||
identity. This is visibility only, not upgrade execution.
|
||||
- In the gated returned-replica path, inspect a bounded authority-executor
|
||||
result that records ACK eligibility on `SwBlockReplicaEligibility.status`
|
||||
after live evidence proves the old primary remains fenced, the current primary
|
||||
is unchanged, and the required durable frontier is covered.
|
||||
- From source, run the opt-in returned-replica failback runtime gates. This path
|
||||
can move authority through blockmaster only when a `SwBlockReplicaFailback`
|
||||
target, explicit execution policy, expected-current evidence, and terminal
|
||||
evidence are all present. It is not enabled by default and is not yet a
|
||||
published release claim.
|
||||
- From source, run the supported-lab NVMe/TCP gates: ANA/direct-host baseline,
|
||||
CSI protocol selection, Kubernetes CSI multipath attach for one NQN/NSID with
|
||||
multiple NVMe frontend paths, one-path-loss status honesty, mounted pod
|
||||
write/read after one observed path loss, mounted pod write/read after the
|
||||
removed path is restored, multi-volume mounted path isolation, bounded
|
||||
multi-volume path churn, repeated stage/unstage residue checks, a bounded
|
||||
writer/reader soak, a baseline over the configured 100GbE TCP frontend
|
||||
address, a source-gated CSI-node reconnect owner contract, and a live
|
||||
host-path reconnect gate for scoped `nvme disconnect -d` path loss, plus a
|
||||
live desired path-set replacement gate where CSI-node connects the new
|
||||
desired NVMe path and prunes the stale old host path without remounting the
|
||||
pod, and a durable backend full-block write-batching gate with
|
||||
product-owned `/status/durable` counters. The source-gated WAL multi-block
|
||||
record opt-in has mounted profile and restart/recovery compatibility evidence,
|
||||
plus mounted durable-status `HeadLSN` confirmation, but remains default-off
|
||||
and requires a future matching-image release smoke before it becomes a public
|
||||
image claim. The opt-in NVMe/RDMA path now carries an explicit transport from
|
||||
StorageClass through blockmaster publication and CSI NodeStage, mounts a
|
||||
dynamic PVC on a second RoCE host, and verifies writer/reader data through a
|
||||
standard Linux `nvme connect -t rdma` controller. It remains source-gated.
|
||||
These are supported-lab source-gated claims, not broad NVMe compatibility,
|
||||
production HA, or performance/SLO claims.
|
||||
- Replay support bundles offline.
|
||||
|
||||
These are narrow alpha claims tied to documented gates. See
|
||||
[release notes](docs/releases/README.md) for exact run evidence.
|
||||
|
||||
### What You Should Not Expect Yet
|
||||
|
||||
- Production readiness or production SLOs.
|
||||
- A production-grade operator or broad mutating admin workflow. The current
|
||||
lifecycle-owner owns only the Seaweed Block `SwBlockVolume` protection
|
||||
finalizer.
|
||||
- Automatic cleanup execution, host repair, or PVC/PV/workload deletion.
|
||||
Delete-safety uses externally supplied cleanup evidence.
|
||||
- Backup, snapshot, or restore.
|
||||
- Returned-replica rebuild traffic, frontend publication after failback, or
|
||||
automatic deployed failback. The failback runtime path is explicit, opt-in,
|
||||
and source-gated until a release smoke validates it on published images.
|
||||
- Transparent Kubernetes node-loss failover without pod recreate.
|
||||
- Broad NVMe/RoCE compatibility, performance/SLO, or transparent failover
|
||||
parity beyond the documented supported-lab gates. The CSI-node reconnect
|
||||
owner, host-path reconnect gate, desired path-set replacement gate, and
|
||||
stale path pruning gate exist only as source-gated NVMe/TCP evidence. The
|
||||
NVMe/RDMA path has standalone and Kubernetes single-path publish/attach
|
||||
evidence, but no RDMA multipath, reconnect/failover, performance, or SLO
|
||||
claim.
|
||||
- Broad distro/kernel/initiator compatibility.
|
||||
- Upgrade or rollback execution. The status layer can report install drift, but
|
||||
it does not run Helm or kubectl mutations.
|
||||
|
||||
### Five-Minute Quick Start
|
||||
|
||||
From the repository root:
|
||||
|
||||
```bash
|
||||
go build -o sw-block ./cmd/sw-block
|
||||
export PATH="$PWD:$PATH"
|
||||
|
||||
sw-block ops generate-helm-values \
|
||||
--out values.day1.yaml \
|
||||
--image ghcr.io/seaweedfs/seaweed-block:sha-dc2972d0059b \
|
||||
--csi-image ghcr.io/seaweedfs/seaweed-block-csi:sha-dc2972d0059b
|
||||
|
||||
helm install sw-block charts/seaweed-block \
|
||||
--namespace kube-system \
|
||||
--create-namespace \
|
||||
-f values.day1.yaml \
|
||||
--wait \
|
||||
--timeout 10m
|
||||
|
||||
SW_BLOCK_INSTALL_MODE=helm \
|
||||
SW_BLOCK_HELM_RELEASE=sw-block \
|
||||
SW_BLOCK_HELM_NAMESPACE=kube-system \
|
||||
SW_BLOCK_HELM_VALUES_FILE=values.day1.yaml \
|
||||
bash scripts/run-basic-app-example.sh "$PWD"
|
||||
```
|
||||
|
||||
Expected summary in the latest `/tmp/sw-block-basic-app-*/first-volume-summary.txt`:
|
||||
|
||||
```text
|
||||
first_volume_status=ok
|
||||
writer_verified=true
|
||||
reader_verified=true
|
||||
inventory_status=ok
|
||||
status_report=status/report/index.html
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
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.
|
||||
The v0.6 returned-replica ACK eligibility executor path likewise requires
|
||||
matching images published from the Phase 54 release commit and must be validated
|
||||
with the release smoke before it is marked shipped.
|
||||
The returned-replica failback runtime added after v0.6 is source-gated and
|
||||
requires a future release smoke before it becomes a public image claim. The
|
||||
NVMe/TCP supported-lab path is also source-gated until matching `seaweed-block`
|
||||
and `seaweed-block-csi` images are published and pass the NVMe release smoke.
|
||||
|
||||
Mutable `:alpha` is a smoke/demo tag only; it can drift from the source tree.
|
||||
|
||||
### Operations
|
||||
|
||||
Port-forward blockmaster when reading live cluster state:
|
||||
|
||||
```bash
|
||||
kubectl -n kube-system port-forward deploy/sw-blockmaster 9333:9333
|
||||
```
|
||||
|
||||
Common read-only commands:
|
||||
|
||||
| Command | Use |
|
||||
|---|---|
|
||||
| `sw-block ops cluster --master-api 127.0.0.1:9333 -o json` | Cluster snapshot. |
|
||||
| `sw-block ops volumes --master-api 127.0.0.1:9333` | List volumes, status, primary, node, frontend. |
|
||||
| `sw-block ops describe volume <id> --namespace default --master 127.0.0.1:9333` | Describe one volume. |
|
||||
| `sw-block ops timeline volume --from-bundle <dir> <id> -o jsonl` | Read a saved event timeline. |
|
||||
| `sw-block ops explain volume --from-bundle <dir> <id>` | Explain ready, blocked, stale, or recovering state. |
|
||||
| `sw-block ops report --master-api 127.0.0.1:9333 --out <dir>` | Generate static report artifacts. |
|
||||
| `sw-block ops dashboard --master-api 127.0.0.1:9333 --listen 127.0.0.1:9334` | Serve local read-only dashboard. |
|
||||
| `sw-block ops inventory --namespace default --master 127.0.0.1:9333 --out <dir>` | Collect replica-level inventory. |
|
||||
|
||||
Reports and dashboard expose `operator-snapshot.json`, a read-only status
|
||||
projection. The gated operator-status controller can publish that model into
|
||||
Kubernetes CRD `.status` and Events, including node readiness, cleanup/delete
|
||||
safety, and install-drift visibility. It has no mutating admin actions.
|
||||
|
||||
Support-bundle replay:
|
||||
|
||||
```bash
|
||||
bash scripts/collect-helm-support-bundle.sh "$PWD"
|
||||
sw-block ops report --from-bundle <bundle-or-artifact-dir> --out /tmp/sw-block-report
|
||||
sw-block ops explain volume <volume-id> --from-bundle <bundle-or-artifact-dir>
|
||||
sw-block ops dashboard --from-bundle <bundle-or-artifact-dir> --listen 127.0.0.1:9334
|
||||
```
|
||||
|
||||
The status surface is negative-first. If evidence is missing or stale, the
|
||||
system reports `Ready=Unknown` / `EvidenceStale=True` rather than claiming a
|
||||
false ready state.
|
||||
|
||||
### Cleanup
|
||||
|
||||
```bash
|
||||
helm uninstall sw-block --namespace kube-system
|
||||
bash scripts/uninstall-k8s-alpha.sh "$PWD"
|
||||
bash scripts/verify-helm-cleanup.sh
|
||||
```
|
||||
|
||||
The cleanup verifier checks Kubernetes resources, iSCSI sessions, iSCSI node
|
||||
DB records, dm-multipath maps, `dmsetup` devices, product processes, and
|
||||
hostPath residue.
|
||||
- **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),
|
||||
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
|
||||
regression tests ([#152](https://github.com/seaweedfs/seaweed-block/pull/152), [#156](https://github.com/seaweedfs/seaweed-block/pull/156), [#158](https://github.com/seaweedfs/seaweed-block/pull/158), [#159](https://github.com/seaweedfs/seaweed-block/pull/159)).
|
||||
- **Fail closed**: recovery that cannot establish a consistent image reports
|
||||
a typed reason (`wal_corrupt`, `io_error`) instead of serving; some
|
||||
suspected damage (`wal_hole_suspected`) is a status warning only.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Kubernetes quickstart](docs/quickstart-kubernetes.md) - first install and PVC.
|
||||
- [User capabilities](docs/user-capabilities.md) - detailed current behavior.
|
||||
- [Release notes](docs/releases/README.md) - exact validated claims and evidence.
|
||||
- [NVMe/TCP supported-lab claim](docs/releases/nvme-tcp-supported-lab.md) -
|
||||
source-gated NVMe evidence, release-smoke boundary, and non-claims.
|
||||
- [Roadmap](docs/roadmap.md) - public planning summary.
|
||||
- [Architecture](docs/architecture.md), [developer architecture](docs/developer-architecture.md),
|
||||
and [runtime state machines](docs/runtime-state-machines.md) - engineering
|
||||
references, not release-claim sources.
|
||||
- Design: [design reference](docs/design/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)
|
||||
- Engineering references, not release-claim sources: [architecture](docs/architecture.md),
|
||||
[developer architecture](docs/developer-architecture.md), [runtime state machines](docs/runtime-state-machines.md)
|
||||
|
||||
## Development
|
||||
|
||||
Run release-relevant scoped tests:
|
||||
|
||||
```bash
|
||||
go test ./cmd/sw-block ./core/ops ./core/csi ./core/launcher ./core/host/master -count=1
|
||||
go build ./... && go vet ./... && go test -short ./... # what CI runs
|
||||
go test ./cmd/sw-block ./core/ops ./core/csi ./core/launcher ./core/host/master -count=1 # release-scoped
|
||||
```
|
||||
|
||||
`go test ./...` is the full repository sweep and may include unrelated
|
||||
in-progress packages outside the current release gate.
|
||||
|
||||
Script activation remains available for development/local-image fallback:
|
||||
|
||||
```bash
|
||||
bash scripts/activate-k8s-alpha.sh "$PWD"
|
||||
bash scripts/run-basic-app-example.sh "$PWD"
|
||||
```
|
||||
The full `go test ./...` sweep may include in-progress packages outside the
|
||||
release gate. `scripts/activate-k8s-alpha.sh` remains for local images.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Seaweed Block: example settings for blockmaster
|
||||
# (deploy/systemd/sw-blockmaster.service). Install as
|
||||
# /etc/sw-block/blockmaster.env.
|
||||
#
|
||||
# The binaries are configured by command-line flags. The SWB_* variables in
|
||||
# this file exist only so the example unit can build those flags; blockmaster
|
||||
# does not read them. Each entry names the flag it feeds, the flag's default,
|
||||
# and what it means.
|
||||
#
|
||||
# State: the unit's StateDirectory=sw-block-master creates
|
||||
# /var/lib/sw-block-master, owned by the sw-block user. Only blockmaster
|
||||
# writes there.
|
||||
|
||||
# ---------------------------------------------------------------- blockmaster
|
||||
|
||||
# --authority-store (required, no default). Durable authority store directory:
|
||||
# assignments, epochs, leases. Losing it loses the epoch history.
|
||||
SWB_MASTER_AUTHORITY_STORE=/var/lib/sw-block-master/authority
|
||||
# --listen (default 127.0.0.1:0). gRPC listen address. The control plane has
|
||||
# no authentication; keep it on loopback or a trusted network.
|
||||
SWB_MASTER_LISTEN=127.0.0.1:9180
|
||||
# --topology (default empty: no assignments are minted). Accepted-topology
|
||||
# YAML: volumes and their replica slots. See deploy/config/topology.yaml.
|
||||
SWB_MASTER_TOPOLOGY=/etc/sw-block/topology.yaml
|
||||
# --expected-slots-per-volume (default 3). Replica slots per volume; must match
|
||||
# the topology. 1 for a single-replica volume.
|
||||
SWB_MASTER_EXPECTED_SLOTS=1
|
||||
# --freshness-window (default 30s). How long a server's heartbeat stays fresh.
|
||||
SWB_MASTER_FRESHNESS_WINDOW=30s
|
||||
# --pending-grace (default 1s). Startup grace before a missing observation is
|
||||
# reported as unsupported.
|
||||
SWB_MASTER_PENDING_GRACE=1s
|
||||
# --workspace-rpc (default false). Enable the workspace lease, revocation and
|
||||
# move RPCs (agent workspace disks, proof of concept).
|
||||
SWB_MASTER_WORKSPACE_RPC=false
|
||||
# --workspace-head-base-url (default empty; required with --workspace-rpc).
|
||||
# Filer HTTP directory that holds the per-volume HEAD files.
|
||||
SWB_MASTER_WORKSPACE_HEAD_BASE_URL=
|
||||
# --workspace-max-clock-skew (default 20s; must be >0 and <60s). Host leases
|
||||
# shorten by half of it; forced moves wait the full bound.
|
||||
SWB_MASTER_WORKSPACE_MAX_CLOCK_SKEW=20s
|
||||
# Extra blockmaster flags, split on spaces. The --launcher-*, --lifecycle-*,
|
||||
# --cluster-spec, --failback-runtime-rpc and --frontend-publication-runtime-*
|
||||
# flags belong to the Kubernetes path and are set by the Helm chart.
|
||||
SWB_MASTER_EXTRA_ARGS=
|
||||
@@ -0,0 +1,20 @@
|
||||
# Overrides for the root ublk variant (deploy/systemd/sw-blockvolume-ublk.service).
|
||||
# Install as /etc/sw-block/blockvolume-ublk.env. The unit reads
|
||||
# blockvolume.env first and this file second; values here win.
|
||||
#
|
||||
# The ublk unit runs as root, so it gets its own state directory
|
||||
# (StateDirectory=sw-block-volume-ublk, /var/lib/sw-block-volume-ublk). It never
|
||||
# touches /var/lib/sw-block-master or /var/lib/sw-block-volume.
|
||||
#
|
||||
# Not a data migration: switching from sw-blockvolume to this unit does not
|
||||
# move or reopen the volume under /var/lib/sw-block-volume; this unit creates
|
||||
# a new, empty volume in its own directory.
|
||||
|
||||
# --durable-root for the root-owned service.
|
||||
SWB_DURABLE_ROOT=/var/lib/sw-block-volume-ublk/volumes
|
||||
# --ublk-device: serve the volume as /dev/ublkb0. The id must be free: the
|
||||
# server refuses an id whose device already exists.
|
||||
SWB_UBLK_DEVICE=0
|
||||
# NVMe/TCP off for this variant.
|
||||
SWB_NVME_LISTEN=
|
||||
SWB_NVME_SUBSYSNQN=
|
||||
@@ -0,0 +1,137 @@
|
||||
# Seaweed Block: example settings for one blockvolume
|
||||
# (deploy/systemd/sw-blockvolume.service, and the root ublk variant
|
||||
# sw-blockvolume-ublk.service, which reads this file first and then
|
||||
# blockvolume-ublk.env). Install as /etc/sw-block/blockvolume.env, readable
|
||||
# only by root and the sw-block user (it can hold the iSCSI CHAP secret).
|
||||
#
|
||||
# The binaries are configured by command-line flags. The SWB_* variables in
|
||||
# this file exist only so the example units can build those flags;
|
||||
# blockvolume does not read them. The one exception is the iSCSI CHAP pair at
|
||||
# the end, which blockvolume reads from the environment. Each entry names the
|
||||
# flag it feeds, the flag's default, and what it means.
|
||||
#
|
||||
# State: the unit's StateDirectory=sw-block-volume creates
|
||||
# /var/lib/sw-block-volume, owned by the sw-block user. It is separate from
|
||||
# blockmaster's /var/lib/sw-block-master.
|
||||
|
||||
# ---------------------------------------------------------------- blockvolume
|
||||
|
||||
# --master (required). blockmaster gRPC address.
|
||||
SWB_MASTER_ADDR=127.0.0.1:9180
|
||||
# --server-id, --volume-id, --replica-id (required). Must match a slot in the
|
||||
# topology.
|
||||
SWB_SERVER_ID=s1
|
||||
SWB_VOLUME_ID=v1
|
||||
SWB_REPLICA_ID=r1
|
||||
# --data-addr, --ctrl-addr (required). Data-path and control-path addresses.
|
||||
SWB_DATA_ADDR=127.0.0.1:9201
|
||||
SWB_CTRL_ADDR=127.0.0.1:9202
|
||||
# --status-addr (default empty: disabled). Status HTTP endpoint, loopback only
|
||||
# unless --allow-external-status-bind; unauthenticated.
|
||||
SWB_STATUS_ADDR=127.0.0.1:9203
|
||||
# --heartbeat-interval (default 2s). Heartbeat send interval.
|
||||
SWB_HEARTBEAT_INTERVAL=2s
|
||||
# --recover-timeout (default 30s). How long a primary-assigned replica may stay
|
||||
# not promotion-ready before it reports itself unhealthy (recovery_timeout).
|
||||
SWB_RECOVER_TIMEOUT=30s
|
||||
|
||||
# --durable-root (default empty: in-memory, NOT durable). Directory for the
|
||||
# volume's storage files. Must be writable by the service user.
|
||||
SWB_DURABLE_ROOT=/var/lib/sw-block-volume/volumes
|
||||
# --durable-impl (default empty: auto). Auto creates a new volume as walstore,
|
||||
# opens an existing one with its on-disk format, and refuses a walstore-chunk
|
||||
# root. Explicit values: walstore; walstore-chunk (walstore published to
|
||||
# SeaweedFS, proof of concept); smartwal (experimental). This example pins
|
||||
# walstore.
|
||||
SWB_DURABLE_IMPL=walstore
|
||||
# --durable-blocks (default 2048), --durable-blocksize (default 4096). Volume
|
||||
# geometry on first create; ignored when an existing volume is opened.
|
||||
# 65536 x 4096 = 256 MiB.
|
||||
SWB_DURABLE_BLOCKS=65536
|
||||
SWB_DURABLE_BLOCKSIZE=4096
|
||||
|
||||
# --nvme-listen (default empty: disabled). NVMe/TCP target address. Loopback
|
||||
# only (no authentication) unless --allow-external-nvme-bind.
|
||||
SWB_NVME_LISTEN=127.0.0.1:4420
|
||||
# --nvme-subsysnqn (required with --nvme-listen). NVMe subsystem NQN.
|
||||
SWB_NVME_SUBSYSNQN=nqn.2026-05.io.seaweedfs:v1
|
||||
# --nvme-ns (default 1). NVMe namespace id.
|
||||
SWB_NVME_NS=1
|
||||
# --nvme-max-h2c-data-length (default 0: target default). MaxH2CDataLength.
|
||||
SWB_NVME_MAX_H2C_DATA_LENGTH=0
|
||||
|
||||
# --ublk-device (default -1: disabled). Serve the volume as /dev/ublkbN through
|
||||
# the Linux ublk_drv module. Needs root (see the unit file).
|
||||
SWB_UBLK_DEVICE=-1
|
||||
# --ublk-queues (default 0: 1 queue), --ublk-queue-depth (default 0: 64).
|
||||
SWB_UBLK_QUEUES=0
|
||||
SWB_UBLK_QUEUE_DEPTH=0
|
||||
|
||||
# --iscsi-listen (default empty: disabled). iSCSI target address; loopback only
|
||||
# unless --allow-external-iscsi-bind, which requires CHAP.
|
||||
SWB_ISCSI_LISTEN=
|
||||
# --iscsi-iqn (required with --iscsi-listen). Target IQN.
|
||||
SWB_ISCSI_IQN=
|
||||
# --iscsi-portal-addr (default empty: the bound address). Advertised
|
||||
# TargetAddress in SendTargets responses.
|
||||
SWB_ISCSI_PORTAL_ADDR=
|
||||
# --iscsi-lun (default 0). LUN id.
|
||||
SWB_ISCSI_LUN=0
|
||||
# --iscsi-dataout-timeout (default 0: target default). R2T/Data-Out wait bound.
|
||||
SWB_ISCSI_DATAOUT_TIMEOUT=0
|
||||
|
||||
# --replication-ack (default best-effort). best-effort, sync-quorum or
|
||||
# sync-all. sync-* modes fail foreground writes when the required replica
|
||||
# acknowledgement is unavailable. Only matters with more than one slot.
|
||||
SWB_REPLICATION_ACK=best-effort
|
||||
# --wal-retention-lsns (default 0: strict checkpoint-driven recycle). walstore
|
||||
# only: WAL kept past the checkpoint so a lagging replica can catch up.
|
||||
SWB_WAL_RETENTION_LSNS=0
|
||||
# --recovery-mode (default legacy). legacy or dual-lane rebuild path.
|
||||
SWB_RECOVERY_MODE=legacy
|
||||
# --degraded-probe-interval (default 0: off). Degraded-peer probe interval.
|
||||
SWB_DEGRADED_PROBE_INTERVAL=0
|
||||
# --degraded-probe-cooldown-base (default 5s), --degraded-probe-cooldown-cap
|
||||
# (default 60s). Per-peer backoff after a probe attempt.
|
||||
SWB_DEGRADED_PROBE_COOLDOWN_BASE=5s
|
||||
SWB_DEGRADED_PROBE_COOLDOWN_CAP=60s
|
||||
|
||||
# Agent workspace disks (proof of concept). These flags are accepted only with
|
||||
# SWB_DURABLE_IMPL=walstore-chunk; leave them at their defaults otherwise.
|
||||
# --chunk-filer (default empty; required with walstore-chunk). SeaweedFS filer
|
||||
# gRPC address host:port.
|
||||
SWB_CHUNK_FILER=
|
||||
# --chunk-path (default /swblock/chunks). Filer directory, one directory per
|
||||
# volume (HEAD and chunk key bindings).
|
||||
SWB_CHUNK_PATH=/swblock/chunks
|
||||
# --chunk-collection, --chunk-replication (default empty: filer default or
|
||||
# storage rule). Collection and replication for chunk needles.
|
||||
SWB_CHUNK_COLLECTION=
|
||||
SWB_CHUNK_REPLICATION=
|
||||
# --chunk-capture-interval (default 0: no timer). Automatic cut once this long
|
||||
# has passed since the last successful cut, e.g. 15m as a host-loss safety net.
|
||||
SWB_CHUNK_CAPTURE_INTERVAL=0
|
||||
# --chunk-upload-concurrency (default 8; 1..64). Parallel dirty-chunk uploads.
|
||||
SWB_CHUNK_UPLOAD_CONCURRENCY=8
|
||||
# --chunk-dirty-threshold (default 512 chunks = 2 GiB; 0 = unbounded). Bound
|
||||
# on one cut's barrier copy; never triggers a cut.
|
||||
SWB_CHUNK_DIRTY_THRESHOLD=512
|
||||
# --chunk-control-endpoint (default false). Expose /chunk/* (cut, snapshot,
|
||||
# snapshots, snapshot/delete, detach) on the status listener; needs
|
||||
# SWB_STATUS_ADDR.
|
||||
SWB_CHUNK_CONTROL_ENDPOINT=false
|
||||
# --workspace-lease (default false). Require a host-owned master lease; fail
|
||||
# closed when it is unavailable. Needs walstore-chunk and --workspace-rpc on
|
||||
# blockmaster.
|
||||
SWB_WORKSPACE_LEASE=false
|
||||
|
||||
# Extra blockvolume flags, split on spaces, for example the Kubernetes gate
|
||||
# flags --allow-external-*-bind, --status-recovery, --runtime-rebuild-endpoint,
|
||||
# or the source-gated --durable-wal-multiblock-records.
|
||||
SWB_VOLUME_EXTRA_ARGS=
|
||||
|
||||
# iSCSI target-side CHAP, read by blockvolume itself (same as
|
||||
# --iscsi-chap-username / --iscsi-chap-secret). Requires SWB_ISCSI_LISTEN.
|
||||
# Uncomment and replace both values; never use a shared or example secret.
|
||||
# SW_BLOCK_ISCSI_CHAP_USERNAME=REPLACE_WITH_CHAP_USERNAME
|
||||
# SW_BLOCK_ISCSI_CHAP_SECRET=REPLACE_WITH_CHAP_SECRET
|
||||
@@ -0,0 +1,8 @@
|
||||
# Accepted topology for blockmaster --topology: one volume, one replica slot.
|
||||
# replica_id and server_id must match blockvolume --replica-id / --server-id.
|
||||
# blockmaster does not infer topology from heartbeats; this file is the input.
|
||||
volumes:
|
||||
- volume_id: v1
|
||||
slots:
|
||||
- replica_id: r1
|
||||
server_id: s1
|
||||
@@ -0,0 +1,47 @@
|
||||
# Example unit for blockmaster. Settings: /etc/sw-block/blockmaster.env
|
||||
# (deploy/config/blockmaster.env). Create the user once:
|
||||
# sudo useradd --system --no-create-home --shell /usr/sbin/nologin sw-block
|
||||
[Unit]
|
||||
Description=Seaweed Block master (epoch authority)
|
||||
Documentation=https://github.com/seaweedfs/seaweed-block
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=sw-block
|
||||
Group=sw-block
|
||||
EnvironmentFile=/etc/sw-block/blockmaster.env
|
||||
# systemd creates /var/lib/sw-block-master owned by User/Group. blockvolume
|
||||
# units use their own state directories, never this one.
|
||||
StateDirectory=sw-block-master
|
||||
StateDirectoryMode=0750
|
||||
ExecStart=/usr/local/bin/blockmaster \
|
||||
--authority-store=${SWB_MASTER_AUTHORITY_STORE} \
|
||||
--listen=${SWB_MASTER_LISTEN} \
|
||||
--topology=${SWB_MASTER_TOPOLOGY} \
|
||||
--expected-slots-per-volume=${SWB_MASTER_EXPECTED_SLOTS} \
|
||||
--freshness-window=${SWB_MASTER_FRESHNESS_WINDOW} \
|
||||
--pending-grace=${SWB_MASTER_PENDING_GRACE} \
|
||||
--workspace-rpc=${SWB_MASTER_WORKSPACE_RPC} \
|
||||
--workspace-head-base-url=${SWB_MASTER_WORKSPACE_HEAD_BASE_URL} \
|
||||
--workspace-max-clock-skew=${SWB_MASTER_WORKSPACE_MAX_CLOCK_SKEW} \
|
||||
$SWB_MASTER_EXTRA_ARGS
|
||||
# blockmaster stops on SIGTERM.
|
||||
KillSignal=SIGTERM
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
PrivateDevices=true
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectControlGroups=true
|
||||
RestrictSUIDSGID=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,85 @@
|
||||
# Root variant of sw-blockvolume.service for ublk (/dev/ublkbN). ublk needs
|
||||
# root, so this unit runs as root with its own state directory
|
||||
# (/var/lib/sw-block-volume-ublk); it cannot chown blockmaster's or the
|
||||
# unprivileged volume's state. Settings: /etc/sw-block/blockvolume.env, then
|
||||
# /etc/sw-block/blockvolume-ublk.env (overrides).
|
||||
#
|
||||
# Not a data migration: this unit does not move or reopen a volume created by
|
||||
# sw-blockvolume.service; it starts a new, empty volume in its own directory.
|
||||
#
|
||||
# Load the module at boot: echo ublk_drv | sudo tee /etc/modules-load.d/ublk.conf
|
||||
[Unit]
|
||||
Description=Seaweed Block volume over ublk (one replica, root)
|
||||
Documentation=https://github.com/seaweedfs/seaweed-block
|
||||
After=network-online.target sw-blockmaster.service
|
||||
Wants=network-online.target sw-blockmaster.service
|
||||
Conflicts=sw-blockvolume.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/sw-block/blockvolume.env
|
||||
EnvironmentFile=/etc/sw-block/blockvolume-ublk.env
|
||||
# Root-owned state, separate from every other unit's.
|
||||
StateDirectory=sw-block-volume-ublk
|
||||
StateDirectoryMode=0700
|
||||
ExecStart=/usr/local/bin/blockvolume \
|
||||
--master=${SWB_MASTER_ADDR} \
|
||||
--server-id=${SWB_SERVER_ID} \
|
||||
--volume-id=${SWB_VOLUME_ID} \
|
||||
--replica-id=${SWB_REPLICA_ID} \
|
||||
--data-addr=${SWB_DATA_ADDR} \
|
||||
--ctrl-addr=${SWB_CTRL_ADDR} \
|
||||
--status-addr=${SWB_STATUS_ADDR} \
|
||||
--heartbeat-interval=${SWB_HEARTBEAT_INTERVAL} \
|
||||
--recover-timeout=${SWB_RECOVER_TIMEOUT} \
|
||||
--durable-root=${SWB_DURABLE_ROOT} \
|
||||
--durable-impl=${SWB_DURABLE_IMPL} \
|
||||
--durable-blocks=${SWB_DURABLE_BLOCKS} \
|
||||
--durable-blocksize=${SWB_DURABLE_BLOCKSIZE} \
|
||||
--nvme-listen=${SWB_NVME_LISTEN} \
|
||||
--nvme-subsysnqn=${SWB_NVME_SUBSYSNQN} \
|
||||
--nvme-ns=${SWB_NVME_NS} \
|
||||
--nvme-max-h2c-data-length=${SWB_NVME_MAX_H2C_DATA_LENGTH} \
|
||||
--ublk-device=${SWB_UBLK_DEVICE} \
|
||||
--ublk-queues=${SWB_UBLK_QUEUES} \
|
||||
--ublk-queue-depth=${SWB_UBLK_QUEUE_DEPTH} \
|
||||
--iscsi-listen=${SWB_ISCSI_LISTEN} \
|
||||
--iscsi-iqn=${SWB_ISCSI_IQN} \
|
||||
--iscsi-portal-addr=${SWB_ISCSI_PORTAL_ADDR} \
|
||||
--iscsi-lun=${SWB_ISCSI_LUN} \
|
||||
--iscsi-dataout-timeout=${SWB_ISCSI_DATAOUT_TIMEOUT} \
|
||||
--replication-ack=${SWB_REPLICATION_ACK} \
|
||||
--wal-retention-lsns=${SWB_WAL_RETENTION_LSNS} \
|
||||
--recovery-mode=${SWB_RECOVERY_MODE} \
|
||||
--degraded-probe-interval=${SWB_DEGRADED_PROBE_INTERVAL} \
|
||||
--degraded-probe-cooldown-base=${SWB_DEGRADED_PROBE_COOLDOWN_BASE} \
|
||||
--degraded-probe-cooldown-cap=${SWB_DEGRADED_PROBE_COOLDOWN_CAP} \
|
||||
--chunk-filer=${SWB_CHUNK_FILER} \
|
||||
--chunk-path=${SWB_CHUNK_PATH} \
|
||||
--chunk-collection=${SWB_CHUNK_COLLECTION} \
|
||||
--chunk-replication=${SWB_CHUNK_REPLICATION} \
|
||||
--chunk-capture-interval=${SWB_CHUNK_CAPTURE_INTERVAL} \
|
||||
--chunk-upload-concurrency=${SWB_CHUNK_UPLOAD_CONCURRENCY} \
|
||||
--chunk-dirty-threshold=${SWB_CHUNK_DIRTY_THRESHOLD} \
|
||||
--chunk-control-endpoint=${SWB_CHUNK_CONTROL_ENDPOINT} \
|
||||
--workspace-lease=${SWB_WORKSPACE_LEASE} \
|
||||
$SWB_VOLUME_EXTRA_ARGS
|
||||
# blockvolume drains and closes on SIGTERM (a workspace lease closeout waits
|
||||
# up to 3s).
|
||||
KillSignal=SIGTERM
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
# PrivateDevices= is off: the server needs /dev/ublk-control and /dev/ublkcN.
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectControlGroups=true
|
||||
RestrictSUIDSGID=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,84 @@
|
||||
# Example unit for one blockvolume (one volume replica) serving NVMe/TCP or
|
||||
# iSCSI as the unprivileged sw-block user. Settings:
|
||||
# /etc/sw-block/blockvolume.env (deploy/config/blockvolume.env). For more
|
||||
# volumes on one host, copy this unit with its own env file, state directory,
|
||||
# ports and NQN.
|
||||
#
|
||||
# For ublk (needs root) do not edit this unit: use
|
||||
# sw-blockvolume-ublk.service, which has its own state directory.
|
||||
[Unit]
|
||||
Description=Seaweed Block volume (one replica)
|
||||
Documentation=https://github.com/seaweedfs/seaweed-block
|
||||
After=network-online.target sw-blockmaster.service
|
||||
Wants=network-online.target sw-blockmaster.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=sw-block
|
||||
Group=sw-block
|
||||
EnvironmentFile=/etc/sw-block/blockvolume.env
|
||||
# systemd creates /var/lib/sw-block-volume owned by User/Group; SWB_DURABLE_ROOT
|
||||
# must be inside it. It is separate from blockmaster's state directory.
|
||||
StateDirectory=sw-block-volume
|
||||
StateDirectoryMode=0750
|
||||
ExecStart=/usr/local/bin/blockvolume \
|
||||
--master=${SWB_MASTER_ADDR} \
|
||||
--server-id=${SWB_SERVER_ID} \
|
||||
--volume-id=${SWB_VOLUME_ID} \
|
||||
--replica-id=${SWB_REPLICA_ID} \
|
||||
--data-addr=${SWB_DATA_ADDR} \
|
||||
--ctrl-addr=${SWB_CTRL_ADDR} \
|
||||
--status-addr=${SWB_STATUS_ADDR} \
|
||||
--heartbeat-interval=${SWB_HEARTBEAT_INTERVAL} \
|
||||
--recover-timeout=${SWB_RECOVER_TIMEOUT} \
|
||||
--durable-root=${SWB_DURABLE_ROOT} \
|
||||
--durable-impl=${SWB_DURABLE_IMPL} \
|
||||
--durable-blocks=${SWB_DURABLE_BLOCKS} \
|
||||
--durable-blocksize=${SWB_DURABLE_BLOCKSIZE} \
|
||||
--nvme-listen=${SWB_NVME_LISTEN} \
|
||||
--nvme-subsysnqn=${SWB_NVME_SUBSYSNQN} \
|
||||
--nvme-ns=${SWB_NVME_NS} \
|
||||
--nvme-max-h2c-data-length=${SWB_NVME_MAX_H2C_DATA_LENGTH} \
|
||||
--ublk-device=${SWB_UBLK_DEVICE} \
|
||||
--ublk-queues=${SWB_UBLK_QUEUES} \
|
||||
--ublk-queue-depth=${SWB_UBLK_QUEUE_DEPTH} \
|
||||
--iscsi-listen=${SWB_ISCSI_LISTEN} \
|
||||
--iscsi-iqn=${SWB_ISCSI_IQN} \
|
||||
--iscsi-portal-addr=${SWB_ISCSI_PORTAL_ADDR} \
|
||||
--iscsi-lun=${SWB_ISCSI_LUN} \
|
||||
--iscsi-dataout-timeout=${SWB_ISCSI_DATAOUT_TIMEOUT} \
|
||||
--replication-ack=${SWB_REPLICATION_ACK} \
|
||||
--wal-retention-lsns=${SWB_WAL_RETENTION_LSNS} \
|
||||
--recovery-mode=${SWB_RECOVERY_MODE} \
|
||||
--degraded-probe-interval=${SWB_DEGRADED_PROBE_INTERVAL} \
|
||||
--degraded-probe-cooldown-base=${SWB_DEGRADED_PROBE_COOLDOWN_BASE} \
|
||||
--degraded-probe-cooldown-cap=${SWB_DEGRADED_PROBE_COOLDOWN_CAP} \
|
||||
--chunk-filer=${SWB_CHUNK_FILER} \
|
||||
--chunk-path=${SWB_CHUNK_PATH} \
|
||||
--chunk-collection=${SWB_CHUNK_COLLECTION} \
|
||||
--chunk-replication=${SWB_CHUNK_REPLICATION} \
|
||||
--chunk-capture-interval=${SWB_CHUNK_CAPTURE_INTERVAL} \
|
||||
--chunk-upload-concurrency=${SWB_CHUNK_UPLOAD_CONCURRENCY} \
|
||||
--chunk-dirty-threshold=${SWB_CHUNK_DIRTY_THRESHOLD} \
|
||||
--chunk-control-endpoint=${SWB_CHUNK_CONTROL_ENDPOINT} \
|
||||
--workspace-lease=${SWB_WORKSPACE_LEASE} \
|
||||
$SWB_VOLUME_EXTRA_ARGS
|
||||
# blockvolume drains and closes on SIGTERM (a workspace lease closeout waits
|
||||
# up to 3s).
|
||||
KillSignal=SIGTERM
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
PrivateDevices=true
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectControlGroups=true
|
||||
RestrictSUIDSGID=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,98 +1,105 @@
|
||||
<svg width="1120" height="420" viewBox="0 0 1120 420" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="title desc">
|
||||
<title id="title">seaweed-block alpha architecture</title>
|
||||
<desc id="desc">A Kubernetes CSI block storage flow from PVC to blockmaster, blockvolume, iSCSI, WAL, and recovery.</desc>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="500" viewBox="0 0 1200 500" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif" role="img" aria-labelledby="title desc">
|
||||
<title id="title">Seaweed Block: one block service core, two uses</title>
|
||||
<desc id="desc">A shared core (blockvolume with ublk, NVMe/TCP and iSCSI frontends, one Read/Write/Sync backend contract and the walstore WAL engine, plus blockmaster as the epoch authority) serves two uses: agent microVM disks that cut changed chunks to SeaweedFS for snapshots, forks and host moves, and Kubernetes PVCs through CSI, RF=1 by default with optional RF=2 or RF=3 replication.</desc>
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="0" y1="0" x2="1120" y2="420" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#07151A"/>
|
||||
<stop offset="0.5" stop-color="#0B2024"/>
|
||||
<stop offset="1" stop-color="#12301F"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="panel" x1="90" y1="80" x2="1030" y2="340" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#14333A" stop-opacity="0.9"/>
|
||||
<stop offset="1" stop-color="#163A25" stop-opacity="0.84"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="accent" x1="150" y1="0" x2="980" y2="0" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#7DD3C7"/>
|
||||
<stop offset="0.52" stop-color="#A3E635"/>
|
||||
<stop offset="1" stop-color="#F7C948"/>
|
||||
</linearGradient>
|
||||
<filter id="glow" x="-40%" y="-40%" width="180%" height="180%">
|
||||
<feGaussianBlur stdDeviation="7" result="blur"/>
|
||||
<feColorMatrix in="blur" type="matrix" values="0 0 0 0 0.49 0 0 0 0 0.83 0 0 0 0 0.78 0 0 0 0.75 0"/>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<style>
|
||||
.title { font: 700 44px ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; fill: #F5FFE8; letter-spacing: -0.03em; }
|
||||
.subtitle { font: 500 17px ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; fill: #BFD7C9; }
|
||||
.label { font: 700 15px ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; fill: #ECFFE4; }
|
||||
.small { font: 500 12px ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; fill: #A8C9BC; }
|
||||
.chip { font: 700 12px ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; fill: #092016; }
|
||||
</style>
|
||||
<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="arrowA" 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="#b45309"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<rect width="1120" height="420" rx="32" fill="url(#bg)"/>
|
||||
<path d="M0 320C170 250 250 390 420 315C585 242 650 270 820 214C970 165 1045 195 1120 150V420H0V320Z" fill="#153F2B" opacity="0.55"/>
|
||||
<path d="M0 72C178 112 254 38 421 82C622 135 714 57 900 90C1013 110 1070 86 1120 70" stroke="#7DD3C7" stroke-opacity="0.15" stroke-width="2"/>
|
||||
<path d="M40 365C220 304 320 357 466 300C634 234 716 260 872 210C978 176 1045 182 1100 157" stroke="#A3E635" stroke-opacity="0.18" stroke-width="2"/>
|
||||
<rect width="1200" height="500" rx="18" fill="#f8fafc"/>
|
||||
|
||||
<rect x="70" y="58" width="980" height="304" rx="28" fill="url(#panel)" stroke="#B7F7B1" stroke-opacity="0.2"/>
|
||||
<rect x="95" y="83" width="930" height="254" rx="20" fill="#071E22" fill-opacity="0.34" stroke="#E8FFB7" stroke-opacity="0.08"/>
|
||||
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">Seaweed Block</text>
|
||||
<text x="40" y="80" font-size="15" fill="#475569">One block service core · two uses: agent workspace disks and Kubernetes block volumes</text>
|
||||
|
||||
<text x="116" y="137" class="title">seaweed-block</text>
|
||||
<text x="118" y="168" class="subtitle">Alpha block storage for Kubernetes: CSI + iSCSI today, recovery-first design underneath.</text>
|
||||
<!-- Use 1: agent workspace disks -->
|
||||
<text x="40" y="124" font-size="11.5" font-weight="700" fill="#4338ca" letter-spacing="0.06em">AGENT WORKSPACE DISKS</text>
|
||||
<text x="212" y="124" font-size="11.5" fill="#64748b">· proof of concept</text>
|
||||
<rect x="40" y="134" width="260" height="110" rx="12" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
|
||||
<text x="170" y="168" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">agent microVM</text>
|
||||
<text x="170" y="190" font-size="12" fill="#4338ca" text-anchor="middle">/dev/vda · ext4</text>
|
||||
<text x="170" y="212" font-size="11.5" fill="#4338ca" text-anchor="middle">one local-speed disk per sandbox</text>
|
||||
|
||||
<g transform="translate(118 197)">
|
||||
<rect width="74" height="26" rx="13" fill="#C9F55B"/>
|
||||
<text x="17" y="18" class="chip">ALPHA</text>
|
||||
<rect x="86" width="124" height="26" rx="13" fill="#7DD3C7"/>
|
||||
<text x="104" y="18" class="chip">Kubernetes CSI</text>
|
||||
<rect x="222" width="72" height="26" rx="13" fill="#F7C948"/>
|
||||
<text x="239" y="18" class="chip">iSCSI</text>
|
||||
<rect x="306" width="112" height="26" rx="13" fill="#B7F7B1"/>
|
||||
<text x="326" y="18" class="chip">WAL backed</text>
|
||||
<!-- Use 2: Kubernetes block volumes -->
|
||||
<text x="40" y="312" font-size="11.5" font-weight="700" fill="#b45309" letter-spacing="0.06em">KUBERNETES BLOCK VOLUMES</text>
|
||||
<text x="238" y="312" font-size="11.5" fill="#64748b">· alpha</text>
|
||||
<rect x="40" y="322" width="260" height="108" rx="12" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="170" y="356" font-size="14" font-weight="600" fill="#78350f" text-anchor="middle">app pod + PVC</text>
|
||||
<text x="170" y="378" font-size="12" fill="#92400e" text-anchor="middle">blockcsi: provision, attach, mount</text>
|
||||
<text x="170" y="400" font-size="11.5" fill="#92400e" text-anchor="middle">Helm chart · read-only status</text>
|
||||
|
||||
<!-- Shared core -->
|
||||
<rect x="380" y="110" width="440" height="320" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
|
||||
<text x="400" y="136" font-size="15" font-weight="700" fill="#0f172a">Shared core</text>
|
||||
|
||||
<rect x="400" y="150" width="400" height="184" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5"/>
|
||||
<text x="420" y="176" font-size="14" font-weight="700" fill="#0f172a">blockvolume</text>
|
||||
<text x="780" y="176" font-size="11.5" fill="#64748b" text-anchor="end">one process per volume replica</text>
|
||||
|
||||
<rect x="420" y="190" width="110" height="28" rx="6" fill="#e2e8f0" stroke="#94a3b8"/>
|
||||
<text x="475" y="209" font-size="12.5" font-weight="600" fill="#334155" text-anchor="middle">ublk</text>
|
||||
<rect x="545" y="190" width="110" height="28" rx="6" fill="#e2e8f0" stroke="#94a3b8"/>
|
||||
<text x="600" y="209" font-size="12.5" font-weight="600" fill="#334155" text-anchor="middle">NVMe/TCP</text>
|
||||
<rect x="670" y="190" width="110" height="28" rx="6" fill="#e2e8f0" stroke="#94a3b8"/>
|
||||
<text x="725" y="209" font-size="12.5" font-weight="600" fill="#334155" text-anchor="middle">iSCSI</text>
|
||||
|
||||
<text x="600" y="242" font-size="12.5" fill="#334155" text-anchor="middle">one Backend contract: Read · Write · Sync</text>
|
||||
|
||||
<rect x="420" y="254" width="360" height="64" rx="8" fill="#ffffff" stroke="#94a3b8"/>
|
||||
<text x="600" y="280" font-size="13" font-weight="600" fill="#0f172a" text-anchor="middle">local WAL engine: walstore</text>
|
||||
<text x="600" y="300" font-size="11.5" fill="#475569" text-anchor="middle">WAL + extent · group fsync · typed recovery reasons</text>
|
||||
|
||||
<line x1="600" y1="350" x2="600" y2="337" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<rect x="400" y="350" width="400" height="66" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5" stroke-dasharray="5 4"/>
|
||||
<text x="600" y="377" font-size="13.5" font-weight="700" fill="#0f172a" text-anchor="middle">blockmaster · epoch authority</text>
|
||||
<text x="600" y="399" font-size="11.5" fill="#475569" text-anchor="middle">assignments · epochs · leases · epoch fencing</text>
|
||||
|
||||
<!-- Into the core -->
|
||||
<line x1="302" y1="190" x2="396" y2="204" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<text x="349" y="182" font-size="11" fill="#64748b" text-anchor="middle">virtio-blk</text>
|
||||
<line x1="302" y1="376" x2="396" y2="232" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
|
||||
<text x="340" y="290" font-size="11" fill="#64748b" text-anchor="end">iSCSI or</text>
|
||||
<text x="340" y="304" font-size="11" fill="#64748b" text-anchor="end">NVMe/TCP</text>
|
||||
|
||||
<!-- Durability for use 1: SeaweedFS -->
|
||||
<rect x="900" y="134" width="260" height="172" rx="14" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
|
||||
<text x="920" y="160" font-size="15" font-weight="700" fill="#065f46">SeaweedFS</text>
|
||||
<rect x="920" y="172" width="220" height="46" rx="8" fill="#ffffff" stroke="#34d399"/>
|
||||
<text x="1030" y="191" font-size="12.5" font-weight="600" fill="#065f46" text-anchor="middle">HEAD root (~2 KB)</text>
|
||||
<text x="1030" y="208" font-size="11" fill="#047857" text-anchor="middle">conditional update on {gen, epoch}</text>
|
||||
<g>
|
||||
<rect x="924" y="228" width="30" height="18" rx="3" fill="#a7f3d0"/>
|
||||
<rect x="960" y="228" width="30" height="18" rx="3" fill="#a7f3d0"/>
|
||||
<rect x="996" y="228" width="30" height="18" rx="3" fill="#6ee7b7"/>
|
||||
<rect x="1032" y="228" width="30" height="18" rx="3" fill="#a7f3d0"/>
|
||||
<rect x="1068" y="228" width="30" height="18" rx="3" fill="#6ee7b7"/>
|
||||
<rect x="1104" y="228" width="30" height="18" rx="3" fill="#a7f3d0"/>
|
||||
</g>
|
||||
<text x="1030" y="264" font-size="11.5" fill="#047857" text-anchor="middle">immutable 4 MiB chunks, shared</text>
|
||||
<text x="1030" y="281" font-size="11.5" fill="#047857" text-anchor="middle">snapshot / fork = copy the root</text>
|
||||
<text x="1030" y="298" font-size="11.5" fill="#047857" text-anchor="middle">resume on another host at epoch + 1</text>
|
||||
|
||||
<g transform="translate(116 253)" filter="url(#glow)">
|
||||
<path d="M83 37H789" stroke="url(#accent)" stroke-width="4" stroke-linecap="round"/>
|
||||
<path d="M244 37L260 25L260 49L244 37Z" fill="#A3E635"/>
|
||||
<path d="M408 37L424 25L424 49L408 37Z" fill="#A3E635"/>
|
||||
<path d="M574 37L590 25L590 49L574 37Z" fill="#A3E635"/>
|
||||
<path d="M735 37L751 25L751 49L735 37Z" fill="#A3E635"/>
|
||||
</g>
|
||||
<line x1="802" y1="286" x2="896" y2="220" stroke="#0f766e" stroke-width="2" marker-end="url(#arrowG)"/>
|
||||
<text x="852" y="232" font-size="12" font-weight="600" fill="#0f766e" text-anchor="middle">cut</text>
|
||||
<text x="852" y="276" font-size="10.5" fill="#0f766e" text-anchor="start">changed</text>
|
||||
<text x="852" y="289" font-size="10.5" fill="#0f766e" text-anchor="start">chunks</text>
|
||||
|
||||
<g transform="translate(116 241)">
|
||||
<rect width="142" height="72" rx="16" fill="#0B2A30" stroke="#7DD3C7" stroke-opacity="0.55"/>
|
||||
<text x="22" y="31" class="label">PVC / Pod</text>
|
||||
<text x="22" y="52" class="small">Kubernetes app</text>
|
||||
<!-- Durability for use 2: replicas -->
|
||||
<rect x="900" y="326" width="260" height="104" rx="14" fill="#fffbeb" stroke="#f59e0b" stroke-width="1.5"/>
|
||||
<text x="920" y="352" font-size="14" font-weight="700" fill="#78350f">Optional replicas (RF=2 / 3)</text>
|
||||
<text x="920" y="374" font-size="11.5" fill="#92400e">ship by LSN · durable barrier</text>
|
||||
<text x="920" y="394" font-size="11.5" fill="#92400e">best_effort · sync_quorum · sync_all</text>
|
||||
<text x="920" y="414" font-size="11.5" fill="#92400e">catch-up or rebuild · epoch-fenced</text>
|
||||
|
||||
<rect x="166" width="142" height="72" rx="16" fill="#0B2A30" stroke="#7DD3C7" stroke-opacity="0.55"/>
|
||||
<text x="198" y="31" class="label">blockcsi</text>
|
||||
<text x="190" y="52" class="small">attach + mount</text>
|
||||
<line x1="802" y1="300" x2="896" y2="370" stroke="#b45309" stroke-width="2" marker-end="url(#arrowA)"/>
|
||||
<text x="840" y="352" font-size="12" font-weight="600" fill="#b45309" text-anchor="middle">replicate</text>
|
||||
|
||||
<rect x="332" width="142" height="72" rx="16" fill="#102B25" stroke="#A3E635" stroke-opacity="0.6"/>
|
||||
<text x="360" y="31" class="label">blockmaster</text>
|
||||
<text x="354" y="52" class="small">intent + authority</text>
|
||||
|
||||
<rect x="498" width="142" height="72" rx="16" fill="#102B25" stroke="#A3E635" stroke-opacity="0.6"/>
|
||||
<text x="526" y="31" class="label">blockvolume</text>
|
||||
<text x="526" y="52" class="small">replica daemon</text>
|
||||
|
||||
<rect x="664" width="142" height="72" rx="16" fill="#192C1F" stroke="#F7C948" stroke-opacity="0.58"/>
|
||||
<text x="709" y="31" class="label">iSCSI</text>
|
||||
<text x="692" y="52" class="small">Linux frontend</text>
|
||||
|
||||
<rect x="830" width="142" height="72" rx="16" fill="#192C1F" stroke="#F7C948" stroke-opacity="0.58"/>
|
||||
<text x="867" y="31" class="label">WAL</text>
|
||||
<text x="858" y="52" class="small">write + recover</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(748 103)">
|
||||
<rect width="226" height="88" rx="18" fill="#071E22" fill-opacity="0.72" stroke="#7DD3C7" stroke-opacity="0.24"/>
|
||||
<text x="22" y="32" class="label">Design rules</text>
|
||||
<text x="22" y="54" class="small">observation != authority</text>
|
||||
<text x="22" y="73" class="small">one peer, one WAL feeder</text>
|
||||
</g>
|
||||
<!-- Caption -->
|
||||
<text x="40" y="472" font-size="12.5" fill="#64748b">Workspace disks run one local replica; durability comes from cuts to SeaweedFS. Kubernetes volumes default to RF=1; synchronous RF=2 or RF=3 is opt-in (supported lab).</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 8.2 KiB |
@@ -6,7 +6,7 @@ This is the design reference for Seaweed Block. It describes how the code works,
|
||||
- **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.
|
||||
|
||||
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 not in this repository; Go regression tests are the in-repo evidence for every counterexample found that way.
|
||||
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.
|
||||
|
||||
## Contents
|
||||
|
||||
@@ -134,7 +134,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 recovery inputs, 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 3.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.
|
||||
@@ -149,7 +149,7 @@ stateDiagram-v2
|
||||
|
||||
## 1.3 smartwal: in-place writes plus a metadata ring
|
||||
|
||||
**Status: experimental.** It shows that `LogicalStorage` admits more than one implementation. It is not a default: `blockvolume --durable-impl` defaults to auto, which creates new volumes as walstore and opens an existing volume with its on-disk format, so smartwal is used only when chosen explicitly or found on disk. Open issues:
|
||||
**Status: experimental.** It shows that `LogicalStorage` admits more than one implementation. It is not a default: `blockvolume --durable-impl` defaults to auto, which creates new volumes as walstore and opens an existing volume with its on-disk format, so smartwal is used only when chosen explicitly or found on disk. Auto refuses a root that carries chunk metadata (a `walstore-chunk` volume) instead of opening it as plain walstore; such a volume needs `--durable-impl=walstore-chunk` with its remote configuration (`core/frontend/durable/provider.go` `openOrCreate`). Open issues:
|
||||
|
||||
- in-place overwrites have no rollback on a torn write (see the crash window in Open items);
|
||||
- a block loses its per-block CRC once its ring record recycles;
|
||||
@@ -447,7 +447,7 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
|
||||
- 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 (`README.md`, "Workspace lifecycle on two hosts").
|
||||
- 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
|
||||
|
||||
@@ -492,15 +492,15 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
| 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) |
|
||||
| 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, GC timing and hibernate/migrate ordering; 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) |
|
||||
| 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
|
||||
|
||||
- **No test CI yet.** The repository workflow publishes images only; tests run on development and Linux test hosts.
|
||||
- **No fuzzing**, including the NVMe/TCP and iSCSI wire parsers and the recovery decoders.
|
||||
- **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.
|
||||
- **No power-loss simulation.** Every crash test keeps the page cache (SIGKILL or closing the file). Record-and-replay of block writes (in the style of dm-log-writes) is the planned next step.
|
||||
- **No direct test of the filer's conditional update under concurrency.** The real-filer test's stale-holder CAS is refused by the client-side pre-read before the filer's condition is exercised.
|
||||
- **The filer's conditional update is tested against one pinned filer only.** #163 added `TestIntegration_ConcurrentHEADCASRealFiler` (`core/frontend/chunkstore/concurrent_cas_integration_test.go`, build tag `chunkstore_integration`): concurrent HEAD updates are held until every client pre-read is done, then sent to a real filer, so the server's `expected_extended` check decides. It requires a `weed` binary whose SHA-256 matches the pinned build. Several filers sharing a store, and a capability probe for filers that predate the field, are not covered.
|
||||
- **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.
|
||||
|
||||
@@ -522,11 +522,11 @@ The attempt path is never removed, so a late create can never land after a delet
|
||||
|
||||
These are tracked for fixes. Most were raised by an independent review of this repository.
|
||||
|
||||
- **Moving a workspace back to a host with a surviving local file.** Only a fresh volume (with the fresh marker) claims HEAD before serving (`core/frontend/durable/provider.go`, `provider_chunk.go`). An existing local file attaches without claiming, and if its local LSN is not below HEAD's `RemoteLSN`, it can serve and later publish a stale image. **Planned fix:** a non-fresh attach must claim HEAD, or be refused, when HEAD's holder is not this holder.
|
||||
- **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.** Some comments carry internal review attributions and timestamps. **Planned:** replace them with neutral design rationale.
|
||||
- **No direct test of the filer's conditional update.** Reading the open-source SeaweedFS filer: `UpdateEntry` takes an exclusive lock on the path before it validates `expected_extended`. No test in this repository exercises that path under concurrency or across several filers sharing a store, and there is no capability probe for a filer that predates the field. **Planned:** a concurrent test that bypasses the client-side pre-read, and a probe.
|
||||
- **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.
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
# Kubernetes block volumes: status and claims
|
||||
|
||||
**Use this when:** you need the exact status of a Kubernetes feature, what the
|
||||
gated alpha path lets you do today, what it does not claim, or which image tag
|
||||
matches which release line.
|
||||
|
||||
**Source of truth:** the [release notes](releases/README.md) hold the run
|
||||
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
|
||||
install on Kubernetes
|
||||
-> create a PVC-backed block volume
|
||||
-> mount it in an app pod
|
||||
-> write/read data
|
||||
-> inspect status and support evidence
|
||||
-> clean up
|
||||
```
|
||||
|
||||
This is an **alpha** product path for supported lab clusters, not production.
|
||||
|
||||
## Feature and status
|
||||
|
||||
| Feature | Status | Feature | Status |
|
||||
|---|---|---|---|
|
||||
| Kubernetes PVC provisioning | Available | Helm install path | Available |
|
||||
| First PVC writer/reader verification | Available | Read-only report/dashboard | Available |
|
||||
| Support-bundle replay | Available | Negative-first status reasons | Available |
|
||||
| Multi-volume RF=3 lab path | Gated | CSI reattach recovery | Gated |
|
||||
| iSCSI ALUA/dm-multipath mounted failover | Gated | Restart persistence with hostPath | Gated |
|
||||
| Actionable read-only CRD status + Events | Available | Bounded SwBlockVolume finalizer lifecycle | Beta candidate |
|
||||
| Returned-replica ACK eligibility executor | Beta candidate | Returned-replica failback runtime | Source-gated |
|
||||
| Returned-replica rebuild traffic | Planned | Frontend publication after failback | Planned |
|
||||
| NVMe/TCP CSI multipath + backend write batching | Source-gated | NVMe/RDMA Kubernetes CSI publish/attach | Source-gated |
|
||||
| WAL multi-block record opt-in | Source-gated | WAL format default change | Not claimed |
|
||||
| Backup/snapshot/restore | Planned | NVMe/RDMA failover or performance SLO | Not claimed |
|
||||
| Production SLO/performance claims | Not claimed | Hosted production UI | Not claimed |
|
||||
|
||||
## What you can do today
|
||||
|
||||
- Install Seaweed Block through Helm on a supported Kubernetes/k3s lab.
|
||||
- Create and mount PVC-backed block volumes through normal Kubernetes PVCs.
|
||||
- Verify writer/reader persistence with ordinary app pods.
|
||||
- Run multiple RF=3 volumes in the gated lab path.
|
||||
- Validate gated recovery paths:
|
||||
- CSI reattach with pod recreate,
|
||||
- iSCSI ALUA + dm-multipath transparent mounted failover on the proven
|
||||
Stage-2 path,
|
||||
- interleaved multi-volume failover isolation.
|
||||
- Inspect cluster, volume, replica, primary, frontend, timeline, and reason
|
||||
evidence through read-only CLI/report/dashboard surfaces.
|
||||
- Publish the same read-only status into Kubernetes-native `SwBlockCluster` /
|
||||
`SwBlockVolume` `.status` and Events on the gated operator-status path.
|
||||
- Inspect node readiness, support evidence refs, cleanup-required status, and
|
||||
safe read-only/scripted next-step hints through that same status model.
|
||||
- Use the beta-candidate lifecycle-owner path to protect `SwBlockVolume` CRs
|
||||
with a Seaweed Block finalizer and release it only after clean externally
|
||||
supplied cleanup evidence.
|
||||
- Inspect install drift status for current versus desired chart/app/image
|
||||
identity. This is visibility only, not upgrade execution.
|
||||
- In the gated returned-replica path, inspect a bounded authority-executor
|
||||
result that records ACK eligibility on `SwBlockReplicaEligibility.status`
|
||||
after live evidence proves the old primary remains fenced, the current primary
|
||||
is unchanged, and the required durable frontier is covered.
|
||||
- From source, run the opt-in returned-replica failback runtime gates. This path
|
||||
can move authority through blockmaster only when a `SwBlockReplicaFailback`
|
||||
target, explicit execution policy, expected-current evidence, and terminal
|
||||
evidence are all present. It is not enabled by default and is not yet a
|
||||
published release claim.
|
||||
- From source, run the supported-lab NVMe/TCP gates: ANA/direct-host baseline,
|
||||
CSI protocol selection, Kubernetes CSI multipath attach for one NQN/NSID with
|
||||
multiple NVMe frontend paths, one-path-loss status honesty, mounted pod
|
||||
write/read after one observed path loss, mounted pod write/read after the
|
||||
removed path is restored, multi-volume mounted path isolation, bounded
|
||||
multi-volume path churn, repeated stage/unstage residue checks, a bounded
|
||||
writer/reader soak, a baseline over the configured 100GbE TCP frontend
|
||||
address, a source-gated CSI-node reconnect owner contract, and a live
|
||||
host-path reconnect gate for scoped `nvme disconnect -d` path loss, plus a
|
||||
live desired path-set replacement gate where CSI-node connects the new
|
||||
desired NVMe path and prunes the stale old host path without remounting the
|
||||
pod, and a durable backend full-block write-batching gate with
|
||||
product-owned `/status/durable` counters. The source-gated WAL multi-block
|
||||
record opt-in has mounted profile and restart/recovery compatibility evidence,
|
||||
plus mounted durable-status `HeadLSN` confirmation, but remains default-off
|
||||
and requires a future matching-image release smoke before it becomes a public
|
||||
image claim. The opt-in NVMe/RDMA path now carries an explicit transport from
|
||||
StorageClass through blockmaster publication and CSI NodeStage, mounts a
|
||||
dynamic PVC on a second RoCE host, and verifies writer/reader data through a
|
||||
standard Linux `nvme connect -t rdma` controller. It remains source-gated.
|
||||
These are supported-lab source-gated claims, not broad NVMe compatibility,
|
||||
production HA, or performance/SLO claims.
|
||||
- Replay support bundles offline.
|
||||
|
||||
These are narrow alpha claims tied to documented gates. See
|
||||
[release notes](releases/README.md) for exact run evidence.
|
||||
|
||||
## What you should not expect yet
|
||||
|
||||
- Production readiness or production SLOs.
|
||||
- A production-grade operator or broad mutating admin workflow. The current
|
||||
lifecycle-owner owns only the Seaweed Block `SwBlockVolume` protection
|
||||
finalizer.
|
||||
- Automatic cleanup execution, host repair, or PVC/PV/workload deletion.
|
||||
Delete-safety uses externally supplied cleanup evidence.
|
||||
- Backup, snapshot, or restore.
|
||||
- Returned-replica rebuild traffic, frontend publication after failback, or
|
||||
automatic deployed failback. The failback runtime path is explicit, opt-in,
|
||||
and source-gated until a release smoke validates it on published images.
|
||||
- Transparent Kubernetes node-loss failover without pod recreate.
|
||||
- Broad NVMe/RoCE compatibility, performance/SLO, or transparent failover
|
||||
parity beyond the documented supported-lab gates. The CSI-node reconnect
|
||||
owner, host-path reconnect gate, desired path-set replacement gate, and
|
||||
stale path pruning gate exist only as source-gated NVMe/TCP evidence. The
|
||||
NVMe/RDMA path has standalone and Kubernetes single-path publish/attach
|
||||
evidence, but no RDMA multipath, reconnect/failover, performance, or SLO
|
||||
claim.
|
||||
- Broad distro/kernel/initiator compatibility.
|
||||
- Upgrade or rollback execution. The status layer can report install drift, but
|
||||
it does not run Helm or kubectl mutations.
|
||||
|
||||
## Release images
|
||||
|
||||
|
||||
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.
|
||||
The v0.6 returned-replica ACK eligibility executor path likewise requires
|
||||
matching images published from the Phase 54 release commit and must be validated
|
||||
with the release smoke before it is marked shipped.
|
||||
The returned-replica failback runtime added after v0.6 is source-gated and
|
||||
requires a future release smoke before it becomes a public image claim. The
|
||||
NVMe/TCP supported-lab path is also source-gated until matching `seaweed-block`
|
||||
and `seaweed-block-csi` images are published and pass the NVMe release smoke.
|
||||
|
||||
Mutable `:alpha` is a smoke/demo tag only; it can drift from the source tree.
|
||||
@@ -16,8 +16,8 @@ generate Helm values
|
||||
|
||||
The current quickstart is for supported test clusters, not production. For
|
||||
the release boundary and exact QA evidence, see
|
||||
[`docs/releases/README.md`](releases/README.md). The top-level README contains
|
||||
the current operations command matrix.
|
||||
[`docs/releases/README.md`](releases/README.md). [`user-capabilities.md`](user-capabilities.md)
|
||||
contains the current operations command matrix.
|
||||
|
||||
## What This Proves
|
||||
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
# Standalone deployment (systemd)
|
||||
|
||||
**Use this when:** you run `blockmaster` and `blockvolume` directly on a Linux
|
||||
host, outside Kubernetes, for example as a local disk for VMs or for the agent
|
||||
workspace proof of concept.
|
||||
|
||||
**Source of truth:** the flag definitions in `cmd/blockmaster/main.go`
|
||||
(`parseFlags`), `cmd/blockvolume/main.go` (`parseFlags`) and
|
||||
`cmd/blockvolume/chunk_remote.go` (`validateChunkFlags`). If this page and
|
||||
`--help` disagree, `--help` wins.
|
||||
|
||||
For a first, read-only try without services, see
|
||||
[first volume (read-only check)](#first-volume-read-only-check). For a write
|
||||
test, see [write test (scratch host only)](#write-test-scratch-host-only).
|
||||
|
||||
## Get the matching files
|
||||
|
||||
The unit and settings files must come from the same commit as your
|
||||
binaries. Always pin a full commit id (or a release tag once one exists),
|
||||
never a branch name such as `main`. Run every command on this page from the
|
||||
root of that checkout:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/seaweedfs/seaweed-block && cd seaweed-block
|
||||
git checkout <commit> # the commit your binaries come from
|
||||
```
|
||||
|
||||
`<commit>` is the commit in your image tag (`sha-<commit>`) or the one you
|
||||
built. Without git, download the same paths from
|
||||
`https://raw.githubusercontent.com/seaweedfs/seaweed-block/<full-commit-id>/`
|
||||
into a directory with the same layout (`deploy/config/`, `deploy/systemd/`)
|
||||
and run from there, with the binaries in that directory too. If your image's
|
||||
commit has no `deploy/` directory (images published before these files were
|
||||
added), do not mix revisions: build the binaries from your checkout instead
|
||||
(Install, option 2).
|
||||
|
||||
## Files
|
||||
|
||||
| File | Install as | Purpose |
|
||||
|---|---|---|
|
||||
| [`deploy/config/blockmaster.env`](../deploy/config/blockmaster.env) | `/etc/sw-block/blockmaster.env` | blockmaster settings, commented |
|
||||
| [`deploy/config/blockvolume.env`](../deploy/config/blockvolume.env) | `/etc/sw-block/blockvolume.env` | blockvolume settings, commented |
|
||||
| [`deploy/config/blockvolume-ublk.env`](../deploy/config/blockvolume-ublk.env) | `/etc/sw-block/blockvolume-ublk.env` | Overrides for the root ublk variant |
|
||||
| [`deploy/config/topology.yaml`](../deploy/config/topology.yaml) | `/etc/sw-block/topology.yaml` | One volume, one replica slot |
|
||||
| [`deploy/systemd/sw-blockmaster.service`](../deploy/systemd/sw-blockmaster.service) | `/etc/systemd/system/` | blockmaster, as `sw-block`; state in `/var/lib/sw-block-master` |
|
||||
| [`deploy/systemd/sw-blockvolume.service`](../deploy/systemd/sw-blockvolume.service) | `/etc/systemd/system/` | One blockvolume over NVMe/TCP or iSCSI, as `sw-block`; state in `/var/lib/sw-block-volume` |
|
||||
| [`deploy/systemd/sw-blockvolume-ublk.service`](../deploy/systemd/sw-blockvolume-ublk.service) | `/etc/systemd/system/` | The same volume over ublk, as root; state in `/var/lib/sw-block-volume-ublk` |
|
||||
|
||||
Each unit has its own `StateDirectory=`, so the root ublk unit can never take
|
||||
ownership of blockmaster's or the unprivileged volume's files. Run either
|
||||
`sw-blockvolume` or `sw-blockvolume-ublk`, not both (they conflict).
|
||||
|
||||
> **Not a data migration.** The two volume units use different durable roots
|
||||
> (`/var/lib/sw-block-volume/volumes` and `/var/lib/sw-block-volume-ublk/volumes`).
|
||||
> Switching from one unit to the other does not move or reopen the existing
|
||||
> volume: the other unit creates a new, empty volume. Keep using the unit
|
||||
> that created a volume. Do not point both units at one directory or chown one
|
||||
> unit's state for the other.
|
||||
|
||||
```bash
|
||||
sudo useradd --system --no-create-home --shell /usr/sbin/nologin sw-block
|
||||
sudo install -m 0755 blockmaster blockvolume sw-block /usr/local/bin/
|
||||
sudo install -d -m 0750 -g sw-block /etc/sw-block
|
||||
sudo install -m 0640 -g sw-block deploy/config/*.env deploy/config/topology.yaml /etc/sw-block/
|
||||
sudo install -m 0644 deploy/systemd/*.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now sw-blockmaster sw-blockvolume
|
||||
journalctl -u sw-blockvolume -f # wait for "nvme-listening"
|
||||
```
|
||||
|
||||
The binaries take command-line flags. The `SWB_*` variables are read only by
|
||||
the example units, which turn them into flags. blockvolume itself reads only
|
||||
`SW_BLOCK_ISCSI_CHAP_USERNAME` and `SW_BLOCK_ISCSI_CHAP_SECRET`.
|
||||
|
||||
## blockmaster settings
|
||||
|
||||
| Variable | Flag | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `SWB_MASTER_AUTHORITY_STORE` | `--authority-store` | required | Durable authority store: assignments, epochs, leases |
|
||||
| `SWB_MASTER_LISTEN` | `--listen` | `127.0.0.1:0` | gRPC address; unauthenticated, keep it on loopback or a trusted network |
|
||||
| `SWB_MASTER_TOPOLOGY` | `--topology` | empty (no assignments minted) | Accepted-topology YAML: volumes and replica slots |
|
||||
| `SWB_MASTER_EXPECTED_SLOTS` | `--expected-slots-per-volume` | `3` | Replica slots per volume; `1` for a single replica |
|
||||
| `SWB_MASTER_FRESHNESS_WINDOW` | `--freshness-window` | `30s` | How long a heartbeat stays fresh |
|
||||
| `SWB_MASTER_PENDING_GRACE` | `--pending-grace` | `1s` | Startup grace before a missing observation is unsupported |
|
||||
| `SWB_MASTER_WORKSPACE_RPC` | `--workspace-rpc` | `false` | Workspace lease, revocation and move RPCs |
|
||||
| `SWB_MASTER_WORKSPACE_HEAD_BASE_URL` | `--workspace-head-base-url` | empty | Filer HTTP directory of HEAD files; required with `--workspace-rpc` |
|
||||
| `SWB_MASTER_WORKSPACE_MAX_CLOCK_SKEW` | `--workspace-max-clock-skew` | `20s` | Clock-skew bound for workspace leases and forced moves |
|
||||
| `SWB_MASTER_EXTRA_ARGS` | any | empty | Other flags; the Kubernetes `--launcher-*` and `--lifecycle-*` flags are set by the Helm chart |
|
||||
|
||||
## blockvolume settings
|
||||
|
||||
| Variable | Flag | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `SWB_MASTER_ADDR` | `--master` | required | blockmaster gRPC address |
|
||||
| `SWB_SERVER_ID`, `SWB_VOLUME_ID`, `SWB_REPLICA_ID` | `--server-id`, `--volume-id`, `--replica-id` | required | Must match a topology slot |
|
||||
| `SWB_DATA_ADDR`, `SWB_CTRL_ADDR` | `--data-addr`, `--ctrl-addr` | required | Data-path and control-path addresses |
|
||||
| `SWB_STATUS_ADDR` | `--status-addr` | empty (off) | Status HTTP endpoint; loopback only, unauthenticated |
|
||||
| `SWB_HEARTBEAT_INTERVAL` | `--heartbeat-interval` | `2s` | Heartbeat interval |
|
||||
| `SWB_RECOVER_TIMEOUT` | `--recover-timeout` | `30s` | Time to become promotion-ready before reporting `recovery_timeout` |
|
||||
| `SWB_DURABLE_ROOT` | `--durable-root` | empty (in memory, not durable) | Storage directory; writable by the service user |
|
||||
| `SWB_DURABLE_IMPL` | `--durable-impl` | empty (auto) | Auto creates new volumes as `walstore`, opens existing ones with their on-disk format, and refuses a `walstore-chunk` root. Explicit: `walstore`, `walstore-chunk` (workspace, proof of concept), `smartwal` (experimental). The examples set `walstore`. |
|
||||
| `SWB_DURABLE_BLOCKS` | `--durable-blocks` | `2048` | Blocks on first create |
|
||||
| `SWB_DURABLE_BLOCKSIZE` | `--durable-blocksize` | `4096` | Block size on first create |
|
||||
| `SWB_NVME_LISTEN` | `--nvme-listen` | empty (off) | NVMe/TCP target; loopback only, no authentication |
|
||||
| `SWB_NVME_SUBSYSNQN` | `--nvme-subsysnqn` | empty | Subsystem NQN; required with `--nvme-listen` |
|
||||
| `SWB_NVME_NS` | `--nvme-ns` | `1` | Namespace id |
|
||||
| `SWB_NVME_MAX_H2C_DATA_LENGTH` | `--nvme-max-h2c-data-length` | `0` (target default) | MaxH2CDataLength in bytes |
|
||||
| `SWB_UBLK_DEVICE` | `--ublk-device` | `-1` (off) | Serve as `/dev/ublkbN`; needs root and `ublk_drv` |
|
||||
| `SWB_UBLK_QUEUES` | `--ublk-queues` | `0` (1 queue) | ublk hardware queues |
|
||||
| `SWB_UBLK_QUEUE_DEPTH` | `--ublk-queue-depth` | `0` (64) | In-flight requests per queue |
|
||||
| `SWB_ISCSI_LISTEN` | `--iscsi-listen` | empty (off) | iSCSI target; loopback only |
|
||||
| `SWB_ISCSI_IQN` | `--iscsi-iqn` | empty | Target IQN; required with `--iscsi-listen` |
|
||||
| `SWB_ISCSI_PORTAL_ADDR` | `--iscsi-portal-addr` | bound address | Advertised TargetAddress |
|
||||
| `SWB_ISCSI_LUN` | `--iscsi-lun` | `0` | LUN id |
|
||||
| `SWB_ISCSI_DATAOUT_TIMEOUT` | `--iscsi-dataout-timeout` | `0` (target default) | R2T/Data-Out wait bound |
|
||||
| `SW_BLOCK_ISCSI_CHAP_USERNAME`, `SW_BLOCK_ISCSI_CHAP_SECRET` | `--iscsi-chap-username`, `--iscsi-chap-secret` | empty | Target-side CHAP; requires `--iscsi-listen` |
|
||||
| `SWB_REPLICATION_ACK` | `--replication-ack` | `best-effort` | `best-effort`, `sync-quorum` or `sync-all` |
|
||||
| `SWB_WAL_RETENTION_LSNS` | `--wal-retention-lsns` | `0` | walstore: WAL kept past the checkpoint for catch-up |
|
||||
| `SWB_RECOVERY_MODE` | `--recovery-mode` | `legacy` | `legacy` or `dual-lane` rebuild |
|
||||
| `SWB_DEGRADED_PROBE_INTERVAL` | `--degraded-probe-interval` | `0` (off) | Degraded-peer probe interval |
|
||||
| `SWB_DEGRADED_PROBE_COOLDOWN_BASE` / `_CAP` | `--degraded-probe-cooldown-base` / `-cap` | `5s` / `60s` | Per-peer probe backoff |
|
||||
| `SWB_CHUNK_FILER` | `--chunk-filer` | empty | SeaweedFS filer gRPC address; required with `walstore-chunk` |
|
||||
| `SWB_CHUNK_PATH` | `--chunk-path` | `/swblock/chunks` | Filer directory, one directory per volume |
|
||||
| `SWB_CHUNK_COLLECTION`, `SWB_CHUNK_REPLICATION` | `--chunk-collection`, `--chunk-replication` | empty (filer default) | Placement of chunk needles |
|
||||
| `SWB_CHUNK_CAPTURE_INTERVAL` | `--chunk-capture-interval` | `0` (no timer) | Automatic cut interval, e.g. `15m` |
|
||||
| `SWB_CHUNK_UPLOAD_CONCURRENCY` | `--chunk-upload-concurrency` | `8` | Parallel chunk uploads (1..64) |
|
||||
| `SWB_CHUNK_DIRTY_THRESHOLD` | `--chunk-dirty-threshold` | `512` | Bound on one cut's barrier copy, in chunks |
|
||||
| `SWB_CHUNK_CONTROL_ENDPOINT` | `--chunk-control-endpoint` | `false` | `/chunk/*` routes on the status listener |
|
||||
| `SWB_WORKSPACE_LEASE` | `--workspace-lease` | `false` | Require a master lease; fail closed without one |
|
||||
| `SWB_VOLUME_EXTRA_ARGS` | any | empty | Other flags (Kubernetes gate and source-gated flags) |
|
||||
|
||||
The `--chunk-*` and `--workspace-lease` flags are refused unless
|
||||
`--durable-impl=walstore-chunk`; leave them at their defaults otherwise.
|
||||
|
||||
## Notes
|
||||
|
||||
- The control plane, the status endpoint and the NVMe/TCP target have no
|
||||
authentication. Keep them on loopback or a trusted network.
|
||||
- A volume's geometry is fixed when it is created. Changing
|
||||
`SWB_DURABLE_BLOCKS` later has no effect on an existing volume.
|
||||
- ublk needs root. Use `sw-blockvolume-ublk.service` instead of editing the
|
||||
unprivileged unit, and load `ublk_drv` at boot
|
||||
(`echo ublk_drv | sudo tee /etc/modules-load.d/ublk.conf`).
|
||||
|
||||
## First volume (read-only check)
|
||||
|
||||
Start one local volume, attach it over NVMe/TCP on loopback, and look at the
|
||||
device and its status. This walkthrough does not format or write the attached
|
||||
device; it only creates local backing files, a topology file and logs under
|
||||
`./swb`. For a write test, see
|
||||
[write test (scratch host only)](#write-test-scratch-host-only).
|
||||
|
||||
Needs Linux, bash, `nvme-cli`, `ss` (iproute2), `lsblk`, `curl`, `sudo`, and
|
||||
the binaries from [Install](../README.md#install) in the current directory.
|
||||
Paste the blocks into one bash shell. A failed check returns an error instead
|
||||
of exiting your shell.
|
||||
|
||||
```bash
|
||||
NQN=nqn.2026-05.io.seaweedfs:v1
|
||||
sudo modprobe nvme_tcp
|
||||
mkdir -p swb/master swb/vol && cd swb
|
||||
printf 'volumes:\n - volume_id: v1\n slots:\n - replica_id: r1\n server_id: s1\n' > topology.yaml
|
||||
|
||||
swb_alive() { [ -n "$1" ] && kill -0 "$1" 2>/dev/null; }
|
||||
swb_owns() { ss -ltnpH "sport = :$1" | grep -q "pid=$2,"; } # port $1 held by pid $2
|
||||
swb_stop() { # idempotent: undoes only what swb_start did; safe to run again
|
||||
[ -n "$SWB_OWN_NQN" ] && grep -qsx "$NQN" /sys/class/nvme-subsystem/nvme-subsys*/subsysnqn &&
|
||||
sudo nvme disconnect -n "$NQN" >/dev/null
|
||||
local p
|
||||
for p in $VPID $MPID; do swb_alive "$p" && kill "$p"; done
|
||||
[ -n "$VPID$MPID" ] && wait $VPID $MPID 2>/dev/null
|
||||
SWB_OWN_NQN= VPID= MPID=
|
||||
return 0
|
||||
}
|
||||
swb_start() {
|
||||
[ -z "$VPID$MPID" ] || { echo "refusing: run swb_stop first"; return 1; }
|
||||
grep -qsx "$NQN" /sys/class/nvme-subsystem/nvme-subsys*/subsysnqn &&
|
||||
{ echo "refusing: $NQN is already connected"; return 1; }
|
||||
SWB_OWN_NQN=1 # from here on, a connection with this NQN is this run's
|
||||
../blockmaster --authority-store ./master --listen 127.0.0.1:9180 \
|
||||
--topology ./topology.yaml --expected-slots-per-volume 1 > master.log 2>&1 &
|
||||
MPID=$!
|
||||
# A 256 MiB volume (65,536 blocks of 4 KiB) on walstore, NVMe/TCP on loopback.
|
||||
../blockvolume --master 127.0.0.1:9180 --server-id s1 --volume-id v1 --replica-id r1 \
|
||||
--data-addr 127.0.0.1:9201 --ctrl-addr 127.0.0.1:9202 --status-addr 127.0.0.1:9203 \
|
||||
--durable-root ./vol --durable-impl walstore --durable-blocks 65536 \
|
||||
--nvme-listen 127.0.0.1:4420 --nvme-subsysnqn "$NQN" > volume.log 2>&1 &
|
||||
VPID=$!
|
||||
# Ready within 30 s: both processes alive, port 9180 held by our blockmaster
|
||||
# and port 4420 by our blockvolume.
|
||||
local i
|
||||
for i in $(seq 30); do
|
||||
swb_alive "$MPID" && swb_alive "$VPID" || break
|
||||
swb_owns 9180 "$MPID" && swb_owns 4420 "$VPID" && break
|
||||
sleep 1
|
||||
done
|
||||
swb_alive "$MPID" && swb_alive "$VPID" && swb_owns 9180 "$MPID" && swb_owns 4420 "$VPID" ||
|
||||
{ echo "startup failed"; tail -n 20 master.log volume.log; swb_stop; return 1; }
|
||||
sudo nvme connect -t tcp -a 127.0.0.1 -s 4420 -n "$NQN" ||
|
||||
{ echo "nvme connect failed"; swb_stop; return 1; }
|
||||
}
|
||||
swb_show() { # read-only: the namespace under our NQN, then the volume status
|
||||
local s b found=
|
||||
for s in /sys/class/nvme-subsystem/nvme-subsys*; do
|
||||
[ "$(cat "$s/subsysnqn" 2>/dev/null)" = "$NQN" ] || continue
|
||||
for b in "$s"/nvme*n*; do
|
||||
[ -e "/sys/block/${b##*/}" ] || continue
|
||||
ls -l "/dev/${b##*/}"; lsblk "/dev/${b##*/}"; found=1
|
||||
done
|
||||
done
|
||||
[ -n "$found" ] || echo "no namespace for $NQN yet"
|
||||
curl -s 'http://127.0.0.1:9203/status?volume=v1'; echo
|
||||
}
|
||||
```
|
||||
|
||||
Start, look, stop:
|
||||
|
||||
```bash
|
||||
swb_start && sleep 2 && swb_show
|
||||
swb_stop
|
||||
```
|
||||
|
||||
`lsblk` shows a 256M disk. The status JSON shows `VolumeID`, `Epoch`,
|
||||
`Healthy` and `AuthorityRole` (`primary`).
|
||||
|
||||
If you interrupt a step (Ctrl-C) or one fails midway, run `swb_stop` again.
|
||||
It disconnects the NQN only if this run connected it, and stops only the two
|
||||
recorded processes that are still alive, so repeating it is safe. If the shell
|
||||
itself was closed, the recorded PIDs are gone: find the processes with
|
||||
`pgrep -af 'blockvolume --master 127.0.0.1:9180'` and
|
||||
`pgrep -af 'blockmaster --authority-store ./master'`, stop them, and run
|
||||
`sudo nvme disconnect -n nqn.2026-05.io.seaweedfs:v1` if it is still listed.
|
||||
|
||||
For a same-host device without NVMe/TCP, use ublk instead (needs root and the
|
||||
`ublk_drv` kernel module). In `swb_start`: refuse if `/dev/ublkb0` already
|
||||
exists; run `sudo -v`, then start `blockvolume` with `sudo` and
|
||||
`--ublk-device 0` in place of the `--nvme-*` flags; treat it as ready when
|
||||
`sudo kill -0 $VPID` succeeds and `/dev/ublkb0` exists. Show it with `ls -l`
|
||||
and `lsblk`, and stop it with `sudo kill $VPID`, since it runs as root.
|
||||
|
||||
## Write test (scratch host only)
|
||||
|
||||
> **Warning:** this formats a block device. Run it only on a scratch host or
|
||||
> VM that has no data you need and no other Seaweed Block NVMe target
|
||||
> connected.
|
||||
|
||||
Use the self-checking script from a checkout, at the repository root, instead
|
||||
of typing destructive commands by hand:
|
||||
|
||||
```bash
|
||||
SW_BLOCK_DURABLE_IMPL=walstore bash scripts/run-nvme-os-smoke.sh "$PWD"
|
||||
```
|
||||
|
||||
`scripts/run-nvme-os-smoke.sh` runs under `set -euo pipefail`, so any failed
|
||||
step stops it. In order, it:
|
||||
|
||||
- builds `blockmaster` and `blockvolume` into its work directory
|
||||
(`SW_BLOCK_NVME_WORK_DIR`, default `/tmp/sw-block-nvme-os`), unless binaries
|
||||
are already in `SW_BLOCK_BIN_DIR`;
|
||||
- removes its own previous run state under that directory, kills processes
|
||||
started from its own bin directory, and disconnects its own NQN
|
||||
(`SW_BLOCK_NVME_NQN`, default `nqn.2026-05.io.seaweedfs:os-smoke-v1`);
|
||||
- starts blockmaster and one blockvolume on free loopback ports with a
|
||||
256 MiB volume (65,536 blocks of 4 KiB), and waits (bounded) for each to be
|
||||
ready;
|
||||
- for each iteration (`SW_BLOCK_NVME_ITERATIONS`, default 1): `nvme connect`;
|
||||
finds the device of its NQN in `nvme list-subsys -o json` (it falls back to
|
||||
a model-name match in `nvme list` only when `python3` or that output is
|
||||
missing); runs `mkfs.ext4 -F` on it and mounts it; writes a random 4 KiB
|
||||
file, syncs, reads it back and checks its SHA-256; optionally runs `dd` or
|
||||
`fio` (`SW_BLOCK_NVME_STRESS`); unmounts and disconnects;
|
||||
- fails if the subsystem is still present after the last disconnect, then
|
||||
prints `PASS` and the artifact directory. An exit trap unmounts,
|
||||
disconnects and stops the processes.
|
||||
|
||||
The script's default engine is `SW_BLOCK_DURABLE_IMPL=smartwal`; the command
|
||||
above sets `walstore`, the engine used by the Kubernetes chart and the
|
||||
workspace path. There is no equivalent script for ublk yet.
|
||||
@@ -0,0 +1,72 @@
|
||||
# Agent workspace disks: measured results
|
||||
|
||||
**Use this when:** you need the full workspace measurements behind the README
|
||||
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.
|
||||
|
||||
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
|
||||
come from a host-side proxy, described with their table. Each number is the
|
||||
median of 3 runs. They are measurements, not SLOs.
|
||||
|
||||
**Workspace workloads, Seaweed Block disk vs a local file-backed disk** (one
|
||||
bare-metal host; NVMe/TCP loopback; seconds):
|
||||
|
||||
| Workload | Seaweed Block | Local disk |
|
||||
|---|---|---|
|
||||
| `npm ci` (617 packages, offline) | 2.14 | 2.14 |
|
||||
| `git clone` (Go 1.23 repository, local) | 7.10 | 6.99 |
|
||||
| Untar 5,000 files | 0.31 | 0.31 |
|
||||
| Untar a 100,000-file tree | 1.10 | 1.06 |
|
||||
| `find` + `stat` over 100,000 files (cold) | 0.32 | 0.33 |
|
||||
| 2,000 × create + write + `fsync` | 14.33 | 6.09 |
|
||||
|
||||
- Metadata-heavy agent workloads run at local-disk speed, because the guest
|
||||
kernel absorbs metadata and the block device only sees batched writes.
|
||||
- Every guest `fsync` was verified to reach the backend sync: about 2 NVMe
|
||||
flushes per `fsync`, and zero in an unsafe-cache control.
|
||||
- The cost in these runs is `fsync` latency, about 7 ms against 3 ms local.
|
||||
The runs used the NVMe/TCP loopback frontend. The ublk frontend
|
||||
(`--ublk-device`) and the per-stage `fsync` histograms (`/status/durable`,
|
||||
see [fsync latency](fsync-latency.md)) are on `main` now; reducing the
|
||||
latency, including group-commit tuning, is in progress. The numbers here
|
||||
record those runs, not a measurement of current `main`.
|
||||
- The same comparison on an Azure `D16s_v5` nested-virtualization host gives
|
||||
the same picture.
|
||||
|
||||
**Snapshot and fork cost** (a 10 GiB volume written as 2,560 chunks of 4 MiB;
|
||||
median of 3). This is a host-side proxy, not a guest or network run: chunks are
|
||||
local files on a native Linux host, and filer metadata calls use a
|
||||
deterministic model, so network latency, guest `fsync` and the block frontend
|
||||
are excluded.
|
||||
|
||||
| | Flat manifest | Two-level manifest (current) |
|
||||
|---|---|---|
|
||||
| HEAD size | 261,531 B | 2,172 B |
|
||||
| Snapshot | 5.79 ms | 0.18 ms |
|
||||
| Fork | 10.67 ms | 0.29 ms |
|
||||
|
||||
In the same proxy, a cut that writes 64 dirty chunks (256 MiB) took a median
|
||||
624 ms with one upload at a time and 434 ms with 8 parallel uploads.
|
||||
|
||||
**Workspace lifecycle on two hosts** (Firecracker VMs, SeaweedFS chunk backend):
|
||||
|
||||
- 35 of 35 checks passed:
|
||||
- create;
|
||||
- write;
|
||||
- snapshot S1 and S2;
|
||||
- fork from S1, which is independent of its parent;
|
||||
- a clean move to the second host;
|
||||
- a stale-holder replay, which is refused;
|
||||
- delete the fork and S1, then GC.
|
||||
- GC reclaimed 38 of 38 candidate chunks, and every reclaimed chunk returns 404.
|
||||
- Everything still referenced read back byte-identical, including the moved
|
||||
workspace's digest before and after GC.
|
||||
|
||||
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.
|
||||
Reference in new issue
Block a user