Repository navigation
Canonicalize KeeperMap primary key metadata writes - #116369
Conversation
Newer writers persist an optional outer pair of parentheses around a single primary-key expression. Older readers reject the shared KeeperMap definition during mixed-version upgrades. Reuse the compatibility canonicalizer when creating metadata so new paths use the older spelling. Preserve required parentheses, expression-list spelling, and existing znodes. Add a Keeper-backed regression covering canonical writes, legacy attach/read behavior, and the expression-list fallback. Verified with an incremental build, an exact baseline/candidate stateless run, the 13-case Chaos Lab mixed-version matrix, and local hostile review.
Canonicalize the already-parsed single-expression AST instead of sending formatted text back through parser defaults. Clone the expression, clear only its top-level parenthesized flag, and keep expression-list spelling unchanged. This covers DDL accepted with raised parser limits while preserving required inner parentheses. Verified with an incremental ClickHouse build and an exact Keeper-backed stateless candidate/reference run.
|
Workflow [PR], commit [2cff955] Summary: ✅
AI ReviewSummaryThis PR changes the Final VerdictStatus: ✅ Approve LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 14/14 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 19 s compile time in total, 7 of them have a recent master baseline. |
Backport #116369 to 26.8: Canonicalize KeeperMap primary key metadata writes
Backport #116369 to 26.6: Canonicalize KeeperMap primary key metadata writes
Backport #116369 to 26.7: Canonicalize KeeperMap primary key metadata writes
…y metadata writes
…y metadata writes
Related: #115642
Why
ClickHouse 26.6 started storing a redundant outer pair of parentheses around a
single-expression KeeperMap primary key. A 26.4 server expects the previous
spelling and can reject that metadata during a rolling upgrade or rollback.
The tolerant reader fix was merged first in #115642/#70018 and backported in
#70229/#70230. This PR stops new KeeperMap paths from producing the incompatible
spelling.
What changed
For a single-expression primary key, format the already-parsed expression AST
without its top-level
parenthesizedflag. This avoids reparsing with unrelatedparser limits and preserves parentheses required inside the expression.
Expression-list spelling is deliberately unchanged because the tolerant reader
canonicalizes one complete expression. Existing Keeper znodes are never
rewritten; the change applies only when new metadata is created.
Compatibility and rollout
This targets 26.8 and must be backported to 26.6, where the writer spelling first
changed.
Deploy the tolerant reader to every existing 26.6/26.7 peer before deploying
this writer change. An unpatched 26.6/26.7 reader still rejects the canonical
26.4 spelling; the mixed-version test includes that expected failure boundary.
Tests
clickhousebuild on the disposable dev VM.candidate exact reference match.
26.7, and 26.8, including rolling restart/rollback and no-rewrite checks.
writer-side reparse.
No documentation update is needed: this restores an internal persisted spelling
and does not change the SQL interface.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
KeeperMap now writes single-expression primary keys without redundant outer parentheses, so metadata created by newer servers remains readable by ClickHouse 26.4 during supported rolling upgrades and rollbacks.
Workflow [PR]
Sync PR [sync-upstream/pr/116369]
Version info
26.9.1.158(included in26.9and later)26.8.1.2014,26.7.6.52,26.6.4.59