Repository navigation
Conversation
Each request binds `cas_request_window_ms` when it is sent; requests share no deadline. `Retry::bind` takes the smallest of the window, an outside cap (a tool's own deadline) and the lease, and records which one won in `Retry::Bound::Source`. Decision loops end after `kCasMaxDecisions` (100) with `GaveUp::Why::Attempts`; a fence or lease lost during the last request is reported instead of the count. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hot-key lane, catalog updates and erases, namespace life and drop, the blob publication loop and the copy-source confirm poll no longer freeze one deadline for the whole loop. Each request binds its own window. The loops end at count caps (100 decisions or submissions, 8 blob publications); the confirm poll's deadline only decides whether another pass starts. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`recovery_retry_budget_ms` is removed. The walk that fails at `kCasMaxRecoveryWalks` rethrows its own error; a restart at the cap fails as "did not converge". Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No loop freezes a deadline any more. A tool's own deadline stays an outside cap through `Retry::cappedAt`. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner is the query or a background owner (`OwnerScope::background`). `OwnerScope::owed` marks work owed to a possibly-sent write or a failed commit; `OwnerScope::shared` marks work done for several callers. `CasOwner.h` lists where work may end and the facts that classify a failure. Adds the killable-query test fixture. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A query's stop is consulted only after a failed attempt: it vetoes the retry, and the call ends with that attempt's error. A write attempt is classified first, then the loop picks its next step; a sent write that stays unresolved ends as `NETWORK_ERROR` (210). Local faults surface unchanged, and a stopped owner's exception is no store answer in the backend or the sentinel probe. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A catalog step decides its exit before the submission cap and the pause, by one rule. A write that saw its query stop starts no further discretionary request. An earlier unresolved write is reported at every non-commit exit, also from the catalog erase. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stopped follower withdraws its queued item, or waits for its result once a leader carved it. A leader checks its owner before each flush and withdraws its own pending item. An exceptional erase notifies waiters; a shared failure is rethrown as each thread's own copy. The leader flushes in its caller's thread group under `OwnerScope::shared`: CAS's owner checks do not reach shared work, but the S3 client still reports an unsuccessful answer as a killed leader's stop. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a walk that threw lets a stopped owner end recovery; the walk itself is owed. A sent stamp or tombstone that stays unresolved keeps its retry-later exit after a stop, and a query stop confirms real corruption before ending recovery. The backoff sleeps in slices, and a stopped background owner leaves the wait for another caller's recovery. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stop before a blob publication ends the upload with the previous publication's error; a stopped owner's failure is not retried, and a landed body stays debris. A refused precommit owes no cleanup of its own and keeps an earlier call's duty. The commit compensation and the rename undo are owed. Upload workers check they run in the submitter's thread group. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the catalog's drop worker removes an `Atomic` table directory without a query, and it retries after a restart, so shutdown may stop it. The removal lane stays closed after any sent removal write, and its reopen proof is owed. Waits for the lane and for writer cleanup duties use `waitStoppable`. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A round stopped by `SYSTEM CAS GC STOP` or by its query is recorded as `Stopped`. A manual round checks its query at scan heads, and its read-ahead and delete workers run in the round's thread group. Committed orphan nominations are deleted before the janitor runs, and the post-commit phases are one owed scope. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The decommission drain checks a killed query per page of the manifest listing and per key. `runBounded` workers check their thread group before any request. Catches in the tools leave a query's stored exception unannotated. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`s3_fault_proxy.py` moves to `helpers/s3_mocks` and can hold a request until the test releases it. `test_cas_request_window` covers per-request windows, kills and query timeouts end to end. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
filimonov
force-pushed
the
work/antalya-26.8/cas-request-window
branch
from
November 27, 2026 07:08
5f79613 to
d42bd3d
Compare
`test_shutdown_hands_atomic_drop_to_restart` listed the local
`metadata_dropped` directory. On the "db disk" lanes the database disk is
remote, the directory is empty, and the test failed although the server
stopped the removal as expected ("Cannot drop table ... Will retry later:
... CAS table namespace removal stopped by server shutdown"). The test now
checks that `DatabaseCatalog` logs no removal of the table's metadata
before the exit and logs it after the restart.
https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=2970&sha=d42bd3d271cdf293f9fec5bf61bfe4ea079ff6fc&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%208%2F8%29
#2970
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
filimonov
added a commit
to filimonov/ClickHouse
that referenced
this pull request
Nov 27, 2026
37 new tasks (CAS-539 to CAS-575) and notes on 35 existing ones. - CAS-540, CAS-541: studies of a ref catalog per server root and of group commit in the hot-key lane. - CAS-542 to CAS-571: findings of the review rounds of Altinity#2970 that are not fixed in it, the upstream changes it depends on (CAS-565 to CAS-570) and one measurement task. CAS-543 is closed: the flush thread group it describes was removed from the PR. - CAS-572, CAS-573: blob uploads ignore the remote write throttle; a slow uplink with many parallel blob streams. - CAS-574, CAS-575: soak scenarios S13 and S47 fail on their own limits. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
filimonov
added a commit
to filimonov/ClickHouse
that referenced
this pull request
Nov 27, 2026
`move_factor` 0.1 moved every part off `local1` right after its insert on a host whose disk is 96% full, and S37 failed its routing check. Free-space moves are not under test there; `move_factor` is now 0. `RUN_HISTORY.md` and the scenarios' `BACKLOG.md` get the rows of the 2026-11-27 run of all scenarios on the build of Altinity#2970. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
5 of 31 tasks
After a conditional write lost a race, the engine read the object, paused, and then wrote on the body it had read before the pause. With other writers committing more often than once per pause every retry was refused: a `CREATE TABLE ... ON CLUSTER` lost 100 submissions of the ref catalog in 11 s and failed with "did not converge after 100 submissions". A read and the write conditioned on it are now one probe with nothing between them; pauses come only between probes: - a write from the cached catalog that loses is decided again at once on the read that settled it; - a write decided on a fresh read that loses is followed by a pause, a new read and a write. A clean 412 on that path is no longer settled by a read of its own, and a submission after a pause never starts from the cache; - the pause after the n-th consecutive clean loss is min(750 ms, 40 ms * (n - 1)) plus up to a quarter: the first retry comes at once. A conflict that settled a transport fault keeps the fault schedule and restarts the count; - `readModifyWrite` and `readModifyWriteOnPresence` share one loop; - the catalog erase loop refreshes GC authority before its catalog read on a retry, and `resolveNamespaceLife` paces by its collisions. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stopped query whose catalog write lost a race ends at the next failed read. On the cached path that read settles the refused write and the query ends with its conflict; on the fresh path it is the read before the next attempt and the query ends with its own stop. The test runs both in a fixed order; no further `PUT` follows in either. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every CAS metadata request now binds its own window (
cas_request_window_ms), loops above the request engine end on a count, the owner of CAS work can stop it, and a retry after a lost conditional write reads right before it writes. Before, several requests of one operation shared one deadline, so a slow first request left the later ones no time, andKILL QUERY,max_execution_time,SYSTEM CAS GC STOPand server shutdown did not reach CAS retry loops.Changes
CasOperation::freeze,Retry::asSingleAttemptand the recovery time budget are removed; the offline tools keep one outside cap.readModifyWriteandreadModifyWriteOnPresenceshare one loop. The catalog erase loop refreshes GC authority before its catalog read on a retry.MergeTreeTransactionrollback, temporary-table drop) behave as on a plain S3 disk. A vetoed retry ends with the failed attempt's own exception. Background owners (GC scheduler stop, shutdown removal of anAtomictable's namespace, pool teardown) are checked at more points and end withABORTED.NETWORK_ERROR"outcome unresolved", and later steps of the same call cannot replace that.writeLoopclassifies one attempt first and then chooses the next step; a catalog update decides how a step ended before it looks at the submission cap.DROPwhoseLive -> Removingwrite was sent and then failed, the table stays closed for writes until theDROPis retried. A refused insert leaves no cleanup duty behind.Risks / notes
docs/en/antalya/cas/configuration.md#contention-boundstates the bound. Whether 100 is the right count for pools with tens of members is open; it is one constant (kCasMaxDecisions).ContentAddressedGarbageCollectionLog.cpp. Two things that need shared code are left out on purpose: a cancellation mask for finalizers (the S3 client still replaces an expected 404 or 412 with a killed query's exception, as before this change), and an explicit "this removal is retried" signal from the catalog's drop worker (inferred today from the path shape and the absent query context intableRemovalResumesAfterRestart).cas_alter_attach_3andcas_s3_cache_alter_attach_3failed once on a branch built on an earlier head (CAS: pace part uploads and stop them on KILL QUERY #2974) with "CAS ref catalog update: did not converge after 100 submissions": aCREATE TABLE ... ON CLUSTERlost 100 catalog writes in 11 s while other replicas were erasing rows. The read-pause-write order is older than this change; the shared deadline (about a thousand attempts in 120 s) used to outlast such a burst. Commits 18 to 21 fix the order. The CI scenario itself (parallel DDL on three replicas, a 1 MB catalog) was not reproduced locally.ABORTED"conflict" when that write was decided on the cached catalog and with the query's own stop otherwise. No further write follows in either case.CasRequestsand are not built one by one.ALTER/ATTACH PARTITIONtimings.Testing
CAS*:ReadBufferFromS3SessionRelease*:S3BulkDeleteFallback*:ReadBufferFromFileView*on this exact tree: release 5491 passed; ASan 5491 passed, 3 skipped, no sanitizer reports.tests/integration/test_cas_request_window(21 tests, S3 fault proxy): 21 passed on the release server in the default lane and in the "db disk" lane.05023_query_thread_log_progress_per_queryon the CAS storage lane: passed. An earlier head ran the shared flush in a separate thread group; each flush then wrote asystem.query_thread_logrow and this test failed, so the group is removed.WRWPRW: write, read, write, pause, read, write) against a rival that commits during every pause; they fail on the old order with "did not converge after 100 submissions".Existing tests that change meaning
CASPoolMeta.AdmitOrValidateEndsAtTheDeadlineUnderPerpetualConflictCASRequests.ReadModifyWriteLosesNoIncrementUnderContentionAndBoundsAHotKey(second half)CASRefCatalog.CasUpdateEndsAtTheDeadlineNotAfterAHundredUnsleptIterationsCASRefCatalog.CreateNamespaceStep1DoesNotPausePastItsDeadlineCASRefCatalogRemoval.PerpetualConflictGivesUpWithinOneWindowNotAtTheAttemptCapCASRefCatalogRemoval.AWriterLandingDuringEveryBackoffCannotStarveTheErase(second half)CASCatalogLifecycleReconciler.AnAuthorityReadFailingInTheCatalogLaneEndsByTheCancelDeadlineCASRefCatalogBirthWiring.APerpetuallyChurningCatalogEntryIsPacedAndEndsWithinOneWindowCASRefWriterNamespaceRemoval.DropWithASlowCreatorFenceReadEndsAtTheEntryDeadlineCASRefWriterNamespaceRemoval.DropSpendsOneWindowAcrossItsReads,.DropSpendsOneWindowAcrossItsCatalogUpdateCASRefWriterNamespaceRemoval.AWaitLongerThanTheWindowEndsTheDropAndLeavesTheLaneOpenCASPartWrite.EnsureBlobPresentIsBoundedByTheOneWindowItCapturedCASConfirmExactRef.CopyConfirmStopsRetryingTheSlotReadAtTheCallersDeadlineCASConfirmExactRef.CopyConfirmRefusesAtItsDeadlineWhileAMutationNamingTheSourceStaysQueuedCASRefWriterRecoveryRetry.TransientFailureLongerThanBudgetPropagatesCASContentAddressedSettings.RequestWindowSettingSetsTheWindowAndTwiceTheRecoveryBudgetCASRetry.AFrozenPolicyIsOneDeadlineAndTheLeaseStillWins, the three-plane pool testChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Content-addressed storage: each metadata request has its own
cas_request_window_mswindow and retry loops end on a count, so one slow request no longer takes the time of the next.KILL QUERY,max_execution_time,SYSTEM CAS GC STOPand server shutdown now end CAS retries: a killed query stops at the next failed request instead of retrying for the whole window. A retry after a lost conditional write reads the object right before it writes, so concurrent DDL on several replicas of one pool no longer starves a catalog update.Documentation entry for user-facing changes
docs/en/antalya/cas/configuration.md(request window, contention bound and the pause schedule),docs/en/antalya/cas/operations/troubleshooting.md(stopping CAS work, aDROPthat failed after its removal write),docs/en/antalya/cas/architecture/garbage-collection.md,docs/en/operations/system-tables/cas_gc_log.md.CI/CD Options
Exclude tests:
Regression jobs to run: