Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f42fed7
Give every CAS request its own window and cap decision loops
filimonov Nov 27, 2026
31088ee
Bound CAS loops above the engine by counts, not shared deadlines
filimonov Nov 27, 2026
74be207
Cap CAS ref-table recovery at 8 walks and remove its time budget
filimonov Nov 27, 2026
fe10941
Remove `CasOperation::freeze` and `Retry::asSingleAttempt`
filimonov Nov 27, 2026
8f22829
Add `CasOwner` to let the owner of CAS work stop it
filimonov Nov 27, 2026
c0c7e9b
Stop CAS requests at their owner's request, keeping the error
filimonov Nov 27, 2026
9426c0b
Stop CAS catalog updates and hot-key submissions at the owner's request
filimonov Nov 27, 2026
c4bea6b
Let stopped callers leave the CAS ref-log queue
filimonov Nov 27, 2026
ec2a7ea
Stop CAS ref-table recovery between failed walks
filimonov Nov 27, 2026
f2a0adf
Stop CAS part writes and blob uploads at the owner's request
filimonov Nov 27, 2026
5338a57
Let server shutdown stop an `Atomic` table's CAS namespace removal
filimonov Nov 27, 2026
3c2396f
Stop CAS GC rounds at the scheduler's or the query's request
filimonov Nov 27, 2026
b2f32fd
Handle a stopped owner in CAS decommission, fsck and pool migration
filimonov Nov 27, 2026
bbb0c41
Describe `Stopped` GC rounds in the `cas_gc_log` column comments
filimonov Nov 27, 2026
e77514d
Test CAS request windows and owner stops through an S3 fault proxy
filimonov Nov 27, 2026
d42bd3d
Document CAS request windows and stopping CAS work
filimonov Nov 27, 2026
989b0f1
Follow dropped metadata through the log in the shutdown drop test
filimonov Nov 27, 2026
cd519b1
Read right before a CAS write that retries a lost race
filimonov Nov 28, 2026
dd66035
Test the probe order and the pause schedule of CAS retries
filimonov Nov 28, 2026
4ac9ee2
Pin both reads that can fail after a stop following a lost CAS race
filimonov Nov 28, 2026
e0780e2
Document the retry order and pause schedule of CAS conflicts
filimonov Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/en/antalya/cas/architecture/blob-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ Ordered steps in `PartWriteTxn::ensureBlobPresent`:
7. `BlobSource::beginPublication` consumes the shared, monotonic `publication_attempted` state
before backend I/O. A lost response cannot re-enable verbatim copy on a later attempt.
8. Retryable or ambiguous failures restart at `HEAD`: up to 8 attempts, each with a fresh envelope.
The engine starts no new attempt after the configured request window (`cas_request_window_ms`,
default 120 s), but an attempt already started can run longer: each creating request waits up to
the disk's `request_timeout_ms`, and multipart part uploads keep their own retries. A write can
therefore take longer than the request window before it fails with a retryable error. No
Each `HEAD` and intent `GET` has its own request window (`cas_request_window_ms`, default 120 s);
the loop has no time limit of its own; 8 attempts are its count. An attempt already started can run longer: each creating
request waits up to the disk's `request_timeout_ms`, and multipart part uploads keep their own
retries. A write can therefore take longer than one request window before it fails with a
retryable error. No
dependency proof is recorded until the body was adopted or the publication completed.

**Reads go to the store.** The `HEAD` is sent after the precommit edge is durable, and the intent
Expand Down
39 changes: 23 additions & 16 deletions docs/en/antalya/cas/architecture/garbage-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ follower or a deferred round execution returns before that commit.
| 15 | `manifest_deletes` | post-`CAS` | Delete manifest bodies whose owner-removal minus-one edge the `CAS` in phase 13 just adopted |
| 16 | `namespace_cleanup` | leader; suppressed on `DEFER` | Pages of the perpetual namespace janitor under a 20 s soft budget, reclaiming dead-life debris |
| 17 | `ref_object_cleanup` | post-`CAS` | Prune ref logs and snapshots once both fold coverage and a live snapshot make them safe to delete |
| 18 | `orphan_sweep` | post-`CAS` | Exact-token deletion for the [orphan-manifest sweep](/antalya/cas/architecture/manifests-and-refs#orphan-sweep), after phase 13 adopted each candidate's blob-source retirements and the cursor |
| 18 | `orphan_sweep` | post-`CAS`, right after phase 15 | Exact-token deletion for the [orphan-manifest sweep](/antalya/cas/architecture/manifests-and-refs#orphan-sweep), after phase 13 adopted each candidate's blob-source retirements and the cursor |

Phases 2 through 4 run on every leader round; a follower returns after phase 1. Phases 5–15 and
17–18 run only when phase 4 decides to fold (phase 9 only when the round does not suppress destruction); phase 16 runs after phase 15 on a fold and right after
phase 4 on a `DEFER`. A `DEFER` verdict is therefore not a bare no-op: it still runs one bounded
17–18 run only when phase 4 decides to fold (phase 9 only when the round does not suppress destruction). On a fold, phase 18 runs
right after phase 15, then phases 16 and 17; on a `DEFER`, phase 16 runs right after phase 4. A `DEFER` verdict is therefore not a bare no-op: it still runs one bounded
namespace-janitor page with `suppress_destructive = true` — listing and classification only, no
deletes and no cursor advance — and then returns, publishing no fold artifact and no commit `CAS`.
Its lease `CAS` may already have created or renewed the lease in phase 1:
Expand Down Expand Up @@ -109,7 +109,7 @@ that object.
- **Runs on:** always — the only phase a `NotALeader` round emits
- **Reads:** `gc/state`; `gc/hb` (only when another GC owns the lease)
- **Writes / deletes:** one successful `CAS` on `gc/state` (acquire, renew or steal); a conflict is
re-observed and re-decided by the request engine within the configured request window (`cas_request_window_ms`, default 120 s); no
re-observed and re-decided by the request engine, at most 100 times, each request within its own window (`cas_request_window_ms`, default 120 s); no
deletes
- **Safety:** the lease is *work de-duplication, not mutual exclusion* — see below
- **Fails the round if:** this `Gc` instance saw `gc/state` before and it has since disappeared, or
Expand Down Expand Up @@ -186,9 +186,8 @@ evidence from the fold running now.
- **Retry order:** when an erase is refused because the catalog changed, the drain pauses first
(full-jitter backoff, growing to 5 s), then re-reads the catalog, then sends the next erase against
that fresh read. A catalog write that lands during the pause therefore cannot refuse the next erase.
A permanently contended catalog ends the drain with `NETWORK_ERROR` at the request deadline or after
100 erase attempts on one row, whichever comes first; the deadline is one frozen window shared by
every attempt on that row.
A permanently contended catalog ends the drain with `NETWORK_ERROR` after
100 erases on one row, with no pause after the last. Each erase request has its own window.
- **Observability:** phase row `pre_fold_ref_drain`; metric `deleted` (erases the store acknowledged,
counted before the resolution read so a drain that throws still reports them, plus erases a
resolution read proved); metric `cancelled_creating` (the `Creating` rows the drain cancelled;
Expand Down Expand Up @@ -625,10 +624,13 @@ role as the coverage record.
### Post-commit failures {#post-commit-failures}

After a `Committed` result the round is committed — an exception in phases 14–18 does not un-commit
it. Those phases tolerate the object outcomes they name (`NotFound`, `TokenMismatch`), but only
phase 16 is wrapped in a catch-all; a backend or decode exception in phases 14, 15, 17 or 18
propagates, and `system.cas_gc_log` then records an `Aborted` or `Error` finish (see
[round outcomes](#round-outcomes)) for a round whose new `gc/state` is already durable. Read such a
it. Those phases tolerate the object outcomes they name (`NotFound`, `TokenMismatch`). Phase 16 logs
any other failure and goes on, unless the round was asked to stop. A backend or decode exception in
phases 14, 15, 17 or 18 propagates. Phase 18 runs before phases 16 and 17, so its exception also skips
them for that round. A propagated exception makes `system.cas_gc_log` record an
`Aborted`, `Stopped` or `Error` finish (see
[round outcomes](#round-outcomes)) for a round whose new `gc/state` is already durable. A manual round
whose query is killed or timed out in these phases is recorded as `Stopped`. Read such a
row as "committed round, failed tail": the next round starts from the committed state, and what
the tail did not delete is picked up later — by the orphan sweep for phase 15's leftovers, by
phase 17's recomputed plan, and for phase 18 only once the sweep cursor (already advanced by phase
Expand Down Expand Up @@ -702,8 +704,9 @@ nothing ends the pass. A pool without debris costs one `LIST` per round.
page and checked again before the cursor is published; the incarnation segment in every key makes an old life's objects structurally
unreachable from a reborn same-name namespace, so a missed key can only leak storage, never expose
it
- **Fails the round if:** nothing — the whole phase is wrapped in a catch-all ("namespace janitor
stopped this round"). A failed batch `DELETE` leaks its keys and the cursor still advances. A failed
- **Fails the round if:** the round was asked to stop and a request of the phase fails or leaves its
cursor write's outcome unknown. Any other failure is logged ("namespace janitor stopped this round")
and the round goes on. A failed batch `DELETE` leaks its keys and the cursor still advances. A failed
`LIST` resets the cursor to the stream start only on the first page of the phase; on a later page
the cursor the previous page published stays
- **Observability:** phase row `namespace_cleanup`; metrics `janitor_pages`, `janitor_keys`,
Expand Down Expand Up @@ -761,7 +764,8 @@ from the catalog.

## Phase 18 — orphan sweep {#phase-18-orphan-sweep}

The last phase: executes the [orphan-manifest sweep](/antalya/cas/architecture/manifests-and-refs#orphan-sweep)
Runs right after phase 15, before the janitor and the ref object cleanup, because the committed cursor
has already moved past its nominations. Executes the [orphan-manifest sweep](/antalya/cas/architecture/manifests-and-refs#orphan-sweep)
planned in phase 10 and adopted by phase 13's `CAS`. Planning runs only when the schedule requests
it and the destructive gate permits it. The default wait before starting another traversal is
one hour, subject to the clock-skew rule below. Successful pages of an active traversal continue
Expand Down Expand Up @@ -1296,8 +1300,11 @@ A `Finish` row of `system.cas_gc_log` carries one of: `Success` (folded and comm
(phase 4 chose not to fold), `NotALeader` (returned after phase 1), `Aborted` (the round threw a
*transient* error — `S3_ERROR`, `NETWORK_ERROR`, `TIMEOUT_EXCEEDED`, `SOCKET_TIMEOUT`, `ABORTED`,
`MEMORY_LIMIT_EXCEEDED` — and this `Gc` keeps its leadership and heartbeat, so the next round simply
retries), `Stopped` (a transient error while the disk was being torn down), or `Error` (any other
error code, notably `CORRUPTED_DATA` and `LOGICAL_ERROR`; leadership is dropped). The `error_code`
retries), `Stopped` (the round was stopped: a manual round whose query was killed or timed out ended
with `QUERY_WAS_CANCELLED` or a transient error, or a round ended with a transient error after the disk
began tearing down or after it saw `SYSTEM CAS GC STOP`), or `Error` (any other
error code, notably `CORRUPTED_DATA` and `LOGICAL_ERROR`; leadership is dropped). A `Stopped` round
may already have committed its `gc/state`: see [post-commit failures](#post-commit-failures). The `error_code`
column carries the code on `Aborted`, `Stopped` and `Error` and is `0` otherwise; every
unrecognised code is `Error` by omission, never silently transient.

Expand Down
Loading