Repository navigation
Add embedded documentation for database engines - #106178
Conversation
Attach the shared `Documentation` struct (introduced for table engines) to database engines via `DatabaseFactory::registerDatabase`, and expose `description`, `syntax`, `examples`, `introduced_in`, and `related` columns on `system.database_engines`. For every engine that has a dedicated documentation page under `docs/en/engines/database-engines/` (`Atomic`, `Replicated`, `MySQL`, `PostgreSQL`, `MaterializedPostgreSQL`, `SQLite`, `Backup`, `DataLakeCatalog`), the complete Markdown body of that page is embedded verbatim into the `description` field, so the standalone Markdown files can later be dropped and regenerated from the embedded documentation. Engines without a dedicated page (`Memory`, `Ordinary`, `Dictionary`, `Filesystem`, `S3`, `HDFS`) keep a concise description. This is a follow-up to the same change for table engines and reuses the `Documentation` struct from `src/Common/Documentation.h`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [64398d8] Summary: ✅
AI ReviewSummary
Findings
Final VerdictStatus: Minimum required actions: fix the two invalid runtime documentation examples and keep the embedded strings in sync with the standalone Markdown pages. |
- Strip trailing whitespace from the embedded Markdown documentation in `DatabaseAtomic.cpp` and `DataLake/DatabaseDataLake.cpp` (style check). - Restrict `04300_database_engines_documentation` to engines that are always compiled in (`Atomic`, `Replicated`, `Memory`): the `Fast test` build does not include the `MySQL` and `PostgreSQL` database engines, so those rows are absent from `system.database_engines`. - Remove `MaterializedMySQL` from the `related` engines of `MySQL`: it is not registered in `DatabaseFactory` and cannot be resolved through `system.database_engines`. Add a regression assertion that every `related` value of an always-present engine is itself a registered engine. - Update the `system.database_engines` documentation example to `SELECT name` so the shown response shape matches the query. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Normalize the indentation of the embedded `OneLake Catalog` example in `DatabaseDataLake.cpp` (and the source `datalake.md`) to multiples of 4, so the C++ style check no longer flags the verbatim Markdown that lives inside a raw string literal. Indentation inside a fenced ```sql``` block is cosmetic, and the bullet continuation still renders as part of the list item. - Fix the `system.database_engines` documentation example: drop the unregistered `Lazy` engine, add `ORDER BY name` for stable output, and correct the response block to match (`Atomic`, `Ordinary`). - Document `Documentation::related` as cross-build cross-reference metadata that may name components disabled by compile-time options, so listing `S3`/`HDFS` as related to `Filesystem` in builds without `USE_AWS_S3`/ `USE_HDFS` is intended rather than a missing row. - Renumber the new stateless test to `04305` to avoid a prefix collision with tests added on master. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…e engine
The `syntax` field of the `Backup` database engine in `system.database_engines`
exposed `ENGINE = Backup('database_name', 'backup_destination')`, where the
second argument is a string literal. However, `parseArguments` passes that
argument to `BackupInfo::fromAST`, which requires an `ASTFunction` and throws
`Expected function, got 'backup_destination'`. Use a destination function form
instead, consistent with the embedded documentation body.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…umentation # Conflicts: # src/Common/Documentation.h
|
Continued work on this PR:
Built cleanly and verified The remaining red was 4 |
The `description` field of the `Backup` database engine, now user-visible
through `system.database_engines`, still showed a first `CREATE DATABASE`
example with a string-literal second argument:
`ENGINE = Backup('database_name_inside_backup', 'backup_destination')`.
`parseArguments` passes that argument to `BackupInfo::fromAST`, which requires
an `ASTFunction` and throws `Expected function, got 'backup_destination'`.
Replaced the broken generic example with the valid destination-function form
`Disk('disk_name', 'backup_name')` (consistent with the `syntax` field) and
dropped the now-redundant duplicate example block. Applied the same change to
the standalone `docs/en/engines/database-engines/backup.md` page so the two
stay in sync.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Continued work on this PR:
Verified against a freshly built binary:
The previously reported integration failures ( @groeneai, the |
|
@alexey-milovidov, investigation summary on CIDB cross-PR pattern (last 30 days)
Root cause: Keeper TSan data race in
|
…ings The embedded `description` for the `MySQL` database engine was missing the `[SETTINGS enable_compression=0]` syntax clause and the `enable_compression` settings section that the dedicated `docs/en/engines/database-engines/mysql.md` page carries. Since `MySQL` has `.supports_settings = true` and `enable_compression` is a real `MySQLSettings` entry, users querying `system.database_engines` would have missed a supported option, and a future regeneration of the Markdown page from this field would have dropped it. The embedded block now matches the page verbatim. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The example created `postgres_db` but the subsequent query selected from `postgresql_db.postgres_table`, referencing a database that was never created. Use `postgres_db` consistently in the embedded documentation and in `docs/en/engines/database-engines/materialized-postgresql.md`. Co-Authored-By: Claude Fable 5 <[email protected]>
The example query in the embedded documentation (now exposed through `system.database_engines`) ended with `:` instead of `;` and had the response table inside the same `sql` fence, so copying it produced a syntax exception. Terminate the query with `;` and move the response into a `text` fence, here and in `docs/en/engines/database-engines/backup.md`. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Addressed both review threads:
The only CI failure, BuzzHouse (amd_debug) |
|
Checked the CI status. Both red checks are unrelated to this PR (which only embeds documentation strings for database engines):
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106178&sha=a7f556e14d44150adcb36866d25c60695c517ab0&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29 (the runner-wide @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106178&sha=a7f556e14d44150adcb36866d25c60695c517ab0&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%29 ( No changes pushed: zero unresolved review threads, the branch merges cleanly, and the merge base is less than a week old. The PR is blocked only on approval. |
|
@alexey-milovidov You are correct that both red checks are unrelated to this doc-only PR. Here is the status of each, with fresh CIDB data. 1. Stress test (arm_asan_ubsan): This was a regression from #106020 (multistage distributed queries, merged 2026-06-09 15:25 UTC). Worker-side Fixed by #106944 ("Fix logical error when table is dropped before distributed plan task deserialization", by Alexander Gololobov), merged 2026-06-10 14:56 UTC, which closed #106906. The 29 occurrences you cite are all inside the 2026-06-09/06-10 regression window. CIDB confirms zero 2. Stateless tests (arm_asan_ubsan, azure, parallel): Confirmed: the 5 tests died in the same two-minute window because the arm_asan_ubsan azure parallel shard hit the runner-wide ~53.69 GiB RSS cap (OvercommitTracker arbitration on total server RSS, not any one query's
So it peaked on 06-10 and has effectively subsided. This is a runner capacity / scheduling issue rather than a fix-in-one-commit code bug, so there is no single PR that closes it. The actionable slices already in progress:
If you want a structural separate PR (e.g. lowering parallelism or the per-shard memory budget on this runner, or splitting the heaviest tests off the parallel lane), #106175 already poses exactly that question and I will proceed the moment you confirm the approach. Otherwise the per-test disables above plus the natural subsidence should keep this off your PRs. Net: both red checks are pre-existing CI issues, neither caused by your documentation strings. #106178 is safe to merge. |
|
Merged `master` (`f747c2bb7bc`): branch was 2152 commits behind (merge-base 2026-06-07) and red. The stress red Merge was clean with no conflicts; the PR diff is unchanged (only the embedded-docs files + tests The remaining stateless reds (arm_asan_ubsan, azure) are the master-wide runner memory-limit flake class — all five failures hit |
| For example: | ||
|
|
||
| ```sql | ||
| CREATE TABLE db (n UInt64) ENGINE = Atomic SETTINGS disk=disk(type='local', path='/var/lib/clickhouse-disks/db_disk'); |
There was a problem hiding this comment.
This description is now exposed through system.database_engines, but the metadata-disk example is a CREATE TABLE statement using the database engine Atomic as a table engine. That query cannot parse as a valid table engine clause, so users copying the runtime docs get an exception instead of a database with metadata on the configured disk. Please make this a database statement here and in docs/en/engines/database-engines/atomic.md, for example:
CREATE DATABASE db ENGINE = Atomic SETTINGS disk=disk(type='local', path='/var/lib/clickhouse-disks/db_disk');| ENGINE = DataLakeCatalog(catalog_endpoint) | ||
| SETTINGS | ||
| catalog_type = 'onelake', | ||
| warehouse = warehouse, |
There was a problem hiding this comment.
This OneLake example is now user-visible via system.database_engines.description, but these settings values are parsed by ParserSetQuery::parseNameValuePair, which accepts literals or disk(...) functions after =, not bare identifiers. As written, warehouse = warehouse and the following string settings fail at parse time before DatabaseDataLakeSettings::loadFromQuery runs. Please quote the placeholder values here and in docs/en/engines/database-engines/datalake.md, e.g. warehouse = 'warehouse', onelake_tenant_id = 'tenant_id', oauth_server_uri = 'server_uri', etc.
|
@alexey-milovidov Correct on both, and the re-merge cleared the stress half. Stress Azure
Peaked 06-10, now near-zero on master. There is no fix PR because this is not a one-commit code bug: it is a runner capacity/scheduling problem. The concrete decision is disabling the heaviest tests on this lane (mirroring #106797, merged) vs a shard-level memory/parallelism change to the runner env. That call is yours, and I already posed exactly that fork on #106175 (issuecomment-4656035147, 2026-06-09); it is still open. Pick one there and I will execute it in a separate PR. Both reds are unrelated to the embedded-docs strings; #106178 is safe to merge. Session id: cron:clickhouse-worker-slot-2:20260613-054200 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 922/922 (100.00%) | Lost baseline coverage: none · Uncovered code |
This is the second PR in the series that adds embedded, runtime-introspectable documentation to ClickHouse component registries. The first (#106177) did this for table engines; this one does it for database engines.
What it does:
Documentationstruct (introduced in Add embedded documentation for table engines #106177,src/Common/Documentation.h) to every database engine viaDatabaseFactory::registerDatabase.system.database_enginesnow exposesdescription,syntax,examples,introduced_in, andrelatedcolumns (previously it had onlyname).docs/en/engines/database-engines/—Atomic,Replicated,MySQL,PostgreSQL,MaterializedPostgreSQL,SQLite,Backup,DataLakeCatalog— the complete Markdown body of that page is embedded verbatim into thedescriptionfield, so that the standalone Markdown files can later be dropped and regenerated from the embedded documentation. Engines without a dedicated page (Memory,Ordinary,Dictionary,Filesystem,S3,HDFS) keep a concise description.Note: this PR shares the
Documentationstruct (src/Common/Documentation.h/.cpp) with #106177. Whichever merges first, the other will have a trivial add/add for those two files.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Database engines now carry embedded documentation, introspectable via the new
description,syntax,examples,introduced_in, andrelatedcolumns of thesystem.database_enginestable.Documentation entry for user-facing changes
system.database_enginesand an updatedsystem.database_enginessystem-table page).Version info
26.6.1.775