Skip to content

Add embedded documentation and a system table for disk types - #106187

Merged
alexey-milovidov merged 11 commits into
masterfrom
disk-type-documentation
Jun 12, 2026
Merged

alexey-milovidov merged 11 commits into
masterfrom
disk-type-documentation

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Part of the series adding embedded, runtime-introspectable documentation to ClickHouse component registries (table engines #106177, database engines #106178, data types #106180, formats #106181, dictionary layouts #106182, dictionary sources #106184, aggregate function combinators #106185, data skipping index types #106186). This one covers disk types (which include the object-storage backends) — and, since there was no system table for them, adds one.

What it does:

  • Adds a new system.disk_types table listing every disk type with embedded documentation columns description, syntax, examples, introduced_in, and related. (This complements system.disks, which lists the disk instances configured on the server.)
  • Threads the shared Documentation struct (src/Common/Documentation.h) through DiskFactory::registerDiskType, stores it in a per-type map, and adds getAllRegisteredNames and getDocumentation accessors.
  • Populates all 12 disk types: local, encrypted, cache, object_storage, s3, s3_plain, s3_with_keeper, s3_plain_rewritable, hdfs, azure_blob_storage, local_blob_storage, web.

Note: this PR shares src/Common/Documentation.h/.cpp with the earlier PRs in the series (trivial add/add on merge).

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Added a new system.disk_types table that lists the available disk types together with embedded documentation (description, syntax, examples, introduced_in, related).

Documentation entry for user-facing changes

  • Documentation is provided as part of this change (embedded documentation in system.disk_types and a new system.disk_types system-table page).

There was no system table exposing the available disk types
(`system.disks` lists configured disk instances, not types). This adds
`system.disk_types`, and attaches the shared `Documentation` struct (introduced
for table engines) to disk types.

- `DiskFactory::registerDiskType` now takes a final `Documentation` argument,
  stored in a per-type map, with `getAllRegisteredNames` and `getDocumentation`
  accessors.
- The new `system.disk_types` table exposes `name` and the embedded
  documentation columns `description`, `syntax`, `examples`, `introduced_in`,
  and `related`.
- All 12 disk types (`local`, `encrypted`, `cache`, `object_storage`, `s3`,
  `s3_plain`, `s3_with_keeper`, `s3_plain_rewritable`, `hdfs`,
  `azure_blob_storage`, `local_blob_storage`, `web`) get a description and
  syntax.

This is a follow-up to the embedded-documentation changes for table engines,
database engines, data types, formats, dictionary layouts/sources, aggregate
function combinators, and data skipping index types, and reuses the
`Documentation` struct from `src/Common/Documentation.h`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2ce4ba8]

Summary: ✅


AI Review

Summary

This PR adds embedded documentation for disk types and exposes it through the new system.disk_types table. The current implementation matches the sibling embedded-documentation registries, and the earlier lifecycle, implicit-access, optional-backend coverage, and s3_with_keeper availability issues have been addressed. I found no correctness blockers; one previously raised documentation-frontmatter policy mismatch remains non-blocking.

Findings

💡 Nits

  • [docs/en/operations/system-tables/disk_types.md:1] [dismissed by author -- https://github.com/Add embedded documentation and a system table for disk types #106187#discussion_r3329833571] The new docs/ page still omits sidebar_label and sidebar_position, while the repository instructions for new documentation files require both fields in frontmatter. The author intentionally kept the existing docs/en/operations/system-tables/ convention without those fields; I am not reopening the thread, but the policy mismatch remains. Suggested fix: add explicit sidebar_label and sidebar_position, or update the repository instruction if system-table pages are meant to be exempt.
Final Verdict

Status: ✅ Approve

Minimum required actions: none for correctness.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label May 31, 2026
Comment thread src/Disks/DiskFactory.cpp Resolved
alexey-milovidov and others added 2 commits June 1, 2026 08:44
- Restrict `04307_disk_types_documentation` to disk types that are always
  present regardless of build options. The `encrypted` disk type requires
  `USE_SSL`, which is disabled in the Fast test build, so the test failed
  with "result differs with reference".
- Clear `documentations` together with `registry` in `DiskFactory::clearRegistry`
  so the factory has one coherent registered-state lifecycle (otherwise stale
  documentation survives a `clearDiskRegistry` + `registerDisks` cycle because
  the `emplace` keeps the old value for already-present keys).
- Add `disk_types` to the always-accessible system table list in
  `ContextAccess.cpp` so that, like its sibling introspection tables, it can be
  queried with implicit `SELECT` when `select_from_system_db_requires_grant`
  is enabled, and update the `03247_show_grants_with_implicit` reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
alexey-milovidov and others added 2 commits June 2, 2026 23:51
…entation

Add a build-option-independent assertion to 04307_disk_types_documentation
that every row in system.disk_types (including optional backends like s3,
hdfs, or azure_blob_storage when compiled in) has a non-empty description
and syntax, complementing the existing existence check for the always-present
core disk types.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The failures of 00175_obfuscator_schema_inference and 00096_obfuscator_save_load in Stateless tests (amd_tsan, parallel) are NOT caused by this PR.

They were introduced by #104690 ("Add UntrackedMemory asynchronous metric"), which made clickhouse-obfuscator abort (SIGABRT) on process teardown: the query results are correct, but the Aborted line on stderr fails the test. #104690 has now been reverted (#106365).

#104690 was merged in violation of the ClickHouse team rules: its own CI already showed these two tests failing (10 times between May 12 and June 1) before it was merged.

Please update your branch to pick up the revert; the tests should pass again.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged the latest `master` (the branch was 635 commits behind and red). Resolved the sole conflict in `src/Storages/System/attachSystemTables.cpp` — an add/add collision where `master` added `data_skipping_index_types` (#106186) on the line adjacent to this PR's `disk_types`; kept both `attach<...>` lines.

Rebuilt cleanly and verified `system.disk_types` after the merge: all 12 disk types (`local`, `encrypted`, `cache`, `object_storage`, `s3`, `s3_plain`, `s3_with_keeper`, `s3_plain_rewritable`, `hdfs`, `azure_blob_storage`, `local_blob_storage`, `web`) expose a non-empty `description` and `syntax`, and `04307_disk_types_documentation` matches its reference.

The only CI failure is unrelated to this PR: Logical error: Left and right columns have same names: [A], [B] (STID 4752-5ad8) in the join-order optimizer (chooseJoinOrder / JoinExpressionActions), hit in the stress test. This is tracked by #89166 and already being fixed by #103088 (whose branch name even references the same STID family, 4752-...).

@alexey-milovidov

Copy link
Copy Markdown
Member Author

In the documentation, we should provide examples both for the static (xml/yaml) configuration and the dynamic configuration. Examples for the static configuration should go first.

Address review feedback: the documentation should provide examples for
both the static (XML/YAML) configuration and the dynamic configuration,
with the static configuration shown first.

The `examples` column of `system.disk_types` is rendered through
`Documentation::examplesAsString`, which emits a SQL query / response
pair and is therefore unsuited to static XML/YAML configuration
snippets. The natural home for the static-vs-dynamic examples is the
hand-written `disk_types.md` page, where a new "Configuration examples"
section now shows, in order: a static `s3` disk in XML, the same in
YAML, a table using it via a storage policy, and finally the equivalent
dynamic configuration using the `disk` function.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Done in 48e07cc.

Added a Configuration examples section to docs/en/operations/system-tables/disk_types.md that shows, in order:

  1. Static configuration in XML (an s3 disk + storage policy)
  2. The same static configuration in YAML
  3. A table using the disk via its storage policy
  4. The equivalent dynamic configuration using the disk function

Static configuration goes first, as requested.

Note on the embedded examples column: it is rendered through Documentation::examplesAsString, which emits a sql query / response pair, so it is not a good fit for static XML/YAML snippets (and disk configuration has no query "response"). I therefore put the static-vs-dynamic examples in the hand-written docs page rather than the embedded examples field. If you'd prefer these examples to also live in the embedded documentation, I can extend Documentation::Example with an optional code-fence language so the column can render XML/YAML correctly — just let me know.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged master (was 375 commits behind) to refresh CI. No conflicts; the shared Documentation.h/.cpp are already on master from the earlier PRs in the series, so they dropped out of this diff. Built locally with no warnings, and 04307_disk_types_documentation passes (all 12 disk types expose non-empty description and syntax).

The only red was Tests/04023_rollup_totals_memory_limit, which the rerun diagnosed as flaky (22/88 reruns failed) and which fails sporadically across unrelated PRs under randomized MergeTree settings — the randomized settings sometimes keep memory usage under max_memory_usage, so the expected MEMORY_LIMIT_EXCEEDED is not thrown. It is unrelated to this change.

@groeneai, could you investigate the 04023_rollup_totals_memory_limit flakiness (the test expects MEMORY_LIMIT_EXCEEDED but randomized settings can keep the query under the limit) and provide a fix in a separate PR? If a fix is already in progress, please link it here.

@groeneai

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

@alexey-milovidov fix opened in #106679: lowered max_memory_usage from 10 MB to 1 MB so the expected MEMORY_LIMIT_EXCEEDED exception is reached deterministically across all randomized settings.

The previous 1.2x margin between observed aggregator memory (~12 MiB) and the 10 MB limit is too thin: certain randomizations on Stateless tests (amd_debug, distributed plan, s3 storage, parallel) and Fast test shave a few MiB off and let the query slip under. The new 1 MB limit gives a 5-6x margin (locally observed ~6 MiB across 50 random setting combinations).

The regression target from issue #93465 (server crash in ROLLUP+TOTALS memory-limit handling) is still exercised - any clean MEMORY_LIMIT_EXCEEDED proves the crash path is not reached.

pull Bot pushed a commit to sowelswl/ClickHouse that referenced this pull request Jun 7, 2026
Lower `max_memory_usage` from 10 MB to 1 MB so the expected
`MEMORY_LIMIT_EXCEEDED` exception is hit deterministically.

The previous limit (10 MB) sat just below the observed aggregator
footprint of ~12 MiB. The 1.2x margin is too thin: certain
randomized settings (in `Stateless tests (amd_debug, distributed
plan, s3 storage, parallel)` and `Fast test`) shave off 2-3 MiB
and let the query slip under the limit, so `MEMORY_LIMIT_EXCEEDED`
is never thrown and the test fails with "query succeeded but
server error 241 was expected".

With a 1 MB limit the aggregator footprint (5-6 MiB observed
locally across 50 random setting combinations) is firmly above
the threshold, so the exception fires deterministically.

The regression target from issue ClickHouse#93465 (server crash inside
ROLLUP+TOTALS memory-limit handling) is still exercised: any
`MEMORY_LIMIT_EXCEEDED` thrown cleanly proves the crash path is
not reached.

Requested by @ alexey-milovidov on
ClickHouse#106187

Related: ClickHouse#93465

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…tion

# Conflicts:
#	src/Storages/System/attachSystemTables.cpp
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged master to resolve a conflict in src/Storages/System/attachSystemTables.cpp — a trivial add/add against the sibling system.dictionary_sources line from #106184 (kept both). The merge is otherwise coherent: disk_types remains in the implicit-access allowlist (ContextAccess.cpp) and in the 03247_show_grants_with_implicit reference. Rebuilt OK; 04307_disk_types_documentation passes (all 12 registered disk types expose non-empty description and syntax, build-independent assertion is empty as expected).

…eeper` metadata storage

The `keeper` metadata storage type is registered only in ClickHouse Cloud
builds, so the `s3_with_keeper` disk type advertised by `system.disk_types`
is not usable in other builds: creating it fails with an
`unknown metadata storage type: keeper` error. State this explicitly in the
embedded documentation instead of changing the registration, because the
disk type itself was registered unconditionally before this PR as well.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106187&sha=56bb7937ae5ed9a3f7f19ca2ed6dba2bdb43073d&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.

All 76 failures in this job happened within a four-minute window (04:04–04:08) with (total) memory limit exceeded at the runner-wide cap (current RSS: 53.69 GiB, maximum: 53.69 GiB) followed by Connection reset by peer cascades — a runner-wide memory exhaustion event. CIDB shows the same failure class on master (pull_request_number = 0) and dozens of unrelated PRs on 2026-06-09 and 2026-06-10 (303 and 379 distinct failing tests respectively), so it is unrelated to this PR's changes (system.disk_types embedded documentation).

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov Investigated. Your triage is correct: this is a runner-wide memory-exhaustion event, not caused by this PR, and the root-cause mitigation is already merged.

The 76 failures (SHA 56bb793): all graceful, no crash. Breakdown: 44x Code 241 MEMORY_LIMIT_EXCEEDED at the runner cap (current RSS: 53.69 GiB, maximum: 53.69 GiB) plus 30x Code 210 Connection reset by peer / NETWORK_ERROR cascades from the same exhaustion. Zero SIGSEGV / heap-use-after-free / LOGICAL_ERROR / allocator-CHECK signatures (the only LOGICAL_ERROR/ASSERTION strings in the logs are grep patterns inside the test scripts themselves). Cascade peaked 04:04-04:08 UTC on 2026-06-10, where this PR's run happened to land.

Unrelated to system.disk_types (CIDB, job Stateless tests (arm_asan_ubsan, azure, parallel)):

day distinct failing tests distinct PRs of which master
2026-06-09 552 40 31
2026-06-10 758 94 25
2026-06-11 149 26 19
baseline 06-05..06-08 8-30 5-17 0-4

The same failure class hit master and ~94 distinct unrelated PRs on 06-10. Same systemic event is also tracked on #106177 (q23 OOM victim) and in #101843.

Fix already merged: #106962 (Algunenano, 2026-06-11 16:38Z) tags the heaviest offender 01603_read_with_backoff_bug as no-asan. Confirmed working from CIDB:

  • post-merge hourly volume on this job dropped to baseline (<=5 distinct tests/hr vs pre-merge spikes of 22-87/hr);
  • 01603 is now SKIPPED (60 runs) on the asan azure lane;
  • residual post-merge failures are isolated baseline noise (7 across 6 PRs over all of 06-11).

So no separate PR is warranted from me, the root-cause test tag already landed in #106962. Happy to tag additional heavy tests no-asan/no-parallel if you want to push the residual lower.

session cron:clickhouse-worker-slot-1:20260611-234400

@clickhouse-gh

clickhouse-gh Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.60% 84.60% +0.00%
Functions 92.40% 92.30% -0.10%
Branches 77.30% 77.30% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 108/109 (99.08%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 2 line(s) · Uncovered code

Full report · Diff report

@alexey-milovidov alexey-milovidov self-assigned this Jun 12, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Ok for now, but needs follow-ups.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 12, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, do a follow-up PR:

  1. The embedded documentation must be as detailed as the Markdown docs on the website. You can copy all the content from the Markdown docs into the code, keep the Markdown formatting. The end goal is to make the Markdown docs files be auto-generated from the code.
  2. We said "kept for compatibility" for aliases over object_storage, like s3, s3_plain, etc. But this words can confuse the user. These are kept not only for compatibility but also for convenience. So you should remove the remark "kept for compatibility" and say "equivalent to ..."
  3. The examples of XML, YAML, and dynamic configuration should be also added into the embedded documentation, for every disk type where it is feasible.

Merged via the queue into master with commit e60fa21 Jun 12, 2026
166 checks passed
@alexey-milovidov
alexey-milovidov deleted the disk-type-documentation branch June 12, 2026 19:53
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants