Repository navigation
Conversation
Pins what the table reports before engines start overriding `getTableSettings`: each engine reports its `SETTINGS` clause, including the ones that keep no settings struct of their own, a table with no clause contributes no rows, and `source` is `definition` throughout. The masking assertions matter most. A `Kafka` table's `kafka_sasl_password` must read `[HIDDEN]` with `is_masked = 1`, and nothing else in that table - or in any table of an engine with no secret settings - may be masked. Getting this wrong in either direction is worse than a wrong value: masking too little leaks a credential, masking too much hides a value with nothing to say it is hidden. Tagged `no-fasttest` because those assertions need `Kafka`, which is an optional build. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…S` clause First engine to override `getTableSettings`, and the shape the rest will follow. A `Kafka` table now reports all 351 of its settings rather than the five its definition happens to name, each with its default, type, description and where the value came from. `enumerateSettingsFromImpl` reads a `BaseSettings` instance into the common form. It is deliberately the only per-struct exposure: `system.engine_settings` will be moved onto it later and its `fillEngineSettingsColumns` deleted, so that a settings struct is read in one place and the two tables cannot disagree about the same setting. A struct records only that a value differs from its default, never what changed it, so the storage attributes. Three things can set a `Kafka` setting - a named collection from the engine arguments, the `SETTINGS` clause, and this storage's own constructor, which pins a few format settings. The collection is consulted by name for the settings it really carries, rather than inferring one from "changed but not in the definition": that inference looked right and was wrong, attributing the constructor's `input_format_skip_unknown_fields` to a collection the table never referenced. Those keep `source = other`, which is what that value is for. `IStorage::getSettingNamesStatedInDefinition` gives an override the names the definition states, sharing the create-query read with the base implementation. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…`, `EmbeddedRocksDB` and `FileLog` These engines take their settings from two places only - their compiled defaults and the table's own `SETTINGS` clause - so each override is the shared `attributeSettingsStatedInDefinition` over the struct's `enumerateSettings`, and the interesting work is in neither. Add the `default` column, now that there is something to put in it. It is empty for a setting known only from a `SETTINGS` clause: an engine that keeps no settings struct has no default to report, the same reason `description` and `type` are empty there. A `Memory` table now shows `max_rows_to_keep = 100` against a default of `0`, and a `Join` table still shows only `persistent`, with nothing behind it. `tier` and `is_obsolete` stay out for now. Unlike an empty default, which reads as "none known", the natural values for them - `Production` and `0` - are claims, and no engine that keeps no settings struct can support either. They need `TableSetting::tier` to become optional first. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…saurus` A `MySQL` table now reports all eight of its settings, so `connection_pool_size = 7` is visible against its default of 16 rather than only as a line in the `CREATE` query. Each of these engines can also take settings from a named collection, and none of them keeps the collection's name the way `StorageKafka` does. Rather than inferring a collection from "changed but not stated in the definition" - the inference that wrongly credited `StorageKafka`'s own constructor to one - a setting these storages cannot account for reports `source = other`. Naming the collection would mean each storage retaining it, which is a change to their constructors and belongs on its own. `MaterializedPostgreSQL` is left for later: it takes its settings by `unique_ptr` in the constructor without keeping them. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…oing so `Distributed` is the first engine to report a setting as coming from a config section: it starts from the server-effective settings, the `distributed` section applied over the compiled defaults, so anything that section changed and the definition does not restate is `source = config`. `Hive` reports only defaults and its definition. It has a `hive` config section and `HiveSettings::loadFromConfig` to read it, but nothing calls that function, so the path is dead and claiming `config` for it would be wrong. Attribution now matches a setting's aliases as well as its name. A definition may state any of them - `SETTINGS monitor_batch_inserts = 1` for `background_insert_batch` - and matching only the canonical name reported the value as coming from somewhere unaccounted for. Aliases were until now filed as a question of whether a user can find a setting by its old name; an unresolved one also makes the table state the wrong source. The names come from `Traits::settingsToAliases`, which every settings struct generates. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…definition A `MergeTree` table is created from the settings the server has in effect, never from the compiled defaults, and `Context` builds those by applying the `compatibility` setting first and the `merge_tree` config section second. Both leave a setting merely "changed", so telling them apart means rebuilding the two intermediate baselines and asking what each step altered. Config is tested first, because it is applied second and so wins. The extra baseline costs nothing in the ordinary case: `compatibility` is empty by default, `applyCompatibilitySetting` then returns immediately, and no setting can carry that origin, so it is not built at all. The override sits on `MergeTreeData`, so both storages inherit it, with `supportsReplication` choosing between the `merge_tree` and `replicated_merge_tree` baselines exactly as `registerStorageMergeTree` does when it creates a table. With `compatibility = 23.3` a table reports 48 settings rolled back to their older values, each against the current default - which is the question this column exists to answer. Note that a setting the config supplies may still report `definition`: `loadFromQuery` writes the immutable ones into the stored `CREATE` query, so `index_granularity` really does live in the table's definition afterwards and will not follow a later change to the config. The test now lists the settings each definition names rather than every row. It listed all of them while engines reported only their `SETTINGS` clause, which was three rows and is now 366; pinning the value of every `MergeTree` setting would make the reference churn whenever any default changed. That an engine with a settings struct reports defaults, and one without does not, is checked separately. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…eeper These engines keep no settings object. `getSettings` rebuilds one from three places: the table metadata in Keeper, which every replica shares; the metadata object; and plain members of this storage. That is the case this accessor was made a method on the storage for - an `ALTER ... MODIFY SETTING` run on another replica changes the shared metadata, and this replica reports the new value while its own `CREATE` query still states the old one. Two things follow, both of which cost an attempt to get wrong. `getSettings` assigns every setting it knows, so `isValueChanged` is true for all of them and distinguishes nothing. Attribution compares each value with its default instead, which is what `dumpToSystemEngineSettingsColumns` already does against the table metadata, and for the same reason. Only fourteen of the settings actually come from the shared metadata; the rest are plain members. Marking everything the definition does not state as `shared_metadata` would have credited Keeper with a couple of dozen settings it never held - the same error as crediting a named collection for what `StorageKafka`'s constructor sets. The fourteen are listed explicitly, and are applied after the definition rather than before, because for them the shared metadata is what the table uses. Not exercised locally: creating one of these tables needs both S3 and Keeper. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
An `Iceberg`, `DeltaLake` or `Paimon` table now reports all 356 settings of `DataLakeStorageSettings` rather than the handful its definition names. The settings belong to the configuration, not to the storage: `DataLakeConfiguration` holds them, and `StorageObjectStorage` has no way to reach them. So the configuration answers for them, with a base implementation returning nothing - plain `S3`, `GCS`, `AzureBlobStorage` and `HDFS` consume their settings at creation and keep nothing to report, and fall back to the `SETTINGS` clause their definition states. `MaterializedPostgreSQL` is still on the base implementation for the same reason: it takes its settings by `unique_ptr` in the constructor without keeping them, so there is nothing to enumerate without changing how it is built. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A `MergeTree` setting can be written under more than one name - `allow_experimental_block_number_column` for `enable_block_number_column` - and `system.merge_tree_settings` shows only the one it is declared under, so looking it up by the other finds nothing. A user who knows a setting by its older name has no way to reach it. Follow `system.settings`: a setting gets its own row with `alias_for` empty, and a further row per other name carrying the same values with `alias_for` naming the one it is declared under. The cost is small enough to have been worth measuring first, since these rows are per table rather than per engine: two aliases across all 366 `MergeTree` settings, five across `Distributed`, none at all for `Kafka`, the data lakes or the queue engines. The names were already to hand. Attribution collects them so that a definition naming a setting by an alias is recognised, without which the value is reported as coming from somewhere unaccounted for. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… has `system.settings` and `system.merge_tree_settings` are in production and between them settle what a settings table looks like. This one was missing six of their columns: `min`, `max`, `disallowed_values`, `readonly`, `is_obsolete` and `tier`. They were left out on the grounds that constraints exist only for `MergeTreeSettings`, so `min`, `max` and `disallowed_values` would be empty almost everywhere. That objection does not survive contact with the tables it was measured against: with no profile declaring a constraint, both are empty for *every* row of `system.settings` and of `system.merge_tree_settings`. Empty means no constraint, and says so honestly. The twelve columns those tables share now appear here in their order, with their meanings, so that what a reader knows about them carries over. This also retires the `alterable` column drafted earlier: `readonly` already answers whether something forbids changing a setting, with semantics that are settled and shipped, and reports 1 for exactly the eleven settings `MergeTreeSettings::isReadonlySetting` marks. A `MergeTree` table now returns what `system.merge_tree_settings` returns, and the test pins the one row where they differ: `loadFromQuery` writes the immutable settings into the stored `CREATE` query, so `index_granularity` is stated in the table's definition and `changed` there, while nothing set it on the server. `tier` is not nullable, matching those tables. For a setting known only from a `SETTINGS` clause there is no settings struct to ask, and it reads `Production`; such rows have an empty `default`, `type` and `description` too, which is what marks them out. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
`system.engine_settings` and `system.table_settings` each walked a `BaseSettings` instance and read the same accessors out of it, through two separate per-struct functions: `fillEngineSettingsColumns` wrote columns, `enumerateSettings` returned values. Twenty structs carried both, and the two could drift - nothing stopped one table reporting a setting's tier or description differently from the other. The registration hook now returns `TableSettings`, the same type `IStorage::getTableSettings` returns, so `system.engine_settings` differs from `system.table_settings` only in whose instance it enumerates: a server-level one rather than a table's. `FillEngineSettingsColumns.h` and the twenty functions behind it are gone. The constraint lookup was duplicated the same way and is now `MergeTreeSettings::applyConstraints`, called by both. Five structs needed `enumerateSettings` before their old function could go - `Set`, `QueryRunner`, `StorageObjectStorage`, `PostgreSQL` and `MaterializedPostgreSQL`. Their storages keep no settings object, so they report nothing per table, but they can still describe their engine. Roughly line-neutral: the saving is one mechanism where there were two, not fewer lines. Both tables' tests are unchanged, and a `Memory` setting now reads identically from either. `dumpToSystemMergeTreeSettingsColumns` is untouched - it serves `system.merge_tree_settings`, which is not part of this work. Related: ClickHouse#59913 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
The name the issue asks for, over the table that does the work:
SHOW [CHANGED] TABLE SETTINGS {FROM | IN} [db.]table [[NOT] [I]LIKE 'pattern']
rewritten into a `SELECT` over `system.table_settings`, the way `SHOW COLUMNS`
and `SHOW INDEXES` are rewritten over `system.columns`. `CHANGED` keeps the
settings something other than the default set, which on most tables is the
handful anyone is looking for.
It prints `name`, `value`, `changed` and `source`, and deliberately not
`description`: those run to paragraphs, and four columns fit a terminal where
five do not. Everything past that - descriptions, other engines, joining
`system.tables`, filtering on `source` - is a query against the table, which
is why the table is the feature and this is a convenience over it.
`SHOW TABLE SETTINGS` shares a prefix with two existing statements. `SHOW
TABLES` rejects the singular `TABLE` and restores its position, and `SHOW
[CHANGED] SETTINGS`, about the session's settings, is only reached when
`TABLE` does not follow. The parser goes before both so a mistyped statement
is diagnosed as this one rather than as `SHOW TABLES`, and the test checks all
three still parse as themselves.
Related: ClickHouse#116543
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
`source` distinguishes eight origins and only two of them were covered. The two that matter most were not: a value a server config section supplies, and one the `compatibility` setting rolls back. Neither can be reached from a plain query - `Context` reads both once into a server-wide instance - so this runs `clickhouse-local` with a config file and with `--compatibility`. Covered: a `MergeTree` setting and a `Distributed` setting the config supplies; the table's own `SETTINGS` clause winning over the config; that clause naming a setting by an alias, which used to report the value as coming from nowhere accountable; `compatibility` rolling settings back, each away from its current default; and none of those origins appearing when nothing sets anything. `shared_metadata` stays uncovered here: reaching it means creating an `S3Queue` table, which needs both S3 and Keeper, so the integration tests are where it is first exercised. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
The source already skipped databases the filter excluded, but within a
database it opened every table: a scan naming one table still built the
settings of all of them. Reading a table's settings is not free - it reads
the stored `CREATE` query and reconstructs baselines - so the cost fell on
exactly the query the feature exists to serve.
Build a second filter expression over `{database, table}` and pass the
surviving names to `getTablesIterator`, which already accepts a predicate.
On 40 `MergeTree` tables, twenty scans naming one table each: 9.2 ms per
query before, 0.8 ms after.
Related: ClickHouse#116543
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
…ree` settings `Context::getMergeTreeSettings` applies the global `compatibility` when it builds the instance a table is created from, so reading a session's own value here compared the server's effective settings against a baseline the server never used, and could attribute a setting to `config` that came from `compatibility` or the other way round. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
`ASTSetQuery::formatImpl` converted every change's `Field` to a `String` just to hand it to `maskSettingValue`, which then looked the name up and, for almost every setting, returned nothing. Formatting a query with secrets hidden is on the query-logging path, so that was one wasted allocation per setting on every logged query carrying a `SETTINGS` clause. Add `canMaskSettingValue`, the same lookup without the value, and gate the conversion on it. Both entry points now share one `findMask`, so which settings are secret and what they look like masked cannot drift apart. `format_avro_schema_registry_url` stays outside that lookup: it belongs to no engine and masks only when the value really embeds a password, so it has no rule that always yields a masked rendering. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
It runs `clickhouse-local` over `MergeTree` and `Distributed` with a config file. Both engines are core and present in the fasttest build, and nothing in the test reaches an external service, so the tag only hid the test from a build that can run it. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
Its creator calls `getDataLakeStorageSettings` and builds a `StorageLocalDeltaLakeConfiguration` from the result, exactly like the other thirteen data lake registrations - but it was the only one of them whose `has_builtin_setting_fn` named `StorageObjectStorageSettings`, the predicate of the plain object storage engines. Nothing depended on the answer before, so the slip was invisible. Enumerating the settings makes it visible: `DeltaLakeLocal` reported 316 settings and none of the data lake ones, where `DeltaLake`, `DeltaLakeS3` and `DeltaLakeAzure` each reported 356. Test both families for agreement rather than for a count, so it holds as settings are added and passes in a build that has neither engine. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
…from `docs/reference/statements/show.mdx` is generated in full from the `SHOW` registration in `StatementFactory`, so a statement absent from that registration appears in neither `system.statements`, `system.documentation`, nor the published page. Every other `SHOW` variant has a section there. Use anchors that no existing section uses, so the generated page keeps the links it already has. Also point `system.engine_settings` at `system.table_settings` for the settings of one table. It said to read `SHOW CREATE TABLE`, which was the best answer available when that description was written and is now the wrong one - the `CREATE` query is exactly what can disagree with the settings in effect. Related: ClickHouse#116543 Related: ClickHouse#59913 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
Three of the eight `source` values appeared only in the enum declaration of the column, never as a row any test produced. `named_collection` is the one of those three that is reachable without external services: a collection can be created with DDL, and `Kafka` is the only engine that keeps the name of the one it was built from. The test asserts the three `other` rows alongside it, because they are the finding rather than noise - `StorageKafka`'s constructor pins those format settings itself, so attributing everything unstated to the collection would have credited it with settings it never carried. `shared_metadata` still has no test: producing it needs both S3 and Keeper. `runtime` has no producer at all yet. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
Four things the surrounding code does that this did not.
`ASTShowTableSettingsQuery` supports the AST JSON dialect now, as 68 of the
79 query nodes do and as its closest sibling `ASTShowColumnsQuery` does.
Without it `parseQueryToJSON('SHOW TABLE SETTINGS ...')` threw while the same
call on `SHOW COLUMNS` succeeded. `readJSON` rejects the payloads the parser
could not have produced - an empty table, or a `NOT`/`ILIKE` flag with no
pattern - because the formatter silently drops the latter.
It also overrides `updateTreeHashImpl`. Every field is a member rather than a
child, so the inherited implementation, which hashes only `getID()`, gave the
same hash to every `SHOW TABLE SETTINGS` query. Nothing keys off that today -
the query result cache takes only `ASTSelectQuery` and
`ASTSelectWithUnionQuery` - which is exactly why whoever adds the first
consumer would not notice.
`enumerateSettings.h` is renamed to `enumerateSettingsFromImpl.h` after the
one function it holds, per the naming rule for a file containing a single
function. The function keeps its name: every settings struct already has a
member called `enumerateSettings`, and the two should not be confused.
`StorageSystemTableSettings::createVirtuals` becomes public, as it is in
`StorageSystemColumns`, `StorageSystemTables`, `StorageSystemProjections` and
`StorageSystemDataSkippingIndices`.
Related: ClickHouse#116543
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
The branch was 1643 commits behind, and `git merge-tree` reported a real conflict: master's `TimeSeries: choose inner engine families by default_table_engine` appended functions where `enumerateSettings` had been appended here. Both are additive, so both are kept. Adding an engine that accepts settings but wiring no enumeration for it leaves it silently absent from `system.engine_settings` - `getFilteredEngines` skips an engine with no function, so there is no error to notice. Six engines are legitimately absent, all of which keep no settings struct, so the invariant can simply be listed: a seventh name appearing in that test means an engine was added without being wired. Those 1643 commits added none, and no existing system table changed shape. Related: ClickHouse#116543 Related: ClickHouse#59913 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
Staging `contrib` wholesale in the merge commit did two things it should not have. `contrib/spdlog` and `contrib/wasmedge` are untracked working directories on this machine, in neither `.gitmodules` nor master, and they were committed as embedded git repositories. Untracked again; the directories stay on disk. `contrib/libdivide` and `contrib/libucontext` are real submodules that master had advanced. The working tree still held the older checkout because `git submodule update` had not run after the merge, so staging the directory recorded the stale commits over the ones the merge had taken. Both are back to master's. The diff against master now contains no `contrib` entry at all. Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
Master moved 1390 commits in two days and `src/Storages/TimeSeries/TimeSeriesSettings.cpp` conflicted for the second time in three: `Rework the TimeSeries schema versioning` and its predecessor both append helper functions to the end of that file, which is where `enumerateSettings` had been sitting - line 204 of 209. Resolved by taking master's helpers, and by moving `enumerateSettings` up beside `enumerateEngineSettings` and `hasBuiltin`, where it belongs anyway. The three are the same kind of accessor, and grouping them keeps the end of the file free for whatever is appended next. Not repeated across the other nineteen settings files, though `enumerateSettings` sits within ten lines of the end in all of them. `MergeTreeSettings.cpp` looked like the pressing case at 53 master commits in thirty days, but none of them touch its tail: settings are added to the `DECLARE` list in the middle, and the file only grows there. `TimeSeries` is the one place master genuinely appends functions. Related: ClickHouse#116543 Related: ClickHouse#59913 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DGgpj9TmsDY7PSPWevjpUM
|
Workflow [PR], commit [3146502] Summary: ⏳
|
…t for an alias The documentation of the two tables and the statement left out rules the code enforces: - `system.engine_settings` did not say it needs a `SELECT` grant, as `system.merge_tree_settings` does. - `system.table_settings` did not say an `Alias` table is shown only to a user who may see its target, nor that a macro expanded into a secret is never shown; `SHOW TABLE SETTINGS` did not say an alias with a hidden target is an error. - `is_masked` named the grant and the query setting, but not the server setting `display_secrets_in_show_and_select`, which is needed too. - The shared `source` description said a named collection's value is hidden, which is `system.table_settings`'s rule and never applies to the engine rows of the other tables; it now says where. The four pages are regenerated from these strings. And the refusal of `SHOW TABLE SETTINGS` for such an alias now reads as the other access errors do - the user, and the grant it lacks - without naming the target, which `SHOW TABLES` on the alias alone does not reveal. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Drop includes nothing in their files uses, the declarations of the four `distributed_background_insert_*` settings `StorageDistributed` no longer reads, and the `query_context` parameter `StorageKafkaUtils::getTableSettings` never read. `getEngineStatedInDefinition` has no caller outside `TableSettingsHelpers.cpp`, so it moves into an anonymous namespace there. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Enumeration and `describeSettingsStatedInDefinition` each wrote their own loop asking `maskEngineSettingValue` under a setting's name and aliases, and `setEffectiveValue` asked under the declared name only, so a secret whose masking rule is registered under an alias would have shown through the effective value of `Kafka`, `NATS` or `RabbitMQ`. One overload taking the `SettingDescription` now asks under every name, and all three use it. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Say each rationale once, where the mechanism lives - secrecy of server secrets and named collections in `SettingRowWriter::masks`, the lifetime of the views in `SettingDescription`, origin recording in `BaseSettings` - and drop the restatements elsewhere. The comment on `IStorage::getTableSettings` also no longer says the base reports nothing for a view: a materialized view's own `ENGINE` can state settings, and the base reads them. Also drop the double blank lines the change introduced. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Drop the per-engine restatement that the settings object records the definition and a named collection - `BaseSettings` says that once - and the comments narrating how the code used to behave. `StorageObjectStorage` enumerates its configuration's settings only for a data lake, the one case that reports them. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- `setOriginByValue` becomes `withOriginByValue`, returning the settings as `withOriginFromDefinition` does, and `Join` and the `Log` family use it instead of their own copies of the rule. - `setEffectiveValueWithConfigFallback` reads the stated value from the settings object itself, so a call names the setting once. - `MergeTreeSettings::enumerateSettingsWithConstraints` replaces the enumerate-then-`applyConstraints` pair that `MergeTreeData` and the engine enumeration each wrote. - `system.table_settings` asks whether a filter reads a column through one lambda, and `SHOW TABLE SETTINGS` builds its `WHERE` clause once. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Say once what two neighbours both said - the secrets gate of the two engine settings tables, the named collection override of `MySQLSettings` and `PostgreSQLSettings`, why the replicated `MergeTree` family enumerates its own settings - merge the two stacked comments on the `Alias` refusal of `SHOW TABLE SETTINGS`, and write functions as `f` rather than `f()`. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`05055` and `05056` compared `system.engine_settings` and `system.table_settings` with `system.merge_tree_settings` in one direction, under the default configuration, and nothing compared them with `system.replicated_merge_tree_settings` or `system.s3_queue_settings`. - `05267`: every `MergeTree` family engine in `system.engine_settings` has exactly the rows of `system.merge_tree_settings`, or of `system.replicated_merge_tree_settings` for a replicated one, in every shared column, both ways. - `05268`: the same under `<merge_tree>` and `<replicated_merge_tree>` sections that set one setting differently, and with `compatibility`. - `05269`: `system.table_settings` agrees with `system.s3_queue_settings` on a queue table in names, types, descriptions and values compared as values, and the reference lists the two known differences, so a new one fails. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…settings-59913-116543 # Conflicts: # src/Storages/TimeSeries/TimeSeriesSettings.cpp
The `IStorage` base reads the stored definition through `describeSettingsStatedInDefinition`, not `withOriginFromDefinition`, and `Distributed` and the `Log` family also recompute origins with `withOriginByValue`. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`StorageNATS::getTableSettings` told a URL or server list a macro supplied by expanding the stated value with the server's current macros. A macro removed from the config since the table was built made that throw: the table's rows disappeared from `system.table_settings`, `SHOW TABLE SETTINGS` answered with nothing, and the logged message quoted the stated URL, credentials included, to any reader who asked for the server's logs with `send_logs_level`. It now compares the stated values with the ones the constructor built from the same expansion, as `RabbitMQ` already does. The comment of `SHOW TABLE SETTINGS` now says that only the lookup of the table is an error; settings that cannot be read are skipped, rather than raised with a message that may quote a secret. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A table that states no authentication of its own takes it from the server's `nats` or `rabbitmq` config section. Its password was always `[HIDDEN]`, but the username, and the `rabbitmq` `vhost`, were shown to any reader of the table's settings, though no other SQL surface shows them and `SHOW CREATE TABLE` never contained them. A value an engine takes from its server config section is now the server's, secret or not, and never shown. The `<merge_tree>` and `<distributed>` sections are unaffected: their values are the server's baseline, which `system.merge_tree_settings` already shows. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`ExecutablePool` assigns `max_command_execution_time` itself when its definition does not state it, which marks the setting changed, so a table stating nothing reported it with source `other` and `SHOW CHANGED TABLE SETTINGS` listed it. The value now decides, as for what `Distributed` copies from the server. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tion The `ENGINE ... SETTINGS` of a materialized view belong to its inner table, which reports them, and the view's own definition states none, so the base implementation parsed each view's stored definition to find nothing. The comment there also claimed the opposite since 4447d81. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…serve `05264` counted the rows of an `Alias` table whose target the reader may not see, but an alias states no settings and has no rows for any reader, so the count passed with or without the check it meant to cover; the statement's refusal is what the test pins. `05257` counted rows over every database, which made it fail when another test left an unreachable external database; it now counts under the two names the table could be reported under. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`system.engine_settings` described `ExecutablePool` by the compiled defaults, so it said 10 for `max_command_execution_time` while a table created on a server whose `max_execution_time` is lower takes that instead. The engine now registers its own enumeration, which fills the value in as the creator does, through the one function both use, and judges its source by value as the table rows are. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Hello @nikitamikhaylov I would like to provide a status update for this PR. As you can see, PR diff has already diff of 2.5k lines of code (+0.5k comments + 0.5k blanks).
Integration of settings enumeration for engine and table levels requires touching every engine setting struct and every storage engine .h and .cpp After a bunch of the recent commits, this PR is getting close to point when it becomes human readable and can pass automatic review from AI bot, and even become all-green once I'm doing manual code review of the changes and asking to fix my findings, and run AI /review periodically which often finds something to be fixed. A short overview of the feature implementation architecture. Instead of direct filling of column data in setting enumeration code, I've introduced intermediate container:
Interface between system tables implementation and storage engines:
Both system.engine_settings and system.table_settings are implemented in the same style as other similar system tables. For many engines, engine-level settings may be collected from its default-created settings struct, and table-level settings - read from a settings struct instance it holds. For tracking of setting value origin inside setting struct, structure is being declared with a new trait record_origin=true For cases if storage engine does not store settings in its own settings struct (e.g. just uses table definition) Some engines like S3/AzureQueue, Kafka, NATS, RabbitMQ, Join, Set, Distributed, Object storages Some points to highlight.
It's easy to move system.table_settings to system.tables column or even make visible in both places.
|
…it names `Merge` passes its table name pattern to the database's table iterator and does not check it again, so it relies on the iterator to apply it. `DatabasePostgreSQL::getTablesIterator` ignored that filter, so a `Merge` table over a `PostgreSQL` database read every table in it, whatever its pattern. This pull request made the iterator apply the filter, for `system.table_settings`; the test pins what that changes for `Merge`. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The `nats` section also supplies a table's token and credential file, and the `rabbitmq` section's `vhost` replaces the table's own rather than only filling in an absent one. A value a named collection supplied is masked whatever the secrets settings, unless the reader may read that collection. And a materialized view reports no settings: its `ENGINE ... SETTINGS` belong to its inner table. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`SettingOrigin` claimed its values were declared in the order engines apply them, but `MergeTree` applies `compatibility` before its config section. And `setEffectiveValue` claimed every `Config` value is hidden, which holds only for an engine's own section such as `nats` or `rabbitmq`: the `<merge_tree>` and `<distributed>` baselines are recorded by the settings object and shown. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rity tests `05267` and `05268` compare every engine whose name ends in `MergeTree` with `system.merge_tree_settings` or `system.replicated_merge_tree_settings`, but nothing says which of the two the `Shared` engines of a private build match. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…fault `background_insert_sleep_time_ms` and `background_insert_max_sleep_time_ms` default to `0`, meaning "the server's setting", which a table creator fills in. Judged against that `0`, every `Distributed` table, untouched or not, reported both as changed with source `other`. They are now measured against the default of the server setting they take, in `system.table_settings` and `system.engine_settings` alike: an untouched table reports `default`, and one on a server whose setting differs reports `other`. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…settings-59913-116543 # Conflicts: # src/Storages/IStorage.h
… its `try` A failed `CREATE TABLE` or `INSERT` before the `try` would have left the tables behind for `test_postgresql_fetch_tables`, which asserts the exact list of tables in the public schema. Related: ClickHouse#59913 Related: ClickHouse#116543 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
I’ve spent quite a bit of time reviewing the diff, and I don’t think it meets our quality standards. Its size and complexity make it difficult to follow, even as a maintainer, and I don’t see evidence of a thorough manual review + I don't think we need this many tests given that we don’t currently have comparable coverage right now. |
Closes: #116543
Closes: #59913
Related: #113269
Related: #116522
A table's settings are not always the ones its
CREATEquery states, and today there is no way to ask what they actually are. This adds two system tables and aSHOWstatement over them.system.engine_settings— the settings each engine accepts. This is @kaijaytu's [#59913] Implement system.engine_settings table #113269, carried over at @nikitamikhaylov's request and reworked; their commits keep their authorship.system.table_settings— the settings a particular table has, with the value in effect and asourcecolumn saying where it came from.SHOW [CHANGED] TABLE SETTINGS {FROM|IN} [db.]table [[NOT] [I]LIKE 'pattern'], a rewrite over the second, in the manner ofSHOW COLUMNS.The issue's own example — a
Kafkatable built from a named collection, whose settingssystem.tablescannot show:Which settings the collection supplied is the answer the issue asks for; their values stay as secret as
system.named_collectionskeeps them - a collection is secret as a whole, so a reader who may not read it there does not read it here either. What the table's own clause states is shown as before.sourceis one ofdefault,config,compatibility,named_collection,definition,shared_metadata,other- declared in the order engines apply them, soORDER BY sourcesorts by precedence.changedissource != 'default', as agreed on the issue.system.engine_settingsandsystem.merge_tree_settingsreport it too: a value a config section orcompatibilityset is named there as well, where before it was only marked as changed.Decisions I'd like from you
Six items below. Two of them, aliases and
runtime, are settled and kept so the reasoning stays visible; the other four are open. None blocks the rest, all are small, and I'll do whichever you say.1. Aliases — settled: both tables.
system.settingsgives an alias its own row with analias_forcolumn, and now so dosystem.engine_settings,system.table_settingsandsystem.merge_tree_settings: a user who knows only the old name finds the setting. Attribution needed the alias machinery anyway — a definition may name a setting by any alias, and without the matchSETTINGS monitor_batch_inserts = 1reportsotherinstead ofdefinition. The one alias rowsystem.merge_tree_settingsgains (allow_experimental_block_number_column) is filtered withalias_for = ''wherever tooling reads the table as a list of settings:03999_stateless_settings_history,upgrade_runner.sh, and the docs autogeneration queries underci/jobs/scripts/docs/autogenerate/sql/, which already filtersystem.settingsthat way.2. Should
system.merge_tree_settingsbecome a view oversystem.engine_settings? That is what #59913 proposes, and it is now exactly expressible — measured, not assumed: the names differ by 0 rows in a two-wayEXCEPT(same forreplicated_merge_tree_settings), the values are identical under a<merge_tree>config override and under--compatibility=23.3, and the columns match in order but for the leadingengine_name.05267and05268now pin that parity for every engine of the family, in every shared column and both ways, under<merge_tree>and<replicated_merge_tree>sections andcompatibilitytoo. With aliases inengine_settings, the view carriesAND alias_for = ''and still reproduces today's output row for row. I kept it out of scope, because it changes a table a lot of tooling reads and the safe default is that it keeps its present behaviour — but say the word and it is a small follow-up.3.
runtime— settled: removed. It was reserved for #116522, which the issue's "Additional context" names as the case it finds most interesting: aKafkabatch size reduced while the table runs, which a settings struct cannot report becauseStorageKafkakeeps the reduction in a member. It was a value with no producer and no test, while every other value of the enum has both, so it is gone; such a value reportsotheruntil an engine reports it as its own source, and the comment onOthersays where a new value belongs - before it, in the order the sources are applied in. Nothing stores these numbers, so #116522 can add it back without a migration.4. Eighteen columns on
system.table_settingsis a lot. Each is there becausesystem.merge_tree_settingsorsystem.settingsalready ships it;min/max/readonlywere dropped at one point as "always constant" and reinstated after measuring 100%NULLin both production tables. Each column costs about five lines. Happy to trim if you would rather have a narrower table — tell me which and I will cut them.5. One change outside the settings tables: the
MergeTreebaseline takescompatibilityfrom the global context.Context::getMergeTreeSettingsandgetReplicatedMergeTreeSettingsbuild the server-wide baseline once and share it with every session and every table created afterwards, but they appliedcompatibilityfrom whichever context asked first. This PR makes them read it from the global context. It is not a bugfix: I found no path where the first caller is anything else.Server::mainbuilds both at startup from the global context (Server.cpp#L3304-L3310), and inclickhouse-localI built the parent commit and measured it: a session'sSET compatibility = '23.3'rolls back 0MergeTreedefaults there too, while--compatibility=23.3rolls back 47, as before. It came from a review-bot finding on this PR and stays because it states in the code a rule the server already follows;05058pins that rule from the reader's side, andtest_table_settings_source::test_compatibility_is_reportedpins it on a real server, whose default profile is where the baseline reads it from: every settingcompatibilityrolls back is reported ascompatibilityand holds a value that is not the compiled-in default, and a server whose profile does not set it reports none. It touches code everyMergeTreetable depends on, so I am glad to drop it or move it to its own PR if you would rather keep this one to the tables.6. Who may read
system.table_settings— chosen: aSELECTgrant on it, thenSHOW TABLESper table. Easy to overturn. A row can say more than the table'sCREATEquery, so I compared each source with how ClickHouse already protects the same fact:sourcedefinitionSHOW CREATE TABLE,system.tables.create_table_querySHOW COLUMNS/SHOW TABLES, secrets masked — here the same, plus the grant on the tablenamed_collectionsystem.named_collectionsconfigvalues of thenats/rabbitmqsections (username, password,vhost)[HIDDEN]hereconfig/compatibilityvalues: the server's<merge_tree>,<distributed>sectionssystem.merge_tree_settings,system.server_settingsSELECTgrantKafkatopics,keeper_path, …)system.macrosSELECTgrantshared_metadata(S3Queuestate in Keeper)system.s3_queue_settingsSELECTgrantFour ways to go:
SHOW TABLES, likesystem.tables.SHOW TABLE SETTINGSthen needs whatSHOW COLUMNSneeds, but whoever sees oneMergeTreetable reads the server'sMergeTreeconfiguration, its macros and Keeper state.SELECTgrant onsystem.table_settings, then rows filtered bySHOW TABLES— whatsystem.parts,system.data_skipping_indices,system.projectionsandsystem.s3_queue_settingsdo.SHOW TABLE SETTINGSneeds the grant too, asSHOW INDEXneeds one onsystem.data_skipping_indices.sourceunless the reader may read the matching system table: precise, but every new source needs a rule,otheris a catch-all, and thesourcecolumn itself still says a config section set something.SHOW COLUMNS, asSHOW CREATE TABLEchecks — stricter thansystem.tables, which shows the same definition underSHOW TABLES.I implemented B. It is the pattern of every per-table introspection table except the three that show only definitions, it needs no per-source rules, and it is the safe end to start from: moving to A later stays compatible, moving from A to B after a release would not. Its one oddity: a user without the grant cannot read the settings of their own temporary table, which
SHOW CREATE TEMPORARY TABLEshows without one.05263pins the grant and05137theSHOW TABLESfilter.system.engine_settingsfollowssystem.merge_tree_settingsin any case — it reports the same server-wide values — so it needs aSELECTgrant under every option (05262).Why
source, and what enumerating every settings struct turned upA plain settings struct records only that a value changed, not who changed it. So
BaseSettingscan now also record where each value came from, for traits declared withDECLARE_SETTINGS_TRAITS_WITH_ORIGIN, which every engine settings struct andMergeTreeSettingsnow use: one 4-bitSettingOriginper setting in aCompactArray, about 185 bytes forMergeTree's 369 settings, kept the waycustom_settings_mapis kept for traits that allow custom settings. Every other settings class, coreSettingsincluded, holds an empty placeholder under[[no_unique_address]]and compiles the recording away withif constexpr:BaseSettingsover a two-setting traits measures 32 bytes without origins, as before, and 64 with them.set,resetToDefault,markUnchanged,read,readBinaryand the hot-reload path all keep the record in step, so nothing inBaseSettingsis virtual for it, and the origin API does not compile for traits that do not record origins. An engine that assigns a value itself uses the typedset(setting, value, origin)thatDECLARE_SETTINGS_TYPED_SETgenerates for its public settings class; an assignment throughoperator[]keeps the recorded origin, for a value adjusted in place such as by expanding macros. Whoever loads a value records where it came from as it assigns it - a server config section,compatibility, a named collection, the table's own definition - and the marks travel with every copy of the object, from the server's baseline or a database into each table. Most engines therefore reportsystem.table_settingsfrom their settings object alone, with no second look at the storedCREATEquery. What is left per engine is what no loader sees:Kafka,NATSandRabbitMQreport the values they work with (expanded macros, generated ids), the queue engines what Keeper holds, and the engines with no settings struct - plain object storage,Join,Set,File,URL, theLogfamily - what their clause states. A value is recorded as the definition's only where the stored definition states it: a restart or a shortATTACHloads it again without writing it back, so a setting a loader adds then stays unattributed (05239). Wiring the engines in batches with a verification query each caught three inferences that all looked obvious:KafkaStorageKafka's constructor pins three format settingsDistributedS3Queueshared_metadataat the line that reads each value from the metadataThings worth knowing before they are read as bugs:
DeltaLakeLocalwas registered against the wrong settings struct — a user-visible bug. Its creator buildsDataLakeStorageSettingslike its thirteen siblings, but itshas_builtin_setting_fnnamedStorageObjectStorageSettings. That predicate decides which names of aCREATE's singleSETTINGSclause stay with the engine (InterpreterSetQuery::applySettingsFromQuery), so a data lake setting that shares its name with a query setting — eleven do, e.g.iceberg_max_number_datafiles_to_compact— was applied to theCREATEquery and silently dropped from the table. Enumerating settings is what made the slip visible (320 settings whereDeltaLakeS3reported 360). Fixed here; covered by05194.Distributedtable said four settings had been set that nothing set.finalizeDistributedSettingscopies the server'sdistributed_background_insert_*settings into the ones the definition leaves out, and copying a field of the same type copies its changed bit with it - so aCREATEstating no settings reported four as changed, two of them holding the value they would hold anyway. The value decides there instead of the bit.MySQLdatabase gave its tables default settings — a user-visible bug.DatabaseMySQLbuilt each table withMySQLSettings{}instead of the settings of the database, so the database'sSETTINGSclause reached its connection pool and nothing else:connection_auto_close = 0on the database left every table disconnecting after each read. The tables now get the database's settings, and report them asother, since they are not the tables' own definition. Covered bytest_mysql_database_engine::test_table_settings_for_mysql_database, which checks what the tables report; no test measures the connection reuse itself. This and theDeltaLakeLocalfix above can each move to a PR of their own if you would rather keep this one to the tables.system.engine_settingsthrew on every query in [#59913] Implement system.engine_settings table #113269 as it stood —DatabaseDataLakeCatalogType::NONEhad no string form. Fixed and covered.Icebergreports 4paimon_*and 1delta*, because the family shares one struct — and ClickHouse really does acceptSETTINGS paimon_keeper_pathon anIcebergtable.Kafkareports 355, of which 35 arekafka_*.MergeTreewrites config values into the definition. Under<merge_tree><index_granularity>4096, the source isdefinition, notconfig:loadFromQuerymaterialises the immutable settings into the stored AST, so the value belongs to the table now and will not follow a later config change. A non-immutable one (merge_max_block_size) does reportconfig.named_collection, told apart from a default, from what the session supplied and from what the table's own clause states. Nothing is looked up when the table is read, so a collection altered afterwards cannot speak for a table it did not build, and a key the engine arguments overrode is not attributed to it: a table's arguments are its definition, as itsSETTINGSclause is, while aMySQLorPostgreSQLdatabase's are reported asotherin its tables, which state none of them. No comparison of values could do any of this, since a collection may well state the compiled-in default. The values themselves are hidden assystem.named_collectionshides them, sinceSHOW TABLESon one table is a weaker grant than reading a collection: a reader without that grant gets the names and[HIDDEN], which05243pins along with the two surfaces that refuse the same reader.Kafka,PostgreSQL,NATS,RabbitMQandMySQLdo this, all through one shared loader;YTsaurusgoes through it too but reports none, because a collection supplies only its connection keys, not its settings.Kafka,RabbitMQandNATSall expand macros in their settings.Kafkagenerates akafka_client_idandRabbitMQa queue base when none is given (reported asother);RabbitMQandNATStake credentials from their server config section when the table gives none (reported asconfig). Such a secret, and a macro from the server config expanded into a secret the table states, is the server's, and always[HIDDEN].use_hive_partitioningreports what the definition states, which is what decides whetherS3Queue/AzureQueueread hive columns from the path - notpartitioning_mode, into which it is folded.isValueChangedmeans nothing on a reconstructed settings object.StorageObjectStorageQueue::getSettingsassigns every setting it knows, so attribution compares against the default instead. It also does not assign what it does not know - the shared format settings, which are most of the struct - so those kept a compiled-in default while being attributed to the definition: a table statinginput_format_tsv_skip_first_lines = 2reported0, though the engine honours 2. They now report what the clause states, keyed off the one moment the rebuild's coverage is visible (enumeration reports a setting it assigned asother, one it never touched asdefault).05269compares a queue table's rows withsystem.s3_queue_settings, which still shows the default there; the only other difference ischangedfor a setting held in Keeper, which that table counts only where theCREATEquery states it.Joinkeeps no settings struct, and the six of its eight settings that its clause leaves out come from the server's settings, read from the global context when the table is loaded - not from the creating session, which a test atCREATEand atATTACHdisproved. It reports all eight from the values it holds:definitionif stated,defaultwhen equal to the default,otherwhen not, asDistributedreports what it copies from the server. ForDistributed,background_insert_sleep_time_msandbackground_insert_max_sleep_time_msdefault to0, meaning "the server's setting", so they are measured against the default of that setting - theirdefaultis 100 and 30000 - and a table that takes it reportsdefault(05196,05246). It is listed insystem.engine_settingsnow too, with the values a table created today would get, so its table rows and its engine rows agree. So is theLogfamily, whosediskandstorage_policynothing described before, since it keeps no settings struct either; its tables report both, with the disk the table keeps its data on - the one itsstorage_policychose where it named nodisk. An engine that rejects aSETTINGSclause can no longer register a settings enumeration at all -StorageFactoryrefuses it - where beforesystem.engine_settingssilently skipped one.Setreported nothing at all, althoughdiskandpersistent- the only two settings it acts on - are kept; both engines take those two rows from one helper now, so they describe them alike. TheKafkaengine has two storages and only one of them reported: a table that keeps its offsets in Keeper reported 6 rows where a plain one reports 355, with its macros unexpanded; both share one implementation now.05221,05222and05223cover them, including that the values reported are the ones the engines enforce.system.engine_settingsadvertised settings whose tables showed nothing. The six plain object storage engines build no settings object at all - the clause becomes aFormatSettings, which carries no setting names - so they report what their own clause states, asFileandURLdo; what the clause leaves out stays unreported, since nothing holds it under its own name. A setting a clause states is described from what its engine reports tosystem.engine_settings, so the two tables cannot describe it differently; the base implementation does that for every engine now, and reads no definition at all for a view, a dictionary or a system table.PostgreSQL,QueryRunnerandMaterializedPostgreSQLdo have a settings object and only dropped it, so each keeps it and enumerates on demand, asKafkaand the queue engines do;PostgreSQLhad nothing to keep, and its three creators - the engine, thePostgreSQLdatabase and thepostgresqltable function - now pass the settings they build their connection pool from.PostgreSQLSettingsoverlays the whole of the creating session, which marks every setting changed and so says nothing about provenance, so the source is recomputed from the value:definitionwhere the clause states it,defaultwhere it is the compiled-in default,otherotherwise. An object storage row also carries the type, default, description and tier its settings struct declares, so an obsolete setting does not describe itself as a production one. With this no engine reports nothing any more, and05139, which pinned the gap, is deleted rather than inverted;05224to05228replace it, with integration tests for the paths that need a real PostgreSQL, NATS or RabbitMQ. A table of aMaterializedPostgreSQLdatabase is a different thing again: the replication settings belong to the database, and the table is listed as the nested table the data is materialized into, so what it reports is that table's settings.parallel_insertsbug, ObjectStorageQueue: parallel_inserts is declared in the table metadata and never written, so the setting has no effect #119018. Two smaller oddities are documented rather than reported: a data lake catalog's copy of its own settings into each of its tables is a no-op - harmlessly, since thosestorage_*settings are deprecated andgetCatalogrejects them, so a copy that worked would break every catalog table; andafter_processing_move_access_key_idprints in clear, which matches how engine arguments treat an access key id, while the data lake registry masks its own spelling of the same thing. Its own findings have since been fixed - see the two bullets above.Secrets, access and performance
SHOW CREATE TABLE. Masking here is per row rather than whole-statement, sois_maskedtells a redaction apart from a value that is literally[HIDDEN]- and it is 1 only where something was hidden, since several of those rules render whatever they are given and a URI with no password in it comes back as it went in. A value is asked about under every name its setting answers to - whether enumerated, stated in the clause, or the effective value an engine reports - so a rule registered under an alias covers the setting however it is spelled.valuethe same way -system.engine_settingsandsystem.merge_tree_settingstoo, although only the server configuration could put one there - and write their rows through oneSettingRowWriter, so they cannot drift on masking or on alias rows.defaultis printed as compiled in, which is safe only while every secret engine setting defaults to empty;05214pins that, finding the secret settings from the maskedquery_logtext rather than a list, so a secret added later is covered.SELECTgrant onsystem.table_settings, thenSHOW TABLESper database and per table, plusdisplaySecretsInShowAndSelectfor real values - see decision 6.SHOW TABLE SETTINGSon a table that does not exist, or that the user may not see, is an error (UNKNOWN_TABLE,ACCESS_DENIED), as forSHOW CREATE TABLE, rather than an empty result that would read as a table with nothing changed (05240,05137).databaseandtableare pushed into the scan, so naming one table does not open the rest of the database: 0.8 ms per query against 9.2 ms on 40MergeTreetables. Fortable = '...'the name itself is the filter, with nothing listed first, andDatabasePostgreSQL::getTablesIteratornow applies the name filter it used to ignore, before it fetches each table's structure - so aPostgreSQLdatabase is asked about the one table named.Mergepasses that filter too, and relies on it: aMergetable over aPostgreSQLdatabase now reads only the tables its pattern names, where it used to read every table of that database (test_postgresql_database_engine).system.tablesandsystem.columnscall the iterator without one.engineis pushed down as well, applied as soon as a table is resolved and before its settings are read, assystem.tablesdoes: 2 ms against 10 ms forWHERE engine = 'Log'over 123 tables. A view, a dictionary and a system table are skipped without reading their definition at all, which halved a full scan of 65208 rows, from 31 ms to 16 ms.system.tablesasks it. Counted against a mock Iceberg REST catalog,SHOW TABLE SETTINGSfor one table dropped from 7 catalog requests to 3, and a database-only query from 13 to 8; the only extra request since then is one lookup per table whose metadata could not be resolved. A table whose metadata cannot be fetched still fails the query with the catalog's error underdatabase_datalake_require_metadata_access(covered intest_database_iceberg). ARemotedatabase keeps the plain iterator, so an unreachable server yields no rows rather than an error, whether the query names a table or only the database;SHOW TABLE SETTINGSlooks the table up itself and reports the error (05215).SHOW TABLE SETTINGS FROM tresolvestto a session temporary table first, asSHOW CREATE TABLEdoes, and reads the table once: a pattern is matched against every name a setting answers to by grouping the rows the table already returns, rather than by a secondSELECTover it, which for a queue table would fetch its settings from Keeper twice.test_table_settings_source::test_config_source_survives_a_restart;05239covers the same for the definition).shared_metadatais covered without an S3 endpoint (05140), including a value in Keeper outranking what the table's ownCREATEquery states.05219pins the values a queue table reports for settings it keeps nowhere, and05220pinsALTER ... MODIFY SETTING/RESET SETTINGreporting. A value an engine adjusts while it runs, which Reduce the Kafka streaming batch size after a memory limit error instead of retrying the same size #116522 is about, is reported asotheruntil an engine reports it as its own source.Known limitations
Kafkadoes not report what its<kafka>server config section supplies - the SASL credentials and the security protocol - when the table states none:system.table_settingsshows the empty setting with sourcedefault, while the consumer uses the section's value. Reporting it properly means capturing the section's values when the table is built; left for a follow-up.S3Queue,AzureQueue) reports every setting held in Keeper asshared_metadata, and so as changed, even where the value is the compiled-in default - Keeper is where the table takes it from.SHOW CHANGED TABLE SETTINGSon a queue table therefore lists about a dozen such rows.MergeTreeSettings::loadFromQuerytakes aLoadFromQuerystruct instead of two booleans;MergeTreeSettings::dumpToSystemMergeTreeSettingsColumnsandStorageMemory::getMemorySettingsRefare removed (getMemorySettingsreturns a snapshot);StorageEmbeddedRocksDB::getSettingsreturns a snapshot;applyChangesisapplyDefinitiononMemorySettings,RocksDBSettingsandGenerateRandomSettings;DECLARE_SETTINGS_TRAITS_COMMONtakes one more argument.05267and05268leave out theShared*engines of that build. One contract changes without a compile error: a masking rule in an engine'sSETTINGS_TO_HIDEnow returns the masked value itself ([HIDDEN]), andASTSetQueryadds the SQL quotes - all six public registries are converted, but a rule of the private build that still returns'[HIDDEN]'would print doubly quoted inSHOW CREATE TABLE.BaseSettingschanges nothing for a settings struct that does not opt intoDECLARE_SETTINGS_TRAITS_WITH_ORIGIN: the public macros keep their signatures, the origin record takes no space, and no serialized form includes it.Size of the change
Most modified C++ files change a few lines — the
DECLARE_SETTINGS_TRAITS_WITH_ORIGINof each settings struct and oneenumerateSettingsdeclaration, plus its registration (enumerateCompiledDefaults<XSettings>for the engines that show their compiled defaults), and each loader recording the origin it assigns — and most of those are files #113269 already touched; the design lives in about fifteen files, most of them new.Against the merge base; "≤ 20 lines" counts files that change 20 lines or fewer, "Also in #113269" counts files that pull request touched (63 in all).
.h/.cpp), modified.h/.cpp), newOne of the new files is existing code that only changed address:
engineSettingsToHide.his the masking registry list that used to sit inASTSetQuery.cpp. It does not show up as a rename ingit diff -M -C, because it is a function-level extraction - comparing it against the merge-base version is the fastest way to confirm nothing changed in the move.This branch had extracted a second one,
extractTableNameFilter.{h,cpp}, the filter pushdownsystem.tablesalready had; master has since extracted the same logic into the same two files forsystem.iceberg_history, so the merge takes master's and this pull request only calls it - withtableas the column, sincenamehere is the setting's name.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added
system.engine_settings, listing the settings each table engine accepts, andsystem.table_settings, listing the settings in effect for each table together with asourcecolumn saying where each value came from — a default, the server config,compatibility, the table's ownSETTINGSclause, a named collection, or shared metadata in Keeper.SHOW [CHANGED] TABLE SETTINGS FROM <table>queries the latter.system.merge_tree_settingsandsystem.replicated_merge_tree_settingsgain two columns:source, betweenchangedanddescription, andalias_forat the end. They also gain a row for each alias of a setting, assystem.settingsalready has - today one,allow_experimental_block_number_column, an alias ofenable_block_number_column. So a query that reads these tables as a list of settings, one row per setting, should addWHERE alias_for = ''; one that selects every column sees two more; and one that reads columns by position rather than by name sees everything afterchangedmove by one.Both new tables are read as
system.merge_tree_settingsandsystem.partsare: with aSELECTgrant on the table whereselect_from_system_db_requires_grantis on, its default.system.table_settingsalso shows only the tables the reader maySHOW TABLES- for anAliastable, the table it is an alias of too - andSHOW TABLE SETTINGS, which reads it, needs the same privileges. A secret is masked as inSHOW CREATE TABLE. The value of a setting a named collection supplied is reported as[HIDDEN], whole, unless the reader may read that collection fromsystem.named_collections- secret as a whole, as that table andSHOW CREATE TABLEalready treat a collection. A value a table takes from the server configuration'snatsorrabbitmqsection - the username, password orvhostof a table that states none of its own - and a macro from it expanded into a secret the table or its named collection states, are always[HIDDEN].Two engines behave differently as a result, both because a setting they accepted was being ignored. A
MySQLdatabase now passes its own settings to the tables it makes rather than compiled-in defaults. The connection pool already took the database'sSETTINGS- its size, timeouts and retries are unchanged - so what changes isconnection_auto_close: withconnection_auto_close = 0on the database, or in its named collection, its tables keep up toconnection_pool_sizeidle connections to the MySQL server open for every table that has been read, where they used to close them after each read. To keep the previous behaviour, remove it. And aDeltaLakeLocaltable'sSETTINGSclause is now stored as the table's own engine settings, as it already is forDeltaLakeon S3 and Azure, rather than applied to theCREATEquery and dropped. This changes only the settings whose names are also query settings; the one with an effect before wasallow_experimental_delta_kernel_rs, which used to switch delta-kernel off for theCREATEitself and is now stored and ignored, as it is for the otherDeltaLakeengines. Separately, aMergetable over aPostgreSQLdatabase now reads only the tables its pattern names: the database ignored the table filterMergerelies on, so such a table used to read every table of that database.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/118544]