From d04c34b351feca7d3b5e18a08ce16b250a976ff5 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 6 Dec 2026 01:32:43 -0800 Subject: [PATCH] State the preconditions for repeating an intended plain detach --- seaweed-block/docs/releases/v1.1.1.md | 2 +- seaweed-block/docs/releases/v1.1.2.md | 4 +-- seaweed-block/docs/volume-lifecycle.md | 40 +++++++++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/seaweed-block/docs/releases/v1.1.1.md b/seaweed-block/docs/releases/v1.1.1.md index a304145ec5..280a3278ac 100644 --- a/seaweed-block/docs/releases/v1.1.1.md +++ b/seaweed-block/docs/releases/v1.1.1.md @@ -27,7 +27,7 @@ v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored fo 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. + 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. A repeat may complete the intended final detach only with the guest writer stopped and kept stopped by the operator and authority unchanged; `plain_detach_busy` is not proof of a stopped writer. See the [repeat preconditions](../volume-lifecycle.md#recover-an-unknown-plain-detach). This repeat does not establish what the first attempt did; inspect `ops chunk show` for the resulting seal. 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) diff --git a/seaweed-block/docs/releases/v1.1.2.md b/seaweed-block/docs/releases/v1.1.2.md index d8932b960a..36de510770 100644 --- a/seaweed-block/docs/releases/v1.1.2.md +++ b/seaweed-block/docs/releases/v1.1.2.md @@ -25,7 +25,7 @@ v1.1.2 is not yet released. 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. + 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. A repeat may complete the intended final detach only with the guest writer stopped and kept stopped by the operator and authority unchanged; `plain_detach_busy` is not proof of a stopped writer. See the [repeat preconditions](../volume-lifecycle.md#recover-an-unknown-plain-detach). This repeat does not establish what the first attempt did; inspect `ops chunk show` for the resulting seal. A definite retryable CLI answer for this case is planned for v1.1.3. ## Fixed @@ -119,7 +119,7 @@ second non-idempotent operation after an uncertain answer. | Chunk: caller cancellation/deadline before send | 75 on gRPC/HTTP paths | 1 | Caller ended the attempt. Possible admission instead means UNKNOWN/3. | | Snapshot observation: changed operation ID | 1 | 3 with `outcome_unknown` | Recover the original request id/handle; the mismatched answer does not settle it. | | Snapshot observation: succeeded without a result, at admission or poll | 1 | 3 with `outcome_unknown` | Recover the original request id/handle; the incomplete observation does not settle it. | -| Plain detach: malformed seal result | 1 | 3 with `outcome_unknown` | Keep the writer stopped and repeat the same plain detach, as the CLI says. If the first attempt sealed, the repeat publishes nothing and answers that seal's HEAD generation from a fresh HEAD read. If it never sealed, the repeat seals the idle volume, or refuses `plain_detach_busy` without changing anything while I/O is active. The malformed reply itself does not prove the sealed HEAD. | +| Plain detach: malformed seal result | 1 | 3 with `outcome_unknown` | The operator must stop and keep the guest writer stopped, with authority unchanged. Under those conditions, repeat the same plain detach to complete the intended final detach: if already sealed it publishes nothing and answers the sealed HEAD from a fresh read; otherwise it can complete the seal. `plain_detach_busy` is not proof that the writer is stopped. The repeat does not establish what the first attempt did; inspect `ops chunk show` for the resulting seal. | | Snapshot observation: JSON decoder failure | 75 | 3 with `outcome_unknown` | Recover the original operation; malformed data does not settle it. | | Snapshot/non-plain-detach initial HTTP answer: unusable 4xx body, except 409/429 | 1 | 1 / 2 / 5 | Preserve the received auth/argument/refusal class; do not infer it from a nested transport error. | | Snapshot/non-plain-detach initial HTTP answer: unusable 409/429, 5xx, other non-200 answer, or oversized success/admission | 1 | 3 with `outcome_unknown` | Snapshot: recover with the original request id and unchanged parameters or an already obtained handle. Non-plain detach has no such identifier: keep the writer stopped and inspect the original holder HEAD/logs for a confirmed seal or abort; unproven outcomes require investigation. An unusable 409 never proves non-admission. | diff --git a/seaweed-block/docs/volume-lifecycle.md b/seaweed-block/docs/volume-lifecycle.md index ff2863507f..314be6fe26 100644 --- a/seaweed-block/docs/volume-lifecycle.md +++ b/seaweed-block/docs/volume-lifecycle.md @@ -271,11 +271,13 @@ 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). 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. +answers from the sealed HEAD. For a malformed seal result, the CLI may say +`retry the same plain detach to settle it`: this is allowed to complete the +intended final detach only if the operator has stopped and keeps the guest +writer stopped and authority is unchanged. It does not establish what the +first attempt did; inspect `ops chunk show` for the resulting seal. See +[Recover an unknown plain detach](#recover-an-unknown-plain-detach) for the +preconditions and the separate read-only investigation of the first outcome. 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 @@ -627,10 +629,24 @@ 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. +can settle its outstanding HEAD write. Do not revoke, move or restart the +holder during this recovery. + +To complete the intended final detach after a malformed seal result, the +operator may repeat the same plain detach only while keeping the guest writer +stopped throughout and authority unchanged. Before repeating, require the +same holder and epoch with a granted lease (step 1) and the same HEAD claim +`C` recorded before the first attempt (step 2). `plain_detach_busy` is not +proof that the writer is stopped; the operator must stop it independently. +If the volume already sealed, the repeat publishes nothing and answers that +sealed HEAD from a fresh read; otherwise it can complete the intended seal. +A retained handle may first return `cut_busy`; wait for its retention to +expire and recheck the preconditions. Check the resulting seal with +`ops chunk show` before proceeding to revoke. + +The repeat completes the intended operation but does not establish what the +first attempt did. To investigate that original outcome, use the read-only +checks below; a new detach answer is not evidence of the earlier attempt. 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). @@ -662,8 +678,10 @@ 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 you need to establish the first outcome and neither the sealed HEAD nor +an unambiguously correlated abort is available, keep guest I/O stopped and +preserve the diagnostics for operator investigation; this is separate from +the conditional intended-final-detach repeat above. 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.