From 6d45520496e1e07dfb0f50c910a4f41dcd879202 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 10:19:53 -0800 Subject: [PATCH] docs: lifecycle, one live process per volume per host by the host lock Co-Authored-By: Claude Fable 5.2 --- seaweed-block/docs/volume-lifecycle.md | 35 ++++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/seaweed-block/docs/volume-lifecycle.md b/seaweed-block/docs/volume-lifecycle.md index c9d8895065..0d3f3b4bc7 100644 --- a/seaweed-block/docs/volume-lifecycle.md +++ b/seaweed-block/docs/volume-lifecycle.md @@ -104,15 +104,26 @@ blockvolume runs with its identity from the spec (`--server-id s1 --volume-id v1 **Check:** blockvolume logs `blockvolume: volume v1 adopted as PRIMARY at r1@E`, and `ops workspace show` prints `lease state: granted` and `holder: r1@E`. -## Rule: one live process per holder +## Rule: one live process per volume per host -blockmaster cannot tell two processes with the same identity apart. The only -guard is the exclusive lock on the volume file `/v1.bin`, and it -works only when both processes use the same file. Moving the local root aside -while the old process runs bypasses it. +`blockvolume` takes an exclusive lock on `/run/sw-block/locks/.lock` +before it opens the volume's store and holds it until it exits. A second +`blockvolume` for the same volume on the same host is refused at start, whatever +its `--durable-root`. The kernel releases the lock when the process exits, also +on a crash or a kill; there is nothing to clean up. Setup and limits are in +[One live process per volume per host](releases/one-process-per-volume.md). -So, before you start a second process for the volume, or move a local root -aside, make sure the old process is gone: +The lock covers one host. Two hosts are kept apart by blockmaster's assignment +and the lease, not by this lock. + +An existing local root attaches only if its durable position reaches the +`remoteLSN` of HEAD. A root that is behind (a copy taken before a later cut) +is refused, never serves, and its process exits 78 (no automatic restart) with +`reason=superseded cure="remove or quarantine the local root to attach fresh +from HEAD"`. A power loss does not cause this: a cut makes its position durable +locally before it publishes it. + +Before you move a local root aside, make sure its process is gone: ```bash systemctl status sw-blockvolume # inactive (dead) @@ -127,11 +138,13 @@ nothing about another host. These are rules for the operator. The product does not detect every breach. -- **One local root per volume per host.** Do not start a second `blockvolume` for the - same volume on a host with another `--durable-root`. +- **One local root per volume per host.** A second `blockvolume` for the volume on the + same host is refused by the lock; do not work around it (another lock directory, a + container that does not share the host's `/run/sw-block/locks`). - **Never restore a local root from a copy** (a file copy, a disk snapshot, a backup). - A copy is older than what the volume acknowledged. To go back, start from the remote - image with a fresh root. + A copy older than the last cut is refused. A copy taken after the last cut is NOT + detected: it attaches and loses the writes acknowledged after the copy was taken. To go + back, start from the remote image with a fresh root. - **After a forced move, stop and disable the old host's unit.** Until you do, it restarts about every 35 seconds, logs that it waits for an assignment, and cannot serve.