diff --git a/seaweed-block/docs/operator-guide.md b/seaweed-block/docs/operator-guide.md index 709bf2a113..e4be6dfa39 100644 --- a/seaweed-block/docs/operator-guide.md +++ b/seaweed-block/docs/operator-guide.md @@ -188,7 +188,8 @@ default) can expire the host's slots; keep host clocks synchronized. - **For a newer recovery point:** set `--chunk-capture-interval` (at least 5 minutes), or take a snapshot before risky work. - **What does not publish:** a stop, a lease revocation and a lease expiry publish nothing. Only a cut, a snapshot or - a seal (`ops chunk detach --plain`) does. + a seal (`ops chunk detach --plain`) does. `systemctl stop` of a volume does not cut: before a stop after which the + host might not come back (maintenance, an upgrade), run `sw-block ops chunk cut` first. - **When SeaweedFS is unavailable** (the filer or a volume server is down): - Guest I/O continues from the local disk; in the tests no guest command failed, and every answer came within the test's 20 s bound (about 2 s at the slowest in the one measured run; that run's record was not kept). diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 782ab422de..b962f376fd 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -20,6 +20,8 @@ lease requests require the assigned server id. A new volume against an older pre-release master stays not serving until the master is upgraded; an older volume must also be upgraded to gain the assignment guard. Do not use endpoint matching as a compatibility fallback. See [holder identity and upgrades](releases/holder-identity.md). + +From v1.0.0 to v1.0.1, follow [Upgrade from v1.0.0 to v1.0.1](upgrade-v1.0.1.md). ## Get the matching files The unit and settings files must come from the same commit as your diff --git a/seaweed-block/docs/upgrade-v1.0.1.md b/seaweed-block/docs/upgrade-v1.0.1.md new file mode 100644 index 0000000000..fee5cb1aa9 --- /dev/null +++ b/seaweed-block/docs/upgrade-v1.0.1.md @@ -0,0 +1,137 @@ +# Upgrade from v1.0.0 to v1.0.1 + +**Use this when:** you run v1.0.0 single-replica volumes (`--durable-impl walstore-chunk`, standalone under systemd) +and move them to v1.0.1. + +**Format:** v1.0.1 makes no format change in a volume's remote image (its chunks, roots and HEAD in SeaweedFS) or +in its log. There is no conversion step and no flag to set. + +## Order + +1. **blockmaster first.** +2. **Then each volume host, one at a time.** Each volume on the host serves again before you start on the next host. +3. **The `sw-block` CLI last.** + +Before you start: for each volume that runs with `--chunk-control-endpoint`, take a snapshot +(`sw-block ops chunk snapshot`), so that it has a recent restore point whatever happens during the upgrade. A volume +without the endpoint cannot be asked for a snapshot or a cut; its recovery point during the upgrade stays its last +scheduled snapshot. + +## 1. blockmaster + +1. Stop it: `systemctl stop sw-blockmaster`. +2. Replace the `blockmaster` binary with v1.0.1's the same way as in step 2 below (stage + `/usr/local/bin/blockmaster.new`, check it with `--version`, then `mv` it over the old one). +3. Start it with the same flags and the same stores (`--lifecycle-store`, the authority store, the cluster spec): + `systemctl start sw-blockmaster`. + +Volumes keep serving through a short restart. Each holder renews its lease every 10 s or less and may serve until 20 s +after its last renewal (with the default flags). A blockmaster that answers again within about 10 s interrupts +nothing. A longer stop is fail-closed: a holder whose lease ends stops I/O, exits 75 (`reason=lease_expired`), is +started again by its unit and serves again once blockmaster is back and its barrier has passed (see +[standalone deployment](standalone-deployment.md)). No acknowledged write is lost either way. + +During the rest of the upgrade, blockmaster is v1.0.1 while some volume hosts and the `sw-block` CLI are still +v1.0.0. This mixed state is supported: v1.0.0 holders keep serving, snapshots and restores work, and the commands of +step 2 run from the v1.0.0 CLI. + +## 2. Each volume host + +The upgrade of a volume host is the documented +[restart without a hand-over](volume-lifecycle.md#same-host) on the new binary: `systemctl restart` keeps the holder +and its epoch, and the new process serves again from its local WAL, so every acknowledged write is kept. No seal and +no move are needed. + +1. **Cut each volume on the host** (recommended, not required): it narrows what a loss of the host during the + upgrade can cost. `systemctl stop` and `systemctl restart` do not cut by themselves. + + ```bash + sw-block ops chunk cut --volume v1 --status-addr STATUS + ``` + + The cut needs the volume's `--chunk-control-endpoint`; without it, skip this step. If the cut answers a retryable + error or an unknown outcome, go on: the restart keeps every acknowledged write in the local WAL either way. +2. **Replace the binary**, once per host: stage it next to the old one, check it, then rename it over the old one. + A rename in the same directory is atomic, so a unit that starts at any moment finds either the old or the new + binary, never a partial file: + + ```bash + sudo install -m 0755 ./blockvolume /usr/local/bin/blockvolume.new + /usr/local/bin/blockvolume.new --version + sudo mv /usr/local/bin/blockvolume.new /usr/local/bin/blockvolume + ``` + + The volumes still running keep their old process until they restart. From now on, any `blockvolume` on this host + that starts again, planned or not (for example after a lease expiry, exit 75, or a crash), starts as v1.0.1. That + is supported: it is the same restart. +3. **Restart each holder, one at a time:** + 1. `systemctl restart `. If the new process renews before its lease ends, it serves + again at once from its local WAL. If not, it waits for the re-grant described in + [after a crash](volume-lifecycle.md#after-a-crash) (with the default flags, up to 65 seconds after it stopped) + and then serves. + 2. Check that it serves: its status shows `"Healthy":true` and `"AuthorityRole":"primary"` + (`curl -s 'http://STATUS/status?volume=v1'`). Wait for it to serve before you restart the next holder. + + **The guest during the restart:** the restart stops the NVMe/TCP target the guest is connected to. The guest's I/O + on the device pauses and continues when the holder serves again, if it connected with the options in + [host connect settings](operator-guide.md#host-connect-settings) (`--ctrl-loss-tmo=180 --reconnect-delay=2`). + To avoid the pause, stop the writer first. If the device does not come back by itself (I/O fails with `EIO`, or + the controller is gone), connect it again with the same `nvme connect` command. + +Nothing the volume acknowledged is lost. The answers other than the expected one, and what to do: + +| Step | Answer | Do | +|---|---|---| +| cut | an error, `remote_unavailable`, or an unknown outcome | go on to the restart; the local WAL keeps every acknowledged write | +| cut | the command is refused because the control endpoint is off | skip the cut | +| restart | the unit fails to start (`systemctl status` shows it failed) | check the binary (`blockvolume --version`) and the unit's log, then start it again | +| check | `"Healthy":false` or `"AuthorityRole"` not `primary`, with `NotReadyReason=lease_not_held` | wait: it is waiting for its re-grant ([after a crash](volume-lifecycle.md#after-a-crash), up to 65 s with the default flags); check again | +| check | still not serving after that wait | stop here; follow [a volume waiting for blockmaster](operator-guide.md#a-volume-waiting-for-blockmaster) (its `MasterWait` reason names the cause) before you go on | + + +**Optional:** combine the upgrade with a move: seal the volume and hand it over +([planned hand-over](volume-lifecycle.md#planned-hand-over), or back to the same host), and start it with the v1.0.1 +binary. The restart above is the upgrade procedure. + +## 3. The `sw-block` CLI + +Replace `sw-block` on every machine that runs it, the same way (stage, check with `--version`, `mv` over the old +one). + +## After the upgrade + +- Check every volume with the read-only verify: + + ```bash + sw-block ops chunk verify --master MASTER --volume v1 --chunk-filer FILER --all-snapshots --depth data --timeout 30m + ``` + + Exit 0 is clean. A snapshot taken before the upgrade restores as before. +- v1.0.0 left the roots and segments of old cuts in place. v1.0.1's cleaning removes them, starting at the next + `--chunk-maintenance-interval` (hourly by default); each pass logs `maintenance volume= ... planned=N removed=N` + on the volume's host. A pass is bounded in time and the next one continues, so this can take several passes. Until + then, the same verify with `--orphans` lists those roots and segments: that is expected after an upgrade, not + damage. Run the `--orphans` check once a pass has completed without an error and removed nothing: its count line + shows `removed=0` and no `durable: maintenance volume=: ...` error follows it. (The count line is printed for + every pass, also one that failed; `planned=` counts every chunk name the pass read, so it is not 0 on a volume with + data.) + +## If a step is interrupted + +Each step can be repeated, and the procedure resumes at the step that did not finish: + +- **blockmaster killed while it starts:** start it again. Volumes behave as in a longer blockmaster stop above. +- **A holder killed during its cut:** its unit starts it again, on the new binary if it was already installed. + It replays its WAL and serves again; go on with the restart step (or skip it if it already runs v1.0.1). +- **The new `blockvolume` killed while it starts:** its unit starts it again. If it does not serve again within its + lease, follow [after a crash](volume-lifecycle.md#after-a-crash). +- **A whole host lost power mid-procedure:** start its units again, then resume at the step it had not finished. + +## Downgrade + +Downgrade is not supported and is not a tested procedure. Do not start a v1.0.0 build on a store that v1.0.1 has +served. + +One case is a hazard, not only unsupported: **never let v1.0.0 serve a volume larger than 256 GiB.** v1.0.0 cannot +finish the commit check of such a volume's cut within its time limit, so its snapshots fail with an unknown +outcome.