Files
seaweedfs/seaweed-block/docs/upgrade-v1.0.1.md
T

9.4 KiB

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 anything it stores: a volume's remote image (its chunks, roots and HEAD in SeaweedFS), blockmaster's stores, and the volume host's files (its log included). Persisted state lists each one, how it is encoded and which ones a test pins to the v1.0.0 bytes. There is no conversion step and no flag to set.

Order

  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.

The order matters: blockmaster must be v1.0.1 before any volume host is. A v1.0.0 blockmaster with a v1.0.1 volume host is not supported (not tested).

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). 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. In it:

  • New volumes stay at most 256 GiB in v1.0.1, as in v1.0.0.
  • A restore's target must be in the cluster spec before the restore: a v1.0.1 blockmaster refuses a target that is not, unless its product loop is on (--lifecycle-product-loop-interval above 0); the refusal names that flag.
  • cluster.check is in the v1.0.1 sw-block; since the CLI is upgraded last, run it from a v1.0.1 binary during the upgrade. Against a volume whose holder is still v1.0.0 it reports the holder's version as unavailable (a v1.0.0 holder does not report one), never ok.

2. Each volume host

The upgrade of a volume host is the documented restart without a hand-over 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.

    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. Update the unit, then replace the binary, once per host. Before installing or switching to the new binary, update each installed blockvolume unit from the matching v1.0.1 shipped unit (preserving local settings), then run sudo systemctl daemon-reload. The added 79 in RestartPreventExitStatus also works with the old binary (which never exits 79). Do this first so even an unplanned restart during the switch cannot run a new holder under an old restart policy. Leaving an old unit installed restarts a new holder after a recorded revocation, and the no-restart fix is not in effect. Then stage the binary next to the old one, check it, and rename it: 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:

    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 <the volume's blockvolume unit>. 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 (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 (--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, 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 (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, 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:

    sw-block ops chunk verify --master MASTER --volume v1 --chunk-filer FILER --depth data --timeout 30m
    

    It checks every named snapshot in turn. 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=<v> ... 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=<v>: ... 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.
  • 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.