Repository navigation
Conversation
The test verifies that PK analysis stats correctly account for granules that the QueryConditionCache already dropped before PK analysis runs. The docstring at the top of the test shows the expected log lines: the QCC drops granules for the PREWHERE condition first, then PK analysis runs on the remaining marks. Without explicit pins, the test runner's random-settings injection can flip `optimize_move_to_prewhere` and/or `query_plan_optimize_prewhere` off, which moves the QCC drop from the PREWHERE-side hash to the WHERE-side hash. The assertion still holds in that path (the WHERE-side QCC drop also runs before PK analysis), but the test then exercises a different code path than the regression comment describes, which has been a recurring source of confusion when the test fails on unrelated PRs (the random-settings diagnoser narrows the culprit to a single session setting that is not actually causal). Pin both prewhere settings to keep the test exercising the documented PREWHERE QCC code path. SETs inside the SQL override the CLI flags injected by the runner. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104225&sha=ef78dcecf6d3c6a1ccad2481e090794460e778cb&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
|
Pre-PR validation gate self-check (worker session: a) Deterministic repro? Yes for the FAILURE: PR #104225 commit b) Root cause explained? Yes — two layers:
c) Fix matches root cause? Yes for Layer 2. Pinning d) Test intent preserved? Yes — the assertion is unchanged; the test still verifies that PK analysis stats correctly account for granules already dropped by the QCC. Pinning prewhere does not weaken any assertion; it just removes a source of test/code-path drift that has historically misled triage. e) Both directions demonstrated? Yes. With the pin (this PR's change) on a fresh debug build:
f) Fix is general? This is a test-stability change rather than a real bug fix, so the "search for sibling defects" criterion is N/A. There are no other tests with the same |
|
cc @nickitat — could you take a look? You authored 04051_pk_analysis_stats and are the most active QueryConditionCache contributor; this is a small defensive pin to keep the test on the documented PREWHERE QCC drop path so random-settings noise stops misleading triage. Per @alexey-milovidov's directive on #103857. |
|
Workflow [PR], commit [63e5e0d] Summary: ✅ AI ReviewSummaryThis PR pins ClickHouse Rules
Final VerdictStatus: ✅ Approve |
The test
04051_pk_analysis_statsverifies that PK analysis stats correctly account for granules already dropped by theQueryConditionCache(QCC). The docstring at the top of the test references a specific log-line example where the QCC drops granules for thePREWHEREcondition first and PK analysis then runs on the remaining marks.Without explicit pins, the test runner's
--random-settingsinjection can flipoptimize_move_to_prewhereand/orquery_plan_optimize_prewhereoff. The QCC's verdict then ends up keyed by theWHERE-side hash instead of thePREWHERE-side hash documented in the comment block, exercising a different code path on every run.The assertion
ProfileEvents['FilteringMarksWithPrimaryKeyProcessedMarks'] < total_marksstill holds in either path (both sides drop marks before PK analysis runs inMergeTreeDataSelectExecutor::filterPartsByQueryConditionCache). But this variability has been a recurring source of confusion: when an unrelated PR's CI surfaces a transient or PR-caused failure for this test,--diagnose-random-settingsminimizes the culprit set down to a single non-causal session setting (e.g.--session_timezone), and the failure then gets misattributed to settings that have no semantic relationship with the test.Pin both prewhere settings inside the SQL so the test always exercises the documented
PREWHEREQCC drop path. SETs inside the test SQL override the CLI flags injected by the runner, so this is robust against any future random-settings expansion that touches prewhere.Verified locally on a debug build:
--random-settingsrandomisation.-j 4 --test-runs 100.--use_query_condition_cache 0 --optimize_move_to_prewhere False --query_plan_optimize_prewhere False --session_timezone America/Mazatlan --enable_multiple_prewhere_read_steps 0 --max_threads 1 --max_block_size 17886).CI report that motivated the fix: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104225&sha=ef78dcecf6d3c6a1ccad2481e090794460e778cb&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
Related: #103857 (comment) (
@alexey-milovidovdirective to fix this test in a separate PR).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.5.1.406