Files
seaweedfs/seaweed-block/docs/releases/cli-refusal-codes.md
T

54 lines
4.6 KiB
Markdown

# v1.0.1 typed refusal codes of the chunk CLI
Scripts that read `sw-block ops chunk` JSON answers should decide by the `code` field, never by the message text.
v1.0.1 gives two refusals a code of their own:
- **A restore refused because the snapshot names another volume's chunks** (a snapshot of a restore target):
`"code":"restore_source_not_own"`, exit 1. It was the generic `"code":"not_admitted"`. The master marks this
refusal with a typed reason, which the CLI maps; other refusals of the same kind stay `not_admitted`.
- **A volume the master does not know** (catalog commands such as `ops chunk snapshots --volume NAME`):
`"code":"volume_not_found"`, **exit 1**. It was `"code":"bad_request"` with **exit 2**. This is a contract change
for scripts that check the exit status: in v1.0.1 exit 2 meant a malformed command or another resolve failure; the later policy below distinguishes those failures.
See [restore a snapshot into a new volume](../standalone-deployment.md#restoring-a-snapshot-into-a-new-volume).
## v1.1.1 corrections: retry advice and snapshot replay
In v1.1.1, every `ops chunk` command mapped a remote transport outage to
`remote_unavailable`, `retryable: true`, exit **75** (temporary failure).
The message advises repeating the same operation after the remote is reachable;
keep the same request ID when the operation has one. This includes a filer
that is unavailable during the single-filer check or after snapshot-delete
admission. An actual configuration refusal remains `bad_request`, exit 2.
A caller's own deadline is `deadline_exceeded`, retryable, exit 1; its explicit
cancellation is `canceled`, not a remote outage.
| Answer | Retryable | Exit | Action |
|---|---|---|---|
| `remote_unavailable` | true | 75 | Restore connectivity, then repeat the same operation/request ID. |
| volume-delete Reserve refused by a live holder, even with a dated horizon | false | 1 | Stop the volume first; a serving holder can keep renewing that horizon. |
| volume-delete final lease barrier after reservation committed, with a valid horizon | true | 75 | Retry the same `--request-id` after the printed horizon. |
| volume-delete `not_admitted`: restart required | false | 1 | Restart the authority to settle uncertain persistence; preserve the request ID when resuming. |
| volume-delete `not_admitted`: authority records skipped | false | 1 | Recover the skipped authority records before resuming; lease absence is unknown. |
| volume-delete `not_admitted`: live holder without a horizon | false | 1 | Stop the holder using the stated procedure before resuming. |
| snapshot-delete `snapshot_has_dependents` | false | 1 | Remove dependent volumes or release their dependency before resuming the same request ID. |
| caller `deadline_exceeded` | true | 1 | Inspect progress and the chosen bound; preserve the request ID before resuming. |
| caller `canceled` | false | 1 | The caller interrupted this attempt. |
A dependency refusal does not become an immutable delete outcome: the operation
remains resumable after the dependency is released, but automatic retries cannot
remove that prerequisite. A first snapshot creation reports `replayed: false`;
a repeat admission of the same successful request reports `replayed: true`.
The replay flag decorates the response only. The retained outcome, snapshot
identity, creation time and HEAD remain unchanged. Ordinary GET observation of
the original operation retains its original result; it is not a new admission.
The manual cut observation protocol keeps its own `outcome_unknown`, `cut_busy`
and `cut_stalled` answers; this correction does not change that admission or
observation protocol. HTTP snapshot/detach error bodies are relayed unchanged;
v1.1.1 temporary exit code and retry advice on stderr follow the same rule.
## v1.1.2 admission-aware correction
The v1.1.1 table above is historical. In v1.1.2 a proven unsent outage remains `remote_unavailable`, retryable, exit 75; a possibly admitted request is `outcome_unknown`, exit 3, with replay-key/poll recovery. Incomplete verify uses exit 1 for that class; 3 always means completed with findings. A typed server `remote_unavailable` with `retryable: false` exits 1. Caller cancellation/deadline before send exits 1; after possible admission it uses UNKNOWN. Authentication rejection exits 5, local credential/configuration failure 78, server argument refusal 2 and unproven integrity readout 4. Dated delete lease-barrier advice and stop-first refusal remain distinct. The full [per-family old-to-new inventory](v1.1.2.md) also lists the compatibility exceptions; never infer safe resend from exit status alone.