From 32d1b6eaf7a9755bcb15a5671e4bfd1601293ca2 Mon Sep 17 00:00:00 2001 From: Ping Qiu Date: Sun, 6 Dec 2026 00:57:44 -0800 Subject: [PATCH] docs(block): describe occasional plain detach abort (#13486) * docs(block): describe occasional plain detach abort * docs(block): clarify plain detach outcome recovery * Clarify detach handle lifetime and retry recovery * Document read-only recovery of an unidentified plain detach * Clarify lease and store preconditions for detach recovery * Apply detach retry preconditions to both abort confirmations --- seaweed-block/docs/releases/v1.1.1.md | 27 ++++++++- seaweed-block/docs/releases/v1.1.2.md | 25 ++++++++ seaweed-block/docs/volume-lifecycle.md | 83 +++++++++++++++++++++++--- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/seaweed-block/docs/releases/v1.1.1.md b/seaweed-block/docs/releases/v1.1.1.md index a4a6800032..a304145ec5 100644 --- a/seaweed-block/docs/releases/v1.1.1.md +++ b/seaweed-block/docs/releases/v1.1.1.md @@ -4,6 +4,31 @@ v1.1.1 is released (2026-12-04). v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored format. +## Known issue: plain detach can abort during a periodic checkpoint + +- **Trigger:** a periodic checkpoint's already-issued HEAD update lands while `sw-block ops chunk detach --plain` is stopping background work. +- **Effect:** a confirmed `detach_aborted` means no sealed HEAD was published and serving resumed on the same holder. The CLI can instead report `outcome_unknown` (exit 3); that answer alone proves neither an abort nor resumed guest I/O. If the holder's detach outcome is still unresolved, I/O stays stopped while it settles. +- **What to do:** confirm the original handle before treating this as a retryable abort. The holder keeps the handle only for about `--timeout` plus 5 s after the detach ends, and the CLI gives up about that long after its last progress, so query right after the CLI exits, or from a second shell while it still waits. The CLI prints the id (`sw-block ops chunk detach: id ` on stderr) only when the detach is still running after `--timeout`; an abort that ends sooner is answered on the detach request itself, with no id. If no id was printed, skip this GET and follow the unresolved-outcome procedure below, keeping guest I/O stopped. On the holder's host, query the same status address and volume used by the detach, with the id printed by the CLI: + + ```sh + STATUS_ADDR='' + case "$STATUS_ADDR" in + *://*) ;; + *) STATUS_ADDR="http://$STATUS_ADDR" ;; + esac + VOLUME_ID='' + CUT_ID='' + curl --silent --show-error --max-time 5 --get \ + --data-urlencode "volumeID=$VOLUME_ID" \ + --data-urlencode "cutID=$CUT_ID" \ + --write-out '\nHTTP %{http_code}\n' \ + "${STATUS_ADDR%/}/chunk/cut" + ``` + + HTTP 200 with `apiVersion: 1`, the same `cutID` and a valid detach result means the detach completed. Keep the writer stopped, verify the detached HEAD against the holder, epoch and claim recorded before detach, and record its generation and position as in [step 3](../volume-lifecycle.md#planned-hand-over) before continuing. HTTP 202 with `apiVersion: 1`, the same `cutID` and `code: "in_progress"` means it is still running: keep guest I/O stopped and repeat only this read-only GET, not the detach POST. + + HTTP 409 with `apiVersion: 1`, the same `cutID`, `code: "detach_aborted"` and `retryable: true` confirms this abort. The retained handle still occupies the detach slot until about `--timeout` plus 5 s after the abort. After either status or log confirmation, [repeat steps 1 and 2](../volume-lifecycle.md#planned-hand-over) immediately before a retry: require a granted lease for the same holder/epoch and save its current HEAD claim. Wait for that retention to expire before retrying the plain detach; if the retry answers `cut_busy` with reason `detach_in_progress`, wait and retry after expiry. This GET does not start another operation. Handles are transient: HTTP 404 `unknown_cut_id` (including after expiry or a holder restart), a failed query, or an unsettled answer does not confirm an abort. In that case keep guest I/O stopped, preserve the CLI output and holder logs, and follow [Recover an unknown plain detach](../volume-lifecycle.md#recover-an-unknown-plain-detach) before resuming I/O or moving the volume. Do not repeat the detach to discover its original outcome: `cut_busy` only means the slot is occupied, and a retry after expiry can start a new detach. A definite retryable CLI answer for this case is planned for v1.1.3. + ## Known issue: `sw-block mini` as a non-root user (fixed in v1.1.2) v1.1.2's `mini` keeps the volume lock under `--dir`, needs no `sudo` to start, prints absolute paths, and names the @@ -48,7 +73,7 @@ v1.1.2's `mini` keeps the volume lock under `--dir`, needs no `sudo` to start, p - Affects volumes on the walstore engine run by `sw-blockvolume.service`, `sw-blockvolume@.service` or `sw-blockvolume-ublk.service` (`StartLimitBurst=10` in 600 s, `RestartSec=5s`). Chunk-store volumes wait for blockmaster in process and are not affected. - A walstore volume that starts while blockmaster is unreachable exits with 75 after about 10 s and is restarted by systemd. After about 10 attempts (about 150 s) the unit stays failed, even once blockmaster is back. -- No data is lost. Recover with `systemctl reset-failed `, then `systemctl start `. A fix is planned for v1.1.2. +- No data is lost. Recover with `systemctl reset-failed `, then `systemctl start `. A fix is planned for a later v1.1.x release. ## Known issue: startup retirement reads can delay blockmaster diff --git a/seaweed-block/docs/releases/v1.1.2.md b/seaweed-block/docs/releases/v1.1.2.md index 1522973f09..079e6da013 100644 --- a/seaweed-block/docs/releases/v1.1.2.md +++ b/seaweed-block/docs/releases/v1.1.2.md @@ -2,6 +2,31 @@ v1.1.2 is not yet released. +## Known issue: plain detach can abort during a periodic checkpoint + +- **Trigger:** a periodic checkpoint's already-issued HEAD update lands while `sw-block ops chunk detach --plain` is stopping background work. +- **Effect:** a confirmed `detach_aborted` means no sealed HEAD was published and serving resumed on the same holder. The CLI can instead report `outcome_unknown` (exit 3); that answer alone proves neither an abort nor resumed guest I/O. If the holder's detach outcome is still unresolved, I/O stays stopped while it settles. +- **What to do:** confirm the original handle before treating this as a retryable abort. The holder keeps the handle only for about `--timeout` plus 5 s after the detach ends, and the CLI gives up about that long after its last progress, so query right after the CLI exits, or from a second shell while it still waits. The CLI prints the id (`sw-block ops chunk detach: id ` on stderr) only when the detach is still running after `--timeout`; an abort that ends sooner is answered on the detach request itself, with no id. If no id was printed, skip this GET and follow the unresolved-outcome procedure below, keeping guest I/O stopped. On the holder's host, query the same status address and volume used by the detach, with the id printed by the CLI: + + ```sh + STATUS_ADDR='' + case "$STATUS_ADDR" in + *://*) ;; + *) STATUS_ADDR="http://$STATUS_ADDR" ;; + esac + VOLUME_ID='' + CUT_ID='' + curl --silent --show-error --max-time 5 --get \ + --data-urlencode "volumeID=$VOLUME_ID" \ + --data-urlencode "cutID=$CUT_ID" \ + --write-out '\nHTTP %{http_code}\n' \ + "${STATUS_ADDR%/}/chunk/cut" + ``` + + HTTP 200 with `apiVersion: 1`, the same `cutID` and a valid detach result means the detach completed. Keep the writer stopped, verify the detached HEAD against the holder, epoch and claim recorded before detach, and record its generation and position as in [step 3](../volume-lifecycle.md#planned-hand-over) before continuing. HTTP 202 with `apiVersion: 1`, the same `cutID` and `code: "in_progress"` means it is still running: keep guest I/O stopped and repeat only this read-only GET, not the detach POST. + + HTTP 409 with `apiVersion: 1`, the same `cutID`, `code: "detach_aborted"` and `retryable: true` confirms this abort. The retained handle still occupies the detach slot until about `--timeout` plus 5 s after the abort. After either status or log confirmation, [repeat steps 1 and 2](../volume-lifecycle.md#planned-hand-over) immediately before a retry: require a granted lease for the same holder/epoch and save its current HEAD claim. Wait for that retention to expire before retrying the plain detach; if the retry answers `cut_busy` with reason `detach_in_progress`, wait and retry after expiry. This GET does not start another operation. Handles are transient: HTTP 404 `unknown_cut_id` (including after expiry or a holder restart), a failed query, or an unsettled answer does not confirm an abort. In that case keep guest I/O stopped, preserve the CLI output and holder logs, and follow [Recover an unknown plain detach](../volume-lifecycle.md#recover-an-unknown-plain-detach) before resuming I/O or moving the volume. Do not repeat the detach to discover its original outcome: `cut_busy` only means the slot is occupied, and a retry after expiry can start a new detach. A definite retryable CLI answer for this case is planned for v1.1.3. + ## Fixed - **Replicated volumes (preview): a queued rebalance no longer undoes an operator failover.** blockmaster's automatic diff --git a/seaweed-block/docs/volume-lifecycle.md b/seaweed-block/docs/volume-lifecycle.md index a57daeceb2..ff2863507f 100644 --- a/seaweed-block/docs/volume-lifecycle.md +++ b/seaweed-block/docs/volume-lifecycle.md @@ -30,10 +30,14 @@ Snapshots, retention and restore are in ## The three records, and what each proves +In the HEAD commands below, `CHUNK_PATH` is the volume's configured +`--chunk-path` (`SWB_CHUNK_PATH` with the example unit). Use that same path +for the pre-detach record and recovery; do not assume `/swblock/chunks`. + | Record | How to read it | What it proves | |---|---|---| | The lease | `sw-block ops workspace show --master MASTER --volume v1`: `replica:`, `epoch:`, `lease state:`, `holder: r1@E` | Which holder blockmaster lets serve. `granted`, `revoking` or `expired` is the host validity at query time, not permission to move | -| HEAD | `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER`: `head.Gen`, `head.Epoch`, `head.Holder`, `head.ClaimID`, `head.Position`, `head.State`, `head.Current` | The committed image through `Position`. `State` `detached` names the holder's stopped image; there is no separate `detachedBy` field | +| HEAD | `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER --chunk-path CHUNK_PATH`: `head.Gen`, `head.Epoch`, `head.Holder`, `head.ClaimID`, `head.Position`, `head.State`, `head.Current` | The committed image through `Position`. `State` `detached` names the holder's stopped image; there is no separate `detachedBy` field | | The ACK | the same `show`: `recorded ACK: r1@E HEAD generation G` | The old holder drained and closed after reading the sealed HEAD G. A clean move needs it | `ops chunk show` prints JSON with `volume` and `head` objects. The HEAD view @@ -245,6 +249,18 @@ Copy `replica:` (`R`) and `epoch:` (`E`). `lease state:` must be `granted`. **2. Stop the writer.** Stop the guest or unmount the file system, so that no I/O is in flight. Leave `blockvolume` running: the seal runs inside it. +Before detach, save the current HEAD: + +```bash +sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER --chunk-path CHUNK_PATH +``` + +Record `head.Holder`, `head.Epoch` and the nonempty `head.ClaimID` (`C`). +The HEAD must be live (`head.State` is `""`) and name the holder and epoch +read in step 1. If it does not, stop and inspect the changed assignment. +Keep this output with the detach's CLI output; it identifies the original +claim if the detach's outcome later becomes unknown. + **3. Seal (plain detach)**, while the lease is granted: ```bash @@ -254,12 +270,16 @@ sw-block ops chunk detach --plain --volume v1 --status-addr STATUS --timeout 120 Exit 0: stdout is JSON with `volumeID`, `cutLSN`, `headGen`, `headEpoch` and `lastWrittenLSN`; stderr has `sealed HEAD generation: G`. Copy `G`. From now on the volume refuses I/O on this host. Do not go on after any other answer (see -the table below). Repeating the command is safe: it answers from the sealed -HEAD. +the table below). After a confirmed successful seal, repeating the command +answers from the sealed HEAD. After `outcome_unknown`, do not repeat it to +discover what happened; follow [Recover an unknown plain detach](#recover-an-unknown-plain-detach). +For a malformed seal result, the CLI may say `retry the same plain detach to +settle it`. Do not follow that diagnostic: a new POST can start another +detach after the old handle expires. Use the recovery procedure instead. -To check: `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER` shows +To check: `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER --chunk-path CHUNK_PATH` shows `head.State` `detached`, `head.Holder` `s1/R`, `head.Epoch` E, a nonempty -`head.ClaimID`, `head.Gen` G and a non-null `head.Current`. Its `head.Position` +`head.ClaimID` equal to C, `head.Gen` G and a non-null `head.Current`. Its `head.Position` is the sealed position L; the HEAD itself is the stop proof, with no `detachedBy`. **4. Revoke**, giving the generation you copied: @@ -531,7 +551,7 @@ continues. If the no-progress window expires, the answer has `code: remote_unava `retryable: true`, and the progress, blocked object and cause. Already-absent objects count as done. Permanent refusals retain their existing codes. Keep the `--request-id` and use the same one if you have to run the command again. -Afterwards `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER` shows +Afterwards `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER --chunk-path CHUNK_PATH` shows `head.State` `deleted`. The HEAD view has no `chunkCount` field; use the volume's object listing or verification report to check its remaining objects. @@ -604,13 +624,60 @@ A Busy condition that persists beyond the host's retry budget can still become an I/O error and needs diagnosis; readiness observation does not reserve future admission. Permanent and lineage errors are not converted to retryable errors. +## Recover an unknown plain detach + +Keep the guest or writer stopped and leave the original holder running so it +can settle its outstanding HEAD write. Do not revoke, move, restart the holder, +or issue another detach to discover the original outcome. A retry can return +`cut_busy` while the old handle is retained; after expiry it can start a new +detach. Neither answer identifies the original outcome. + +If the CLI printed a cut id, query that original handle promptly using the +[read-only status query](releases/v1.1.1.md#known-issue-plain-detach-can-abort-during-a-periodic-checkpoint). +HTTP 200 with version 1, the same `cutID` and a valid detach result means the +detach completed: verify the detached HEAD against the original holder, +epoch and claim `C` saved in step 2, record its generation and position as in +step 3, and then continue the hand-over. HTTP 202 with version 1, the same +`cutID` and `code: "in_progress"` means it is still running: keep guest I/O +stopped and query that handle again later, without another detach POST. +A fast abort may print no id; the CLI has no supported way to look up that +expired or unidentified handle. In that case, or if the query fails, preserve +the CLI output and the original holder's logs for this attempt and use these +read-only checks: + +- Run `sw-block ops chunk show --master MASTER --volume v1 --chunk-filer FILER --chunk-path CHUNK_PATH`. + A detached HEAD matching the holder, epoch and claim `C` saved in step 2 is the seal proof; + record its generation and position as in step 3 before continuing to revoke. +- To confirm an abort, find the original holder's log for this volume and + attempt: `durable: detach of volume=v1 aborted, nothing published; serving resumed:`. + The provider writes this only after its settlement proved non-publication + and it resumed serving. Correlate it with the command's time and the same + holder process; an old line or a live HEAD alone is not confirmation. Check + `ops workspace show` still names that holder and epoch. + +After either a status-confirmed or log-confirmed abort, wait for the old +handle's retention to expire, then immediately before a new detach repeat +steps 1 and 2: require `lease state:` `granted` for that same holder and epoch +and save its current HEAD claim. Matching holder/epoch with an expired lease +is not enough; do not detach while the lease is expired or the assignment +has changed. A `cut_busy` answer still means wait, not confirmation. + +If neither the sealed HEAD nor an unambiguously correlated abort is available, +keep guest I/O stopped and preserve the diagnostics for operator investigation. +If the original claim was not recorded before this attempt, a current HEAD +alone cannot establish that it matches the original claim; do not substitute +a claim read after the unknown answer. +Do not infer the outcome from elapsed time, handle expiry, a live HEAD, or a +new detach's answer. The holder retries unresolved settlement while it remains +running; restore filer connectivity if its logs say it is waiting for the filer. + ## Symptoms | You see | It means | Do | |---|---|---| | `sw-block ops chunk detach: plain_detach_busy: durable: plain detach requires idle frontend I/O` | I/O was in flight; nothing changed | Stop the writer, retry step 3 | -| detach answers `detach_aborted` | Nothing was published; the volume serves here again | Retry step 3 | -| detach answers `outcome_unknown` | The seal may have landed; I/O stays stopped | Retry step 3: it settles the outcome | +| detach answers `detach_aborted` | Nothing was published; the volume serves here again | Wait for the retained handle to expire before a new step 3 attempt; `cut_busy` means wait | +| detach answers `outcome_unknown` | The CLI has not established the original outcome; I/O may still be stopped | Keep the writer stopped and follow [Recover an unknown plain detach](#recover-an-unknown-plain-detach); do not retry step 3 as an outcome query | | volume-delete Reserve: `not_admitted` (non-retryable, exit 1): `stop the volume first: ... deletion refused before persistence: ... live until