Skip to content

Pin index_granularity_bytes in the distributed plan grouping test - #118071

Merged
alexey-milovidov merged 3 commits into
masterfrom
fix-04898-granularity-randomization
Sep 11, 2026
Merged

alexey-milovidov merged 3 commits into
masterfrom
fix-04898-granularity-randomization

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

04898_distributed_plan_grouping_function asserts an EXPLAIN actions = 1 dump that contains the Granules: line of the ReadFromMergeTree step.

The table pins index_granularity = 8192 so that the 1000 inserted rows form a single granule, but the stateless test runner also randomizes index_granularity_bytes, and the client only injects a randomized MergeTree setting when the CREATE query does not already set it (ClientBase::addMergeTreeSettings). With adaptive granularity on, the byte budget caps the granule before the row count does and the read splits into several granules, so the dump no longer matches the reference:

-                      Granules: 1
+                      Granules: 2

The fix pins index_granularity_bytes in the table definition as well, at its default value 10485760. The 1000 inserted rows stay far below that byte budget, so the granule count depends on the already pinned index_granularity alone.

An earlier revision used index_granularity_bytes = 0 instead. That also fixes the granule count, but it turns adaptive granularity off, and with a randomized min_bytes_for_wide_part the server then writes a warning to stderr (Table can't create parts with adaptive granularity, but settings min_rows_for_wide_part = 0, min_bytes_for_wide_part = 10485760 ...), which failed Fast test with having stderror. Keeping adaptive granularity on and pinning the byte budget to its default avoids both problems.

The randomized-settings diagnosis in the CI report points at the same culprit:

Culprit MergeTree settings: --index_granularity_bytes 8829

Reproduced locally against a server: with --index_granularity_bytes 8829 the test fails with the exact diff above before the change, and passes after it. It also still passes with no randomization.

The same failure appeared on three recent runs, each with a different randomized value (8829, 2544, 10873).

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

Changelog category (leave one):

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

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

Version info

  • Merged into: 26.9.1.1182 (included in 26.9 and later)

`04898_distributed_plan_grouping_function` asserts an `EXPLAIN actions = 1`
dump that contains the `Granules:` line of the `ReadFromMergeTree` step.
The table pins `index_granularity = 8192` so that the 1000 inserted rows form
a single granule, but the stateless test runner also randomizes
`index_granularity_bytes`, and the client only injects a randomized `MergeTree`
setting when the `CREATE` query does not already set it. With adaptive
granularity on, the byte budget caps the granule before the row count does and
the read splits into several granules, so the dump no longer matches the
reference:

    -                      Granules: 1
    +                      Granules: 2

Set `index_granularity_bytes = 0` in the table definition as well, which turns
adaptive granularity off and makes the granule count depend on the already
pinned `index_granularity` alone.

Reproduced locally: with `--index_granularity_bytes 8829` the test fails with
the exact diff above before the change and passes after it.

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

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

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0f4dcce]

Summary: ✅


AI Review

Summary

This PR stabilizes 04898_distributed_plan_grouping_function under MergeTree setting randomization by pinning index_granularity_bytes alongside the already pinned index_granularity, while avoiding the stderr warning path that index_granularity_bytes = 0 would trigger when min_bytes_for_wide_part is randomized. I did not find any blocker or major issue in the current patch.

Final Verdict

✅ No findings. The fix targets the randomized MergeTree setting that changes the asserted Granules: line, keeps adaptive granularity enabled, and preserves broader MergeTree-settings coverage for the rest of the test.

alexey-milovidov and others added 2 commits September 10, 2026 16:49
…ptive granularity

`index_granularity_bytes = 0` disables adaptive granularity, and with a randomized
`min_bytes_for_wide_part` the server then writes a warning to stderr:

    Table can't create parts with adaptive granularity, but settings min_rows_for_wide_part = 0,
    min_bytes_for_wide_part = 10485760. Parts with non-adaptive granularity can be stored only in
    Wide (default) format.

which made `Fast test` fail with `having stderror`:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118071&sha=b92162db243a49fb3e4bba5d361a1d9228aadf3e&name_0=PR&name_1=Fast%20test
#118071

Pinning `index_granularity_bytes` to the default `10485760` shields the table from the
randomization just as well - the 1000 inserted rows stay far below the byte cap, so the
`EXPLAIN` still prints a single granule - while keeping adaptive granularity on, so the
warning is not emitted.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@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 11, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 11, 2026
Merged via the queue into master with commit 60efda5 Sep 11, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-04898-granularity-randomization branch September 11, 2026 02:34
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 11, 2026
@clickhouse-gh clickhouse-gh Bot added comp-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... 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-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... 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