Repository navigation
Fix flaky automatic parallel replicas tests that read a compressible table - #125544
alexey-milovidov merged 2 commits into
Conversation
… that read periodic data `04034_autopr_min_rows_per_replica_reuses_index_analysis`, `04034_autopr_dataflow_cache_reuse_between_different_queries`, `05024_autopr_plan_based_parallel_replicas` and `05059_autopr_settings_in_select_settings_clause` create the same table, insert the same periodic data (`number % 1000 / 500 / 200`) and assert that the query reusing the collected statistics chooses parallel replicas. With the tests' pinned `max_threads = 4` and `max_parallel_replicas = 3` the gate in `considerEnablingParallelReplicas` reduces to `input_bytes > 2 * output_bytes`, where `input_bytes` is the compressed size of the read. A `Wide` part (`min_bytes_for_wide_part = 0`) with a ZSTD server codec compresses the 7 MB read to ~131 KB, so the gate depends on the output estimate, which two-level aggregation makes noisy: on the settings of the failing job of ClickHouse#125475 input was 131499 in every run, output took values from 7735 to 76000, and every run with output above 65749 declined parallel replicas (13 of 40 locally, 36 of 67 in CI). ClickHouse#120190 raised the aggregation state estimate of this query from 12000 to 30000 bytes, which moved the high end of the output estimate up by 18000 (54636 before, 76000 after; 0 of 80 failures on a master build from before it). That is why the four tests started failing on master and on unrelated PRs on 2026-10-12. `CODEC(NONE)` on `WatchID` keeps the read large whatever the part format, server codec, row order, compress block sizes or sparse serialization of a run: input is 2.4 MB or more in every measured configuration (2942464 on the failing job's settings), at least a ~16x margin. Queries, settings and references are unchanged, and no setting is pinned. Same approach as `05045_autopr_skip_plan_build_for_small_reads` (e8588c7). 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; 0 findings) plus an independent cold review of the diff (0 blocker/major findings).
Checked: both input-size paths ( Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261013-013800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261013-010100 |
|
Workflow [PR], commit [b7beb49] Summary: ✅ AI ReviewSummaryStores Final VerdictStatus: ✅ Approve |
CI finish ledger - 58b8532Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261013-113003 |
|
Yes, still relevant. #120190 is what started it: its larger aggregation-state estimate (12000 -> 30000 bytes for these queries) pushes CIDB, the four tests together:
Master examples, one per test: 04034 min_rows @ 7520cef6, 05059 @ 46787ce4, 05024 @ cac840be, 04034 dataflow @ 16add56e (today, 14:52 UTC). The only AutoPR change merged after that build, #120884, keeps the same estimates and cost formula. |
|
Backporting to fix CI |
Backport #125544 to 26.10: Fix flaky automatic parallel replicas tests that read a compressible table
…s that read a compressible table
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
Related: #120190
04034_autopr_min_rows_per_replica_reuses_index_analysis,04034_autopr_dataflow_cache_reuse_between_different_queries,05024_autopr_plan_based_parallel_replicasand05059_autopr_settings_in_select_settings_clausefail withpr_used1 -> 0 since 2026-10-12: on master (05024, 05059) and on unrelated PRs (#125475, #124023).They share one table of periodic data and assert that the query reusing the collected statistics chooses parallel replicas. With the tests'
max_threads = 4andmax_parallel_replicas = 3the gate isinput_bytes > 2 * output_bytes, andinput_bytesis the compressed size of the read. On aWidepart with a ZSTD server codec the 7 MB read compresses to ~131 KB, so the outcome depends on the output estimate, which two-level aggregation makes noisy. On the settings of the #125475 job input was 131499 in every run, output 7735..76000, and every run above 65749 declined parallel replicas. Since #120190 the aggregation state estimate of this query is 30000 bytes instead of 12000; on a master build from just before it the same settings gave output up to 54636 and 0/80 failures.The change stores
WatchIDwithCODEC(NONE), as05045_autopr_skip_plan_build_for_small_readsdoes, so the read stays large under any part format, server codec, row order or sparse serialization. No setting is pinned.Validation, on a local ParallelReplicas-lane config: the CI settings of all four failures redden the unchanged tests (the two master ones with a
ZSTD(3)server codec) and pass after the change (800/800, input >= 2.9 MB); randomized settings 600/600.Also noticed: with two-level aggregation the key compression ratio is sampled from a few tiny per-bucket chunks, so the output estimate of one query varies up to ~10x between identical runs.
Workflow [PR]
Sync PR [sync-upstream/pr/125544]
Version info
26.11.1.244-master(included in26.11and later)26.10.3.18