Skip to content

Disable the adaptive aggregator in 03634_autopr_output_bytes_estimation - #123781

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-03634-adaptive-aggregator
Oct 5, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-03634-adaptive-aggregator

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Related: #123653

query_12 in 03634_autopr_output_bytes_estimation sometimes produces an output-bytes estimate of ~6.6M against the expected 2640000, just past the 2.5x tolerance. According to the server log of the failing run, two threads reached adaptive_aggregator_freeze_threshold keys (Adaptive aggregation: local table frozen at 16542 keys), and then came Converting aggregation data to two-level. In that case the estimate is recorded per bucket by the two-level merge, not by the single-level path the expected values are calibrated for. Whether any thread crosses the threshold depends on how marks are distributed between the reading threads, which is why reruns with the same randomized settings pass. This PR pins enable_adaptive_aggregator = 0, just as 05234_query_plan_aggregation_having_prefilter_results did for the same mechanism.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=ed7e72d6797b8e678518f5a2a26faff7f2bd695e&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29

Changelog category (leave one):

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

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1607-master (included in 26.10 and later)

…ion`

`query_12` randomly produced an output-bytes estimate of ~6.6M against the
expected 2640000, just beyond the 2.5x tolerance. The server log of the failing
run shows two threads reaching `adaptive_aggregator_freeze_threshold` keys
(`Adaptive aggregation: local table frozen at 16542 keys`), followed by
`Converting aggregation data to two-level`. The estimate then comes from the
two-level bucket merge instead of the single-level one the expected values are
calibrated for. Whether a thread crosses the threshold depends on how the marks
are distributed between the reading threads, so reruns with the same
randomized settings pass. The same mechanism was fixed in `05234` by pinning
`enable_adaptive_aggregator = 0`.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=ed7e72d6797b8e678518f5a2a26faff7f2bd695e&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29

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

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9b1f8ae]

Summary: ✅


AI Review

Summary

This PR stabilizes 03634_autopr_output_bytes_estimation by turning enable_adaptive_aggregator off after query_12 occasionally takes the two-level merge path and records a much larger aggregation-state estimate. The stabilizing intent makes sense, but the current change is broader than the reported flake: it moves every GROUP BY in the fixture off the default enable_adaptive_aggregator = 1 path, so the test stops checking default aggregation-state accounting for several unrelated cells. The override should be localized to query_12, or the whole fixture should be explicitly recalibrated around the non-default mode.

Findings
  • ⚠️ Majors
    • [tests/queries/0_stateless/03634_autopr_output_bytes_estimation.sql:38] This session-level SET applies to every aggregation query in the file, not only the flaky query_12. That means query_15, query_21, query_22, query_28, query_34, and the other grouped cells stop exercising the default adaptive path, so the fixture can now hide estimator changes unrelated to the original flake. Suggested fix: move enable_adaptive_aggregator = 0 into query_12's SETTINGS (or any other individually proven flaky statements), or explicitly recalibrate and document the whole file as a non-default enable_adaptive_aggregator = 0 fixture.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required action: narrow the enable_adaptive_aggregator override to the flaky query instead of flipping the whole file, or deliberately recalibrate and document the fixture as covering the non-default mode.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 5, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 5, 2026
Merged via the queue into master with commit 2cf1c54 Oct 5, 2026
149 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-03634-adaptive-aggregator branch October 5, 2026 19:11
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 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

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.

2 participants