Repository navigation
Conversation
A column-level `SETTINGS (...)` clause is one `ASTSetQuery` with three payloads: `changes` (`name = value`), `default_settings` (`name = DEFAULT`) and `query_parameters` (`param_name = ...`, prefix stripped). Every consumer of a column-level clause forwarded only `changes` to the single name check `MergeTreeColumnSettings::validate`, so the other two names were already gone by the time it ran, and the names in `settings_resets` (`RESET SETTING`, and since ClickHouse#119475 the `= DEFAULT` reset) were never checked at all. A name that is not a column-level setting was therefore accepted and silently dropped in every spelling but the ordinary one, so a typo left the setting unapplied with no diagnostic. Only `min_compress_block_size` and `max_compress_block_size` are settable per column. One `validateName` now owns the allowed set and the message, and `validateNames` runs it over the two payloads `validate` never sees. `CREATE`/`ATTACH` screens the clause AST in `getTablePropertiesAndNormalizeCreateQuery`, after `getColumnsDescription` so a bogus `changes` name still reports first, and before `formatColumns` replaces the column list and throws those payloads away. The `ALTER` sites convert the names they do not act on into a validation-only `AlterCommand` member at parse time and check them in `AlterCommand::apply`, on the same lines as the existing `validate(settings_changes)` calls, so every spelling is gated exactly as the ordinary one is. The same rewrite drops `validate`'s unused `static const MergeTreeSettings merge_tree_settings;` local, which was the receiver for a `checkCanSet` call that has since become static-qualified. Two things are deliberately left unscreened. An `ALTER` command that does not take effect (an ignored `ADD COLUMN IF NOT EXISTS`, a skipped `MODIFY COLUMN IF EXISTS`) is not screened in any payload, because the ordinary spelling is already a no-op there; that is why the check sits in `apply` rather than in `AlterCommand::parse`. A node re-executing a definition another node already judged is not screened either: an `ALTER` is enqueued verbatim, so a statement an older initiator accepted survives in the queue, and a newer secondary refusing it would retry that entry forever. The guard is master's own three replay terms from `checkStorageSettingNames`, extracted next to their sibling `isFreshTableDefinition` as `isReplayOfJudgedDefinition`; `checkStorageSettingNames` itself is left calling them inline, to keep this change off the lines ClickHouse#121394 edits. `ADD COLUMN` also keeps its plain `.changes` assignment rather than reusing `parseSettingsChangesAndResets`, whose `BAD_ARGUMENTS` throws would be new parse-time rejections for clauses it accepts today, and a parse-time throw fires on a secondary before `apply` can exempt it. So this change adds no parse-time throw. `ENGINE = TimeSeries` is a third case, and the new rows pin it as parity rather than as coverage. `normalizeTimeSeriesDefinition` regenerates the outer column list from resolved types and replaces it wholesale, long before this screening runs, so a column clause is discarded there whatever the spelling, along with that column's type, codec, TTL and comment. Screening the original declarations would reject the exotic spellings on that one engine while the ordinary one stayed accepted, which is the asymmetry this change exists to remove; measured, that is exactly what moving the check ahead of normalization does. No grandfathering marker is needed. The creator keeps only `changes` and `setProperties` then rewrites the column list with `formatColumns`, so neither exotic payload can be in stored metadata: a table created with `SETTINGS (min_compress_block_size = 100, not_a_setting = DEFAULT, param_bogus = 1)` by a binary without this change stores only `min_compress_block_size = 100`, and a binary with it loads that data directory unchanged and keeps the setting. A full-definition `ATTACH TABLE t UUID '...' (...)` states its settings itself and is screened; the short form is a replay and is not. Related: ClickHouse#121202 Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 5 gate findings across three rounds, plus
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260922-222100 |
|
Workflow [PR], commit [12d7958] Summary: ✅
AI ReviewSummaryThe change rejects unsupported column-level Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units247 translation units recompiled, 2047 s compile time in total, 247 of them have a recent master baseline. |
Review ask: reduce the volume, not the breadth. One row now covers each
validation site and payload spelling once; rows that only repeated another
file's coverage on a second database or engine flavour are gone, as are the
section labels that were echoed into the reference files. 237 added test
lines become 142.
The Replicated-database arm no longer needs a shell test. Its full-definition
`ATTACH` row was the only statement that needed a shell-generated UUID, and
that path is already covered on the Atomic database by the JSON/ATTACH test,
so the arm is now a `.sql` test stating its expectations with
`{ serverError UNKNOWN_SETTING }`, in the shape of
`03224_invalid_alter.sql`. It keeps what only a Replicated database can show:
that the initiator judges its own definition although it holds a metadata
transaction, at both the `CREATE` and the `ALTER` site.
Kept: all three payload spellings at each of the five validation sites, the
ordinary spelling that master already rejected as a control, all three reset
spellings, the short-`ATTACH` replay exemption, the `TimeSeries`
normalization case, and both payload fields of the JSON AST dialect.
Measured on a debug build of this branch and on a master build without the
change: the three tests pass with it and fail without it, the replicated one
on both of its refusal rows.
Co-Authored-By: Claude Opus 5 <[email protected]>
CI finish ledger - 46852d5Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All 173 check runs completed, and Session id: cron:our-pr-ci-monitor:20260925-203211 |
|
Fixing PR for the |
CI finish ledger - aafc37eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261013-230005 |
|
🕵️ @groeneai Thanks for trimming the tests. The checks look right to me, and since neither payload can reach stored metadata, this one has no upgrade exposure. Two small things:
|
The `CREATE` site now uses `isReplayedTableDefinition`, whose terms are exactly the ones it spelled out. The `ALTER` sites keep a file-local `isReplayOfJudgedDefinition` that is `isSecondaryDDLReplay` plus a recovery from stored metadata, instead of a copy of `isSecondaryDDLReplay`'s body with its Shared Catalog block, so `LoadingStrictnessLevel` is untouched. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`MODIFY COLUMN <subcolumn> CODEC(...)` refuses any SETTINGS clause, but `validateSubcolumnCodecCommand` did not look at `settings_names_to_check`, so `SETTINGS (param_not_a_setting = 1)` passed the guard, and the subcolumn branch of `apply` returns before that name is checked: the codec was applied and the name dropped. Now it is refused like the other spellings, except on a replay, where an initiator without this check may have accepted it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A TimeSeries table keeps its `INNER COLUMNS` declarations verbatim in its own definition and creates each inner table through an internal `InterpreterCreateQuery` in `CREATE` mode, also on `RESTORE`. The column SETTINGS name check ran in those internal creates, so a backup of such a table written by an unpatched server failed to restore with `UNKNOWN_SETTING`, and a fresh `CREATE` was refused only after the first inner tables had been created. The check now skips internal creates and screens the inner column lists of the parent instead, so a fresh `CREATE` is refused before any inner table exists and a restore is judged as a replay, like the parent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks, both done:
Re-checking against the merged master turned up two more cases, fixed in the same push:
|
CI finish ledger - ebf1a87Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261105-220009 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A column-level
SETTINGS (...)clause, inCREATE, a full-definitionATTACHandALTER, now rejects a name that is not a column-level setting when it is spelledname = DEFAULTorparam_name = value, and inMODIFY COLUMN ... RESET SETTING name, as the ordinaryname = valuespelling already did. Such a name used to be accepted and silently dropped, leaving a typo unapplied with no diagnostic.min_compress_block_sizeandmax_compress_block_sizeare the only names settable per column.Description
Related: #121202. Requested in #121394 (comment); database and dictionary
SETTINGSfollow as separate PRs.Root cause. A column
SETTINGSclause is oneASTSetQuerywith three payloads:changes,default_settings(name = DEFAULT) andquery_parameters(param_name = value). OnlychangesreachedMergeTreeColumnSettings::validate, the sole name check;RESET SETTINGnames, and since #119475 the= DEFAULTreset onMODIFY COLUMN, land insettings_resets, which nothing checked either.Change.
validateNameowns the allowed set and the message;validateNamesapplies it to the two unseen payloads.CREATEscreens the clause AST, a TimeSeries table'sINNER COLUMNSincluded, beforeformatColumnsdiscards them;ALTERcarries the names it does not act on into the command and checks them inAlterCommand::apply, and a subcolumnCODECchange refuses them like any otherSETTINGS.Not screened. An ignored
ADD COLUMN IF NOT EXISTSorMODIFY COLUMN IF EXISTS, already a no-op; a replay (isReplayedTableDefinitionatCREATE,isSecondaryDDLReplayor a recovery atALTER) and the internal create of a hidden inner table, which would refuse a definition already judged; and astructurestring, as inCREATE TABLE ... AS <table function>: it is stored verbatim with no replay signal, so screening it would break existing views that hold one.Compatibility. No existing table is affected. Only
changesreach stored metadata, except in a TimeSeriesINNER COLUMNSclause, kept verbatim; its inner tables are created internally and not screened, so a backup of one restores. A full-definitionATTACHis screened, a short one is a replay. Checked by loading a data directory and restoring a backup written by the unpatched binary.Validation. Three new stateless tests, 20 runs each under randomization; on both binaries, 15 previously-accepted statements are now refused and 10 acceptance controls still pass.
Workflow [PR]
Sync PR [sync-upstream/pr/121663]