Skip to content

[#59913] Implement system.engine_settings table - #113269

Closed
kaijaytu wants to merge 3 commits into
ClickHouse:masterfrom
kaijaytu:CLICKHOUSE-59913
Closed

kaijaytu wants to merge 3 commits into
ClickHouse:masterfrom
kaijaytu:CLICKHOUSE-59913

Conversation

@kaijaytu

@kaijaytu kaijaytu commented Aug 4, 2026

Copy link
Copy Markdown

Add a new system.engine_settings system table that exposes settings for all table engines, not just MergeTree. The table has the same structure as system.merge_tree_settings plus an engine_name column, allowing users to discover available settings for any engine via SQL.

Closes: #59913

Changelog category (leave one):
New Feature
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added system.engine_settings table that shows all available settings for every table engine (Memory, Kafka, Distributed, RocksDB, etc.), not just MergeTree.

Add a new system table that exposes settings for all table engines,
not just MergeTree. Introduces FillEngineSettingsFn in StorageFactory
and the StorageSystemEngineSettings class. Engines with no registered
fill function are skipped, so the table is empty until engines wire in.
Register fillEngineSettingsColumns for 18 engine settings classes
(MergeTree, Memory, Distributed, Kafka, RabbitMQ, NATS, MySQL,
PostgreSQL, RocksDB, ObjectStorage, etc.) so they appear in
system.engine_settings.
Basic stateless test verifying the table exists, has the engine_name
column, and returns settings for known engines.

Also wire DataLakeStorageSettings which was missed in the previous commit.
@CLAassistant

CLAassistant commented Aug 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kaijaytu

kaijaytu commented Aug 4, 2026

Copy link
Copy Markdown
Author

@cla-assistant check

@buggins buggins mentioned this pull request Sep 2, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-system-table system.* tables (introspection, system metadata, performance visibility). label Sep 4, 2026
@buggins

buggins commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@kaijaytu — a heads-up, and thanks for this.

@nikitamikhaylov asked me to take this over while I work on SHOW TABLE SETTINGS
(#116543 (comment)), so your three
commits are now on my branch, cherry-picked so they keep you as their author. The registration hook
next to has_builtin_setting_fn and the per-struct exposure are the shape I've built on, and the
new pull request is #118544.

Rebased onto current master it turned out SELECT from the table threw
Unexpected value of DatabaseDataLakeCatalogType:0, because that enum's default has no string in
its mapping — a pre-existing gap, nothing to do with this PR, and one that CI would have caught had
it run here. It never did, and the reason is structural rather than anything you missed: CI runs on
self-hosted runners, so a pull request from a fork does not start until a maintainer adds the
can be tested label, which is a decision to execute your code on their machines rather than a
comment on the change. This PR has only comp-system-table, so no check ever started.

On top of your commits I've added the missing enum name, migrated the fill hook onto a per-struct
enumeration now shared with system.table_settings, made it take the query context so MergeTree
and Distributed report the values the server config actually gives them rather than compiled
defaults, and rewritten the test against real output.

Two things came out of that which are yours as much as mine:

DeltaLakeLocal was registered against the wrong settings struct. Its creator builds
DataLakeStorageSettings like the other thirteen data lake registrations, but its
has_builtin_setting_fn named StorageObjectStorageSettings, the predicate of the plain object
storage engines. Nothing read that answer before, so it was invisible — enumerating settings made
DeltaLakeLocal report 316 where DeltaLakeS3 reported 356. Fixed on the branch, with a test that
asserts the members of each family agree rather than pinning a count.

Should either table emit alias rows? Deliberately not decided, partly because one of the two
tables is yours. system.settings emits an alias as its own row carrying alias_for = <primary>;
system.merge_tree_settings emits neither the row nor the column, though MergeTreeSettings does
declare an alias. The two production tables disagree, and system.table_settings followed the
first while system.engine_settings followed the second - so the branch currently has one of each,
which is an accident of provenance rather than a design.

Whichever way it is settled, both tables should match: either both gain alias rows, which means
about 14 lines and 28 extra rows in yours, or table_settings loses them, which means deleting
about 12 lines from mine. Either way the alias machinery itself stays, because attribution needs it

  • a definition may name a setting by any alias, and without the match
    SETTINGS monitor_batch_inserts = 1 reports other instead of definition.

It is raised as an open question in the new PR with the evidence and both costs. Your view would be
welcome, since one of the two outcomes lands on your table.

Two things about where this leaves your PR, and I'd rather be plain about both.

The work is going out as one pull request rather than two: system.engine_settings and
system.table_settings share the per-struct enumeration, and a PR based on another unmerged one
gets no CI, so splitting them is not practical.

But please don't close this one on my account. Mine is a test task submitted as part of a job
application — it may well not be accepted, and I have no standing to promise otherwise. If it lands,
this is superseded by something that contains your commits under your name. If it does not, yours is
untouched and remains the live proposal for #59913, and the fixes above are things you can take from
my branch whether or not I am still involved. Either way the decision is yours and the maintainers',
not mine.

I'd welcome your review — and @Ergus, you offered to review on #59913, so likewise.

@shankar-iyer

Copy link
Copy Markdown
Member

@kaijaytu Thanks for the contribution! As discussed in #116543 (comment), this work will be continued in #118544

buggins added a commit to buggins/ClickHouse that referenced this pull request Sep 13, 2026
Review: ClickHouse#118544

⚠️ Changes user-visible column descriptions of `system.merge_tree_settings`, which
predates this pull request. Kept on a side branch pending a maintainer's
approval of the unified wording.

`system.engine_settings`, `system.merge_tree_settings` and `system.table_settings`
carry the same thirteen columns - `name`, `value`, `default`, `changed`,
`description`, `min`, `max`, `disallowed_values`, `readonly`, `type`,
`is_obsolete`, `tier`, `alias_for` - and each declared and wrote them itself.
`SettingsTableColumns` now does both:

- `sharedSettingColumns` declares them. `engine_settings` prepends `engine_name`,
  `merge_tree_settings` uses them as they are, `table_settings` wraps them in
  `database`/`table`/`engine` and `source`/`is_masked`, via `ColumnsDescription::add`.
- `insertSharedSettingColumns` writes them, in the order `sharedSettingColumns`
  declares. Before, the writer could only assume an order that each table declared
  independently; now the declaration and the writer sit side by side.

The descriptions are worded as facts about a setting rather than about a table,
so one text reads correctly in all three: "Only `MergeTree` settings can be
constrained" is true everywhere, where "Empty for every engine other than
`MergeTree`" read oddly in a single-family table. The original
`system.engine_settings` pull request (ClickHouse#113269) had copied
`system.merge_tree_settings`' wording verbatim, so sharing it restores what was
intended. Two of the changes are corrections: `readonly` no longer implies it
covers `ALTER` permission, and `changed` now says that assigning a setting the
value it already had counts.

`system.table_settings` overrides two, through `ColumnsDescription::modify`:
`value`, which only there can be a masked placeholder, and `tier`, which only
there is reported for a setting known solely from a `SETTINGS` clause.

Verified on a running server rather than by tests, since no test asserts column
descriptions:

- `system.merge_tree_settings` and `system.engine_settings` restricted to
  `MergeTree` still differ in zero rows across all thirteen columns, both ways;
- column order is unchanged in all three tables;
- of the thirteen shared columns, only `value` and `tier` have more than one
  description, and the second text is on `system.table_settings` in both cases.

⚠️ Not a size reduction: 204 lines removed, 223 added, net +19. The shared unit
is 147 lines once its doc comments and includes are counted, and
`system.table_settings` keeps its two overrides and a named helper for the long
`source` description. What this buys is one definition of the columns instead of
three.

Related: ClickHouse#59913

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VM7vZavJcWGZ9DCuoA5oHW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-system-table system.* tables (introspection, system metadata, performance visibility).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement system.engine_settings

4 participants