Skip to content

Remove flaky test_under_max_waiting_queries_limit test - #97722

Merged
alexey-milovidov merged 1 commit into
masterfrom
remove-test-under-max-waiting-queries-limit
Feb 23, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
remove-test-under-max-waiting-queries-limit

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Remove test_under_max_waiting_queries_limit from test_scheduler_query integration tests due to an inherent race condition at the queue boundary

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

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

🤖 Generated with Claude Code

Version info

  • Merged into: 26.2.1.1085

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]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b8de4b9]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Feb 23, 2026
@alexey-milovidov alexey-milovidov self-assigned this Feb 23, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Temporary, until fixed.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Feb 23, 2026
Merged via the queue into master with commit 6f5ea4d Feb 23, 2026
144 checks passed
@alexey-milovidov
alexey-milovidov deleted the remove-test-under-max-waiting-queries-limit branch February 23, 2026 14:52
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 23, 2026
@serxa serxa added the post-approved Approved, but after the PR is merged. label Mar 13, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

post-approved Approved, but after the PR is merged. pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants