Repository navigation
Cherry pick #113322 to 26.5: fs cache download wait timeout - #113819
Merged
robot-ch-test-poll3 merged 10 commits intoAug 7, 2026
Merged
Conversation
…timeout A read which needs a file segment in `DOWNLOADING` state waited for the downloader indefinitely: `FileSegment::wait` has a 60 s deadline, but the caller looped and waited again. The downloader role is held by another query for as long as it is reading the segment, so a fast point read could stall behind an arbitrarily slow foreign query downloading the same segment. Add the setting `filesystem_cache_wait_for_concurrent_download_timeout_milliseconds` (default 1 second). When the timeout is reached, the read bypasses the cache for that range and reads directly from remote storage, while the concurrent download continues to fill the cache. Value `0` means bypass immediately. The new profile event `CachedReadBufferDownloadWaitTimeouts` counts such bypasses, and the new pauseable failpoint `file_segment_pause_before_write` allows reproducing the stall in tests. Co-Authored-By: Claude Fable 5 <[email protected]>
…aller Rename the profile event `CachedReadBufferDownloadWaitTimeouts` to `FileSegmentWaitTimeouts` and increment it inside `FileSegment::wait` when the wait deadline expires. The cached read buffer no longer tracks a deadline of its own: `wait` returning a state which is still `DOWNLOADING` without usable progress is the timeout signal, so the `DOWNLOADING` branch just bypasses the cache in that case and continues otherwise. Co-Authored-By: Claude Fable 5 <[email protected]>
The one-time pause failpoint must be consumed by the downloader query, but two other writers could take it first and let the downloader run unimpeded, leaving the waiter with nothing to wait on (the flaky check failed with `0` instead of `1` in the profile event check): - the mark-cache warmup query ran with default prefetch settings, and its abandoned prefetch tasks could still write to the cache from reader-pool threads after the client had already returned; - background download of partially downloaded segments could leak cache writes into the next iteration of the flaky check. Make the warmup query strictly synchronous, disable background download in all three queries, and assert that exactly one file segment is DOWNLOADING after the failpoint pause, so a stray consumer fails the test explicitly instead of making it vacuous. Failed CI: https://github.com/ClickHouse/ClickHouse/actions/runs/30908188704/job/92013126246 Related PR: #113322 Co-Authored-By: Claude Fable 5 <[email protected]>
The flaky check showed the test is not isolated from server background activity: a background merge of `test.hits_s3` writes through the shared `s3_cache` and can fill it with non-releasable segments. The downloader's space reservation then fails, so it silently continues without caching and never reaches the failpoint, while the merge consumes the one-time pause instead (`FileSegmentWaitTimeouts` stayed `0` and the `DOWNLOADING` count saw the merge's segment). Rework the test to not depend on the shared cache at all: - the table uses a private inline cache disk over `local_disk`, so no other cache user can fail its reservations, and `max_file_segment_size` covers the whole data file so the waiter never becomes a downloader itself; - the failpoint is `PAUSEABLE` instead of `PAUSEABLE_ONCE`: every cache write pauses while it is enabled, so an unrelated writer cannot steal it (it just pauses too and resumes on disable); - after `SYSTEM WAIT FAILPOINT` the test additionally polls until the private cache holds exactly one `DOWNLOADING` segment, since the first pause on the server is not necessarily the downloader's. Verified locally: 25 consecutive runs pass with a concurrent workload inserting into and merging a cache-on-write table on the shared `s3_cache`. Failed CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113322&sha=c5f7fd81a5824409956120442597006de4a5935a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29 Related PR: #113322 Co-Authored-By: Claude Fable 5 <[email protected]>
`file_segment_pause_before_write` is a server-global `PAUSEABLE` failpoint, so a script that aborts between `SYSTEM ENABLE FAILPOINT` and the explicit disable at the end left every filesystem cache write on the server paused: the following tests would hang behind it and mask the original failure. Add a `trap` right after enabling the failpoint that always disables it, ignoring cleanup errors. Addresses #113322 (comment) Co-Authored-By: Claude Opus 5 <[email protected]>
…eout fs cache download wait timeout
Member
|
Resolved the conflicts (merged the base Common to all cherry-picks of #113322
Specific to 26.5
Not built locally; relying on CI for the backport PR. |
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.
Original pull-request #113322
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job