Repository navigation
Fix flaky test 05401_quota_on_profile_events_query_result_cache with parallel replicas - #129672
Conversation
…parallel replicas The ParallelReplicas CI job enables parallel replicas in the server `default` profile, which the test's SQL-created quota user inherits. When the coordinator hands the table's only mark to a remote replica, that replica's interpreter reports `SelectQuery = 1` back, and remote `ProfileEvents` are charged to the initiating user (the designed behaviour of ClickHouse#117004, asserted by the `remote()` quota tests). The populating query then costs `SelectQuery = 2` against `MAX SelectQuery = 1`, the next cache hit is rejected, and the reference shifts; with `optimize_trivial_count_query = 0` the `count()` fans out the same way. Pin `enable_parallel_replicas = 0` on the two `MergeTree` reads of the quota user. The `.reference` is unchanged. Locally, with the job's server config emulated: unchanged test 10/10 red with `parallel_replicas_local_plan = 0`, 13/50 with `= 1`, 18/20 with `optimize_trivial_count_query = 0`; fixed test 10/10, 50/50, 20/20 green, plus 50/50 randomized without parallel replicas. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold review (0 blocker/major).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261106-034600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261106-032500 |
|
cc @pufit, could you review this and add the |
|
Workflow [PR], commit [6db074e] Summary: ✅ AI ReviewSummaryThis test-only change disables parallel replicas on the quota user's two Final VerdictStatus: ✅ Approve |
CI finish ledger - cee5e91Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no Session id: cron:our-pr-ci-monitor:20261106-060004 |
Related: #117004
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky test
05401_quota_on_profile_events_query_result_cache: the reads of its quota user no longer use parallel replicas.Description
The test (added in #117004) fails only in the
ParallelReplicasjob, 3 of 26 runs in 30 days:2 0instead of1 0after populating the cache, thenSelectQuery = 2/1 (QUOTA_EXCEEDED)on the cache hit, or4 1instead of2 1aftercount().Root cause: that job enables parallel replicas in the server
defaultprofile, which the test's SQL-created user inherits. When the coordinator gives the table's only mark to a remote replica, that replica's interpreter reportsSelectQuery = 1back, and remoteProfileEventsare charged to the initiating user by design (theremote()quota tests assert this). So the populating query costs 2 againstMAX SelectQuery = 1. Whether a remote replica reads is a race.Change: the two
MergeTreereads of the quota user (the cached query and thecount()) setenable_parallel_replicas = 0. The.referenceis unchanged.Validation on a master binary with the job's server config emulated locally: with
parallel_replicas_local_plan = 0the unchanged test failed 10/10 with the CI output; with the job'sparallel_replicas_local_plan = 1it failed 13/50, and 18/20 withoptimize_trivial_count_query = 0. The fixed test passed 10/10, 50/50 and 20/20 in the same runs, with no secondary query of the quota user inquery_log, and 50/50 randomized without parallel replicas. The other 21 tests of the profile-event quota family passed 20/20 each in the same setup, so they are left as is.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129672]
Version info
26.11.1.1520-master(included in26.11and later)