Repository navigation
Remove flaky test_under_max_waiting_queries_limit test - #97722
Merged
alexey-milovidov merged 1 commit intoFeb 23, 2026
Merged
Conversation
The test has a race condition: with `max_concurrent_queries=1`, `max_waiting_queries=6`, and 7 threads, the queue is at its exact boundary. Since `ResourceRequest::finish` is asynchronous, there is a window between a query finishing and the scheduler dequeuing the next waiting request, causing sporadic `SERVER_OVERLOADED` exceptions. Reference: #97671 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Member
Author
|
Temporary, until fixed. |
alexey-milovidov
deleted the
remove-test-under-max-waiting-queries-limit
branch
February 23, 2026 14:52
Merged
1 task done
feiyunwill
pushed a commit
to feiyunwill/ClickHouse
that referenced
this pull request
Oct 20, 2026
This is the half that was missing: `max_waiting_queries` had a limit, storage for it and a handler interface, but no production `makeLoadJob` call site ever passed `on_waiters_increment` / `on_waiters_decrement`, so the waiting count was always zero and no query was ever refused. The only caller of the waiter-carrying overloads in the whole tree was a unit test. Two shared handlers resolve the waiting query from thread-local state, which is what lets a single pair be reused by every call site. They account for nothing when the blocking thread is not a query the concurrency counters cover: server or `clickhouse-local` startup, an AsyncLoader worker, or an internal query. The resolver is deliberately `tryGetQueryContext()` + `getProcessListElementSafe()`; the original code used the throwing variants and would have dereferenced null on every one of those threads. All seven sites are genuinely query-waitable: table load and startup are reached through `waitTableStarted()` on table resolution, the three database startup jobs through `waitDatabaseStarted()` from DDL, and the DDL worker job through `Context::getDDLWorker()` from any `ON CLUSTER` query. The integration test pins a `Replicated` database's startup job on an existing pause fail point, so the set of waiting queries is fully determined rather than sitting on a queue boundary that races an asynchronous release, which is what made an earlier test for the workload setting of the same name unstable (ClickHouse#97722). Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Summary
test_under_max_waiting_queries_limitfromtest_scheduler_queryintegration tests due to an inherent race condition at the queue boundaryThe test has a race condition: with
max_concurrent_queries=1,max_waiting_queries=6, and 7 threads, the queue is at its exact boundary. SinceResourceRequest::finishis asynchronous, there is a window between a query finishing and the scheduler dequeuing the next waiting request, causing sporadicSERVER_OVERLOADEDexceptions.Reference: #97671
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Version info
26.2.1.1085