Skip to content

Disable the query condition cache in 03634_autopr_input_bytes_estimation - #131690

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-fix-03634-autopr-input-bytes-qcc
Nov 15, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-fix-03634-autopr-input-bytes-qcc

Conversation

@groeneai

@groeneai groeneai commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #131576

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):

...

Description

03634_autopr_input_bytes_estimation fails in the new Stateless tests (arm_asan_ubsan, azure, targeted) job (added by #131576), always on query_23, just past the 2x bound: +query_23 12159905 6013142 (report), +query_23 12536795 6252459 (report). True master: 0 failures.

Root cause: that job is the first to repeat this stateful test on one server with fixed settings (--no-random-settings, 50 runs). query_23 (... WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10) is a TopK read, and with the default use_query_condition_cache = 1 every run stores the granules the TopK filter dropped, so the next run starts from them. The selection shrinks run over run (CI: 383, 26, 16, 9 marks), ReadCompressedBytes falls more slowly than the estimate, and the ratio crosses 2 once it converges. Randomized jobs never converge because the QCC and TopK settings change per run.

Change: SET use_query_condition_cache=0; test-wide, the same pin as the sibling tests 03801_autopr_input_bytes_estimation_query_with_subqueries and 04102_autopr_input_bytes_estimation_query_with_ctes. The autopr decision on reads narrowed by the query condition cache stays covered by 03783_autopr_dataflow_cache_reuse_qcc.

Validation (master debug build, test.hits from create.sql, the job's runner flags): unpatched, with CI's max_threads (32), 10 repeated runs go red from run 4-5 (8-9 marks, ratio 2.02-2.04); patched, 10/10 OK with a constant 1084 marks for query_23 (max ratio 1.36 over all queries), plus 50/50 randomized runs.


Workflow [PR]
Sync PR [sync-upstream/pr/131690]

Version info

  • Merged into: 26.11.1.2334-master (included in 26.11 and later)

The new `Stateless tests (arm_asan_ubsan, azure, targeted)` job (ClickHouse#131576)
runs the test 50 times on one server with fixed settings. `query_23`
(`... WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10`) is a TopK
read: with the default `use_query_condition_cache = 1` every run stores
the granules the TopK filter dropped, and the next run starts from them.
The selection shrinks run over run (CI: 383, 26, 16, 9 marks),
`ReadCompressedBytes` falls more slowly than the estimate, and the ratio
crosses the test's 2x bound once it converges (2.005x / 2.022x on ClickHouse#109377
and ClickHouse#129198). Randomized jobs never converge because the cache and TopK
settings are re-drawn per run.

Pin `use_query_condition_cache=0` test-wide, as the sibling estimation
tests 03801 and 04102 already do; the cache with autopr stays covered by
03783_autopr_dataflow_cache_reuse_qcc.

Locally, unpatched at CI's thread count: red from run 4-5 (8-9 marks,
2.02-2.04x); patched: 10/10 with a constant 1084 marks, and 50/50 with
random settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus an independent cold review of the diff (0 blocker, 0 major).

Checked: the trigger (ci/jobs/functional_tests.py: the azure targeted job runs the test 50 times with --no-random-settings), the defaults (use_query_condition_cache and use_query_condition_cache_for_top_k are on), the sibling pins (03801, 04102), and the other AutoPR estimation tests over test.hits without the pin (03634_autopr_output_bytes_estimation checks output bytes, 03927 has no TopK read; both green in the azure targeted job).

Session id: cron:clickhouse-review-slot-8:20261114-214601

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Unpatched test, the job's runner flags (--no-random-settings --no-random-merge-tree-settings --flaky-check --no-self-parallel, 10 runs on one server, fresh query condition cache) at CI's max_threads (32): red from run 4-5 in 2 of 2 replicates with +query_23 11994575 5887595 / +query_23 12846196 6371230, the CI signature.
b Root cause explained? query_23 is a TopK read; with the default use_query_condition_cache = 1 each run stores the granules the TopK filter dropped and the next run starts from them. Marks fall run over run (local: 384, 40, 19, 14, 9, 8; CI: 383, 26, 16, 9), ReadCompressedBytes falls more slowly than the estimate, and the ratio crosses 2.
c Fix matches root cause? Yes. SET use_query_condition_cache=0; removes the cross-run cache state; no bound widened, no tag, no data change. Same pin as 03801_autopr_input_bytes_estimation_query_with_subqueries and 04102_autopr_input_bytes_estimation_query_with_ctes.
d Test intent preserved / new tests added? Yes. Every query still checks the estimate at 2x, now on a full read that does not depend on earlier runs. Query condition cache with autopr stays covered by 03783_autopr_dataflow_cache_reuse_qcc. Test-only fix.
e Both directions demonstrated? Unpatched: 6/10 and 7/10 FAIL. Patched: 10/10 OK at 32 threads, 10/10 OK as shipped (query_23 reads a constant 1084 marks, max ratio over all queries 1.36), 50/50 OK with random settings.
f Fix is general across code paths? N/A (test fix). The other estimation tests over test.hits that repeat TopK reads already pin the same setting.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test fix). The randomized 50 runs covered 50 block sizes, 6 TopK limits and 6 time zones; the pin held on all 550 queries.
h Backward compatible? (maintainer-approved exception only) N/A: test-only change.
i Invariants and contracts preserved? N/A: no source change; the empty reference and the per-run database are unchanged.

Session id: cron:clickhouse-impl-slot-41:20261114-210500

@clickhouse-gh

clickhouse-gh Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f99de9a]

Summary: ✅


AI Review

Summary

PR #131690, at f99de9a06ba0, disables use_query_condition_cache in 03634_autopr_input_bytes_estimation to prevent repeated runs from progressively narrowing reads and destabilizing the compressed-byte comparison. The existing two-times accuracy bound remains intact. The reported before/after repetitions support this focused test fix. No actionable findings.

Missing context / blind spots
  • ⚠️ The current targeted CI report has no test results available yet, and I did not rerun the test locally. Validation relies on the author's reported repeated runs and the original CI failure report in the PR description; completed targeted CI would provide independent confirmation.
Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 14, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 15, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 15, 2026
Merged via the queue into ClickHouse:master with commit 79929b2 Nov 15, 2026
383 of 385 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 15, 2026
@clickhouse-gh clickhouse-gh Bot added comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). 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