Skip to content

Disable external sorting in 03634_autopr_output_bytes_estimation - #122367

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-03634-external-sort
Sep 26, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-03634-external-sort

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Fixes the flaky 03634_autopr_output_bytes_estimation failure on query_43 (query_43 61282786 22000000):
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=06108f98a54bf74cbc5e5e52d327e9c2e4ae6130&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_release%2C%20parallel%2C%202%2F2%29

When the randomized max_bytes_before_external_sort makes the query_43 sort spill, and the randomized prefer_external_sort_block_bytes is 1, MergeSortingTransform emits merged blocks of 128 rows. The runtime dataflow estimator samples those small blocks, and ZSTD(3) compresses them several times worse than full-size blocks. That pushes the URL output estimate from ~17 MB to ~56-61 MB, which is outside the 2.5x tolerance around the value recalibrated in #108786. Under LZ4 the old expected value (82 MB) left enough room for this, so the failure only started after #108786. All four query_43 failures in CIDB over the last 30 days had both settings. The test now disables external sorting, the same way it already disables external aggregation.

The other failures of this test in CIDB (query_10 0, query_12 ~6.7M) come from unrelated PR branches, not master.

Related: #108786

Changelog category (leave one):

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

🤖 Generated with Claude Code


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

Version info

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

With the randomized `max_bytes_before_external_sort` the `query_43` sort spills,
and with the randomized `prefer_external_sort_block_bytes=1` the merged output of
`MergeSortingTransform` comes out in blocks of 128 rows. The runtime dataflow
estimator samples these small blocks, which compress several times worse under
`ZSTD(3)` than full-size ones, so the `URL` output estimate grows from ~17 MB to
~56..61 MB - beyond the 2.5x tolerance around the 22000000 recalibrated in #108786.
All four `query_43` failures in the last 30 days had both settings.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=06108f98a54bf74cbc5e5e52d327e9c2e4ae6130&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_release%2C%20parallel%2C%202%2F2%29

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [970ae6f]

Summary: ✅


AI Review

Summary

This PR pins max_bytes_before_external_sort and max_bytes_ratio_before_external_sort to 0 in 03634_autopr_output_bytes_estimation.sql, which makes query_43 deterministic again when the settings randomizer would otherwise force an external spill with tiny merged blocks. I did not find any correctness, coverage, or PR-metadata issues in the current diff, and the current PR CI reports are all green.

Final Verdict

✅ No findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 26, 2026

@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.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Sep 26, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 26, 2026
Merged via the queue into master with commit d15ebea Sep 26, 2026
176 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-03634-external-sort branch September 26, 2026 20:41
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 26, 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