Skip to content

Document how the query plan serialization version is bumped - #123241

Merged
davenger merged 5 commits into
masterfrom
query_plan_version_bump_rule
Oct 2, 2026
Merged

davenger merged 5 commits into
masterfrom
query_plan_version_bump_rule

Conversation

@davenger

@davenger davenger commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Related: #119535

DBMS_QUERY_PLAN_SERIALIZATION_VERSION has been bumped for every serialization change. This adds a comment above the constant with the rules for moving it: at most once per release, and not for a change to the bytes of one step, which bumps its own serialization version instead (#119535).

The comment records the release of the last bump. The next change then sees whether the current release already has its bump, and reuses the value, or whether the last bump was in an earlier release, and increments it.

No code change.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

Version info

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

@clickhouse-gh

clickhouse-gh Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6117338]

Summary: ✅


AI Review

Summary

This PR documents the bump policy for DBMS_QUERY_PLAN_SERIALIZATION_VERSION and retargets the BlocksMarshalling introduction to version 20. I’m requesting changes because the new rule is still incomplete: it presents new step names and serializeSettings names as the cases that require a global bump, but QueryPlan::serialize still has top-level fields that are gated only by the global plan version.

Findings

⚠️ Majors

  • [src/Core/ProtocolDefines.h:134] The new rule reads as exhaustive, but the global query-plan version also guards top-level bytes outside steps. QueryPlan::serialize only writes max_threads and concurrency_control from DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_EXECUTION_LIMITS onward (src/Processors/QueryPlan/Serialization.cpp:75, src/Processors/QueryPlan/Serialization.cpp:113). A future contributor following this comment could add another plan-level field and skip the global bump because it is neither a step name nor a serializeSettings name.
    Suggested fix: broaden the rule to cover any bytes not protected by a step-local step_version, or explicitly call out top-level plan framing / execution-limit fields as another reason to bump the global version.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required action: update the new rule so it does not exclude top-level plan bytes that are still versioned only by DBMS_QUERY_PLAN_SERIALIZATION_VERSION.

LLVM Coverage Report

⚠️ No coverage measurement for commit 6117338: no coverage data for the changed C/C++ source files (they may be new or not instrumented).

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 1, 2026
…last-bumped release line

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... label Oct 1, 2026
@shankar-iyer shankar-iyer self-assigned this Oct 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 611733838 with master 53f6677f4 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

261 translation units recompiled, 2419 s compile time in total, 261 of them have a recent master baseline.

Job report

@clickhouse-gh

clickhouse-gh Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 36 queries analysed

no significant changes detected. K_source=6 K_base=30 flagged=0/65

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: e0954ec6-40b3-4648-9ab5-629b735e131e
  • MIRAI run: 878f76af-5d70-401a-aa8f-f738393b5b0f
  • PR check IDs:
    • clickbench_2778893_1790881120
    • clickbench_2778899_1790881120
    • clickbench_2778910_1790881120
    • tpch_adapted_1_official_2778936_1790881120
    • tpch_adapted_1_official_2778950_1790881120
    • tpch_adapted_1_official_2778964_1790881121

davenger and others added 2 commits October 1, 2026 18:00
…bump_rule

# Conflicts:
#	src/Core/ProtocolDefines.h
Comment thread src/Core/ProtocolDefines.h Resolved
/// Rules for this version:
/// - Bump it at most once per release: the first change in a release that needs it bumps it, later changes
/// in the same release reuse the value. Whoever bumps it also updates the "Last bumped for release" line below.
/// - What needs it: a new step name, or a new plan setting name written by `serializeSettings`. An older

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new rule still reads as exhaustive, but DBMS_QUERY_PLAN_SERIALIZATION_VERSION also gates plan-level bytes that are outside both step names and serializeSettings. For example, QueryPlan::serialize only writes max_threads / concurrency_control from DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_EXECUTION_LIMITS onward (src/Processors/QueryPlan/Serialization.cpp:75-116). A future contributor following this comment could add another top-level field and skip the global bump because it is neither a step name nor a plan-setting name. Please broaden the rule to cover any bytes that are not versioned by a step-local step_version, or mention top-level plan framing explicitly.

@davenger
davenger enabled auto-merge October 2, 2026 11:38
@davenger
davenger added this pull request to the merge queue Oct 2, 2026
Merged via the queue into master with commit f26df6b Oct 2, 2026
149 checks passed
@davenger
davenger deleted the query_plan_version_bump_rule branch October 2, 2026 16:07
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 2, 2026
thevar1able added a commit that referenced this pull request Oct 3, 2026
Master moved to per-step serialization versions
(#119535) and documented that a
change to a step's bytes must bump the step's own version rather than the
global `DBMS_QUERY_PLAN_SERIALIZATION_VERSION`
(#123241). Flag bit 128 of
`AggregatingStep` is now taken by `only_merge`.

Resolve accordingly: drop the global version bump and the bit-128 top-K
flag, and carry the top-K parameters as a trailing presence byte plus
payload in version 1 of the `Aggregating` step, introduced at plan version
20 (the 26.10 value). Towards a peer that reads step version 0 the
parameters are omitted, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... pr-not-for-changelog This PR should not be mentioned in the changelog 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