Skip to content

Add a bucketed schema for system.metric_log: a single Map column with Enum keys and 128 buckets - #115380

Merged
alexey-milovidov merged 8 commits into
masterfrom
metric-log-bucketed-maps
Aug 24, 2026
Merged

alexey-milovidov merged 8 commits into
masterfrom
metric-log-bucketed-maps

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

Adds a new schema_type option bucketed for system.metric_log (the default wide and the transposed schemas are unchanged):

<metric_log>
    <schema_type>bucketed</schema_type>
</metric_log>

With this schema, all profile events and current metrics are stored in a single metrics column of type Map(Enum16(...), Int64), where the Enum16 value is the global metric index and zero values are not stored (a lookup of a missing key in a Map returns 0). The default table definition uses the bucketed Map serialization with a constant number of 128 buckets:

SETTINGS map_serialization_version = 'with_buckets', map_serialization_version_for_zero_level_parts = 'basic',
    max_buckets_in_map = 128, map_buckets_strategy = 'constant', map_buckets_min_avg_size = 0

Parts created by inserts keep the basic serialization to avoid creating many small files on every flush; merged parts are always split into 128 buckets.

Every metric is also exposed through an ALIAS column, e.g. ProfileEvent_Query UInt64 ALIAS metrics['ProfileEvent_Query'], so all queries, dashboards, and tests written for the wide schema continue to work. Reading a single metric goes through the Map key subcolumn (metrics.key_ProfileEvent_Query), which reads only the bucket containing the key: in a local test it reads ~100 times less data than reading the whole map (616 vs 60716 bytes on the same rows).

Supporting changes:

  • arrayElement on a Map with Enum keys now accepts the string name of the enum value (m['name']): the index is cast to the key type, so an unknown name throws the UNKNOWN_ELEMENT_OF_ENUM exception, while a name that is in the Enum but absent from the map returns the default value. This previously threw ILLEGAL_TYPE_OF_ARGUMENT.
  • The rewrite of m['key'] to a key subcolumn in FunctionToSubcolumnsPass now supports Enum-keyed maps indexed by the name of the enum value, so both the aliases and ad-hoc queries prune buckets.
  • System logs can declare additional default engine settings via getDefaultEngineSettings, merged with the settings from the server configuration when no custom engine is specified.
  • An unknown metric_log.schema_type value is now rejected with an error instead of silently disabling the table.

Changelog category (leave one):

  • New Feature

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

Add a new bucketed schema type for system.metric_log, which stores all metrics in a single Map(Enum16(...), Int64) column using the bucketed Map serialization with 128 buckets, plus a per-metric ALIAS column for compatibility: the table consists of a few columns instead of thousands, zero values are not stored, and reading a single metric reads only one of the 128 buckets. In addition, a Map with Enum keys can now be indexed by the string name of the enum value, e.g. map['name'].

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/115380]

Version info

  • Merged into: 26.8.1.1976 (included in 26.8 and later)

…keys

Instead of a separate column for every profile event and current metric
(about 1900 columns), the table now stores them in 128 bucket columns
metrics_0 ... metrics_127 of type Map(Enum16(...), Int64). Each metric
belongs to one bucket (contiguous ranges of the combined metric index
space), the Enum16 value is the global metric index, and zero values are
not stored: a lookup of a missing key in a Map returns 0.

Every metric is still accessible under its old name through an ALIAS
column, e.g. ProfileEvent_Query UInt64 ALIAS metrics_0['ProfileEvent_Query'],
so existing queries, dashboards, and tests keep working, while reading
a single metric only reads the one bucket that contains it.

To support these aliases (and direct queries against the map columns),
the arrayElement function now allows indexing a Map with Enum keys by
the string name of the enum value: the index is cast to the key type,
so an unknown name throws UNKNOWN_ELEMENT_OF_ENUM, while a name that is
in the Enum but absent from the map returns the default value.

On an idle server, the new structure takes about 320 bytes per row of
compressed data versus about 1240 bytes per row for the wide structure,
and a part now consists of a few hundred files instead of several
thousands. On upgrade, the old wide table is renamed to metric_log_0
as usual for system log tables.

The transposed schema (schema_type = 'transposed') is unaffected.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov
alexey-milovidov requested review from Avogar and removed request for Avogar August 19, 2026 00:50
@alexey-milovidov
alexey-milovidov marked this pull request as draft August 19, 2026 00:50
…kets

Per review: instead of changing the default (wide) schema of
system.metric_log, add a new schema_type option 'bucketed'. The wide and
transposed schemas are unchanged.

With <schema_type>bucketed</schema_type>, the table stores all profile
events and current metrics in a single `metrics` column of type
Map(Enum16(...), Int64), where the Enum16 value is the global metric
index and zero values are not stored. The default table definition uses
the bucketed Map serialization with a constant number of 128 buckets
(map_serialization_version = 'with_buckets', max_buckets_in_map = 128,
map_buckets_strategy = 'constant', map_buckets_min_avg_size = 0), while
parts created by inserts keep the basic serialization
(map_serialization_version_for_zero_level_parts = 'basic') to avoid
creating many small files on every flush.

Every metric is exposed through an ALIAS column, e.g.
ProfileEvent_Query UInt64 ALIAS metrics['ProfileEvent_Query'], so all
queries written for the wide schema continue to work. Reading a single
metric goes through the Map key subcolumn (metrics.key_<name>), which
reads only the bucket that contains the key: on a test table it reads
about 100 times less data than reading the whole map.

To make this work, the optimization of `arrayElement` to a key subcolumn
in `FunctionToSubcolumnsPass` now supports maps with Enum keys indexed by
the string name of the enum value (in addition to the `arrayElement`
runtime support for Enum-keyed maps from the previous commit).

System logs can now declare additional default engine settings via
`getDefaultEngineSettings`, which are merged with the `settings` from the
server configuration when no custom engine is specified.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov alexey-milovidov changed the title Change the structure of system.metric_log to bucketed Maps with Enum keys Add a bucketed schema for system.metric_log: a single Map column with Enum keys and 128 buckets Aug 19, 2026
# Conflicts:
#	docs/en/operations/system-tables/metric_log.md
#	src/Interpreters/MetricLog.cpp
@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f306dce]

Summary: ✅


AI Review

Summary

This PR adds a bucketed system.metric_log schema backed by a single Map(Enum16(...), Int64) column, extends arrayElement/subcolumn pruning so Maps with Enum keys can be indexed by enum-value names, and wires the new log through system-log creation and flushing. The earlier runtime regressions around named flushes and alias skipping are fixed in the current code, but I still see one user-visible docs mismatch and one missing test for the core alias-based pruning contract.

Findings
  • ⚠️ [docs/reference/system-tables/metric_log.mdx:2061] The new bucketed schema docs overstate the runtime contract. BucketedMetricLog::getDefaultEngineSettings deliberately keeps zero-level parts on map_serialization_version_for_zero_level_parts = 'basic', so fresh system.metric_log data still reads the whole metrics Map until parts merge; and those bucketed settings are only injected when the configuration does not override <engine>. As written, the docs promise immediate and universal 128-bucket pruning after schema_type = bucketed, which is not what the implementation does. Suggested fix: document the zero-level/custom-engine caveat or weaken the selective-read claim here.
Tests
  • ⚠️ [tests/queries/0_stateless/04512_map_enum_key_subcolumn.sql:25] The new stateless coverage proves pruning for the raw m['a'] expression, but the compatibility contract of this PR is that the alias-backed ProfileEvent_* / CurrentMetric_* columns also prune to key_*. Add the analogous EXPLAIN QUERY TREE assertion for SELECT va FROM t_map_enum_buckets (or an equivalent alias-backed projection, ideally on data that has been merged into the with_buckets layout) so alias-expansion regressions cannot silently disable the optimization.
Final Verdict

Changes requested.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 87.00% 87.00% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 234/240 (97.50%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Aug 19, 2026
@Avogar Avogar self-assigned this Aug 19, 2026
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review August 19, 2026 22:38
After merging master, SystemLogBase::add only accepts a callback that
fills the element in place (so its allocations are charged to the global
memory tracker), and the old add(std::move(elem)) call in
BucketedMetricLog::stepFunction no longer compiled, failing the
Fast test and Build (arm_tidy) jobs:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115380&sha=49ef1e3b05571c8c0ec583e0d27e1eb9c831825e&name_0=PR&name_1=Fast%20test

Build the element inside the add callback, following the same idiom as
`MetricLog::stepFunction`.

Co-Authored-By: Claude Fable 5 <[email protected]>
Comment thread src/Interpreters/SystemLog.cpp Resolved
Comment thread src/Interpreters/SystemLog.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f306dce21 with master b9f71462d (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 704.47 MiB 701.61 MiB -2.86 MiB (-0.41%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes

73 object files changed (+453.39 KiB total), 1 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Interpreters/SystemLog.cpp.o 4.31 MiB 4.52 MiB +217.79 KiB (+4.93%)
src/CMakeFiles/dbms.dir/Interpreters/BucketedMetricLog.cpp.o new 164.59 KiB +164.59 KiB
src/CMakeFiles/clickhouse_common_io.dir/Common/SystemLogBase.cpp.o 1.24 MiB 1.29 MiB +47.73 KiB (+3.75%)

737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

720 translation units recompiled, 5438 s compile time in total, 719 of them have a recent master baseline.

Job report

…mode

Two issues found in review:

- `SystemLogs::flushImpl` built the name lookup map from an initializer list, so the
  first entry for a duplicated key won. Several logs share the public table name
  `system.metric_log` (`metric_log`, `transposed_metric_log`, `bucketed_metric_log`),
  and only the one matching the configured `schema_type` is instantiated, so
  `SYSTEM FLUSH LOGS metric_log` resolved to the empty `metric_log` slot and silently
  did nothing. Now an empty slot never replaces a live log.

- The whole per-metric interface of the `bucketed` schema consists of ALIAS columns over
  the `metrics` Map. When alias columns are skipped (an S3-backed engine, or
  `default_system_log_flush_policy.skip_alias_columns` in the configuration), the table
  would silently lose all `ProfileEvent_*` / `CurrentMetric_*` columns. This combination
  is now rejected at startup.

The integration test used a configuration with an explicit `engine`, which overrides the
default table definition, so the engine settings of the `bucketed` schema were not
applied. Use a configuration without `engine` and cover both fixes.
`SYSTEM FLUSH LOGS <name>` looks the name up without the database, so only the member
name of the log was ever matched. Register every instantiated log under the name of the
table it writes to as well, so that the name of the public table resolves to whichever of
`metric_log` / `transposed_metric_log` / `bucketed_metric_log` is instantiated.

Also read `SHOW CREATE TABLE` in the test as `TSVRaw`: the default format escapes the
quotes inside the query text, so the assertions on the engine settings never matched.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Addressed both AI-review Majors and the failing own test in f306dce:

  • SYSTEM FLUSH LOGS metric_log / SYSTEM FLUSH LOGS system.metric_log now resolve to the live log instead of the empty metric_log slot (this also fixes the same problem for transposed_metric_log).
  • The bucketed schema is rejected at startup when alias columns are skipped (default_system_log_flush_policy.skip_alias_columns, or an engine which does not support them), because its whole per-metric interface consists of ALIAS columns.
  • test_transposed_metric_log/test.py::test_bucketed_schema failed because its configuration specifies engine explicitly, which overrides the default table definition and hence the engine settings of the bucketed schema, and because SHOW CREATE TABLE was read in an escaping format. It now uses a configuration without engine and reads the query as TSVRaw. Both tests and test_table_rotation pass locally.

Remaining failures on the previous run are unrelated to this change:

@groeneai, please take a look at the test_storage_azure_blob_storage failures in the coverage run if they persist: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115380&sha=9645a36233393abea7f9b7f489df6af97c798516&name_0=PR&name_1=Integration%20tests%20(amd_llvm_coverage,%205/8) — and provide a fix in a separate PR if it is not an infrastructure flake.

**Schema**
This table can be configured with different schema types using the XML tag `<schema_type>`. The default schema type is `wide`, where each metric or profile event is stored as a separate column. This schema is the most performant and efficient for single-column reads.

The `bucketed` schema stores all profile events and current metrics in a single `metrics` column of type [Map](/reference/data-types/map)([Enum16](/reference/data-types/enum), [Int64](/reference/data-types/int-uint)), so the table consists of a few columns instead of thousands. The `Map` uses the bucketed serialization (`map_serialization_version = 'with_buckets'`) with a constant number of 128 buckets, so reading a single metric reads only one of the 128 buckets. Zero values are not stored: reading a missing key returns `0`. Every metric is also exposed through an `ALIAS` column named as the metric itself (for example, `ProfileEvent_Query UInt64 ALIAS metrics['ProfileEvent_Query']`), so all queries written for the `wide` schema continue to work. Profile events are stored as increments during the collection interval, and current metrics are stored as values at the moment of collection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs overstate the runtime contract here. BucketedMetricLog::getDefaultEngineSettings() sets map_serialization_version_for_zero_level_parts = 'basic', so fresh system.metric_log parts still require whole-Map reads until they merge; and those defaults are only injected when no custom <engine> is configured. As written, this paragraph promises immediate/universal 128-bucket pruning after schema_type = bucketed, which is not what the implementation does. Please document the zero-level/custom-engine caveat or weaken the selective-read claim.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay.

SELECT va FROM t_map_enum_buckets ORDER BY id;
SELECT m.key_a FROM t_map_enum_buckets ORDER BY id;

-- The element access by a constant name reads a key subcolumn instead of the whole map.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still weaker than the compatibility contract the PR is selling. system.metric_log exposes metrics through ALIAS metrics['ProfileEvent_*'], but the only EXPLAIN here checks the raw m['a'] expression, not the alias path. If alias expansion ever stops feeding FunctionToSubcolumnsPass, SELECT ProfileEvent_Query will silently fall back to whole-Map reads while this test still passes. Please add a focused assertion for SELECT va (or an equivalent system.metric_log alias query), ideally on data that has actually been merged into the with_buckets layout.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already overdone.

@groeneai

Copy link
Copy Markdown
Collaborator

Looked into the test_storage_azure_blob_storage failures. Your reading is right that it is environmental, but the mechanism is more specific than a readiness/timeout problem, and it is a single occurrence rather than something that persists.

What happened: the Azurite container crashed mid-module. From logs.tar.gz -> _instances-gw2/docker.log:

azurite1-1  | 172.16.2.3 - - [20/Aug/2026:04:29:43 +0000] "GET /devstoreaccount1/cont/test_format_detection1 HTTP/1.1" 206 200
azurite1-1 exited with code 139

Exit 139 is SIGSEGV in the Node process. docker-in-docker.log shows the matching /tasks/exit event at 04:29:43.239Z for container 7818d4de43c4, then Docker tearing down its DNAT rule for 172.16.2.2:30009. The next query therefore gets Timeout: connect timed out: 172.16.2.2:30009 (Poco::Net::SocketImpl::connect), not Connection refused: the address was already unrouteable.

So the ordering is: Azurite crashes -> test_format_detection fails -> the remaining 11 tests error on fixture teardown/setup. It is not a whole-module failure and not a startup problem. The module had already served 3605 requests over ~6 minutes with no 5xx (1508x 200, 650x 206, 561x 201, 556x 202, 327x 404, 3x 409), and pytest_parallel.jsonl records 38 passed, 1 failed, 11 setup errors for the module. The two other Azurite instances in the same job (_instances-cluster-gw0, _instances-check_after_upload-gw0) both exited 0.

Persistence: it does not. CIDB, 30 days:

  • test_storage_azure_blob_storage/* FAIL/ERROR under any llvm_coverage check: 12 rows, all from this one commit 9645a362, one job.
  • The connect timed out + Azure signature anywhere in CI: 1 row, 1 PR, 0 master rows, first seen == last seen == 2026-08-20 04:21:02.

One crash, one job, never before and not since. Nothing to reproduce and nothing in ClickHouse to fix, so I am not opening a fix PR: the fault is in the emulator, and a harness-side timeout bump would only hide it.

Two things I noticed while measuring, neither raised as work:

  • docker_compose_azurite.yml has no restart: policy and no healthcheck, while hdfs/postgres/cassandra all use restart: always (postgres additionally has a healthcheck plus the autoheal sidecar). With a restart policy the crash would have cost one retry inside azure_query's existing loop instead of 12 red tests. I have not raised this: one crash in 30 days does not justify changing the harness, and restart: would also mask future crashes.
  • Unrelated to this failure, but the module's _gen/disk_storage_conf.xml in the artifacts points at port 30034 while this worker's Azurite listens on 30009. That file is written by test_check_after_upload.py to a fixed path shared by all xdist workers, so the last writer wins. It did not matter here because the failing tests use azureBlobStorage(...) with an explicit endpoint rather than the disk. The same pattern in test_merge_tree_azure_blob_storage does cause real failures, and Validate Azure Blob Storage upload settings early #103394 already fixes it there.

@clickhouse-gh

clickhouse-gh Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 36 queries analysed

no significant changes detected. K_source=6 K_base=30 flagged=0/65

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 40a89847-dc6a-4cab-b0d7-baf9b379c74c
  • MIRAI run: d02143b8-a96d-49b7-bc9f-9952babac51e
  • PR check IDs:
    • clickbench_55682_1787370583
    • clickbench_55688_1787370584
    • clickbench_55699_1787370583
    • tpch_adapted_1_official_55714_1787370583
    • tpch_adapted_1_official_55725_1787370583
    • tpch_adapted_1_official_55753_1787370583

@mintlify

mintlify Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Aug 22, 2026, 4:27 PM

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very good. A lot of tech-debt was solved along the way.

We need a follow-up PR to enable this by default. We may want to make the number of buckets configurable.

@alexey-milovidov alexey-milovidov self-assigned this Aug 24, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 24, 2026
Merged via the queue into master with commit 4faa046 Aug 24, 2026
178 checks passed
@clickgapai

Copy link
Copy Markdown
Contributor

@alexey-milovidov @Avogar — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

alexey-milovidov pushed a commit to niyue/ClickHouse that referenced this pull request Oct 6, 2026
`has`, `notHas`, `indexOf`, `countEqual` and `mapContains` silently returned
"not found" for a constant array of `Enum` values searched for a `String`:

```
WITH CAST(map('a', 10, 'c', 30), 'Map(Enum8(\'a\' = 1, \'c\' = 3), Int64)') AS m
SELECT mapContains(m, 'a');  -- 0, must be 1
```

`FunctionArrayIndex::executeConst` compares the raw `Field`s of the constant
array with `accurateEquals`, and the field of an `Enum` element is its numeric
value while the field of the argument is the name, so nothing ever matched.
The non-constant code path (`executeGeneric`) casts both arguments to their
common type, which for `Enum` and `String` is `String`, and therefore compares
by the name of the enum value. Every other way of writing the same predicate -
`equals`, `arrayFilter`, `arrayMap`, and all of the above over a materialized
array - already compared by name, so only the constant path was wrong.

Replace the values of the constant array by their names when the argument is a
`String`, which makes the constant and the non-constant paths agree. For
`indexOfAssumeSorted` the binary search is skipped in that case, because the
array is sorted by the numeric values of the enum and not by the names.

This also fixes `arrayExists(x -> x = 'name', constant_enum_array)`, which is
rewritten to `has` and returned `0` while `arrayFilter` with the same lambda
returned the element.

`04509_not_has_function` asserted the old result of the constant path, with a
comment stating that an `Enum` element only matches a needle of the `Enum`
type. That was a description of this bug: the same expression over a
materialized array returned the opposite. The assertion and the comment are
updated.

Follow-up to ClickHouse#115380, which made
`Map`s with `Enum` keys indexable by the name of the enum value and thereby
made these functions reachable for `system.metric_log` with the `bucketed`
schema.

Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov pushed a commit to niyue/ClickHouse that referenced this pull request Oct 6, 2026
… the `Enum`

Indexing a `Map` with `Enum` keys by a numeric value that is not in the `Enum`
threw during query analysis instead of reading the default value:

```
SELECT m[toInt8(4)] FROM t;  -- m Map(Enum8('a' = 1, 'b' = 2, 'c' = 3), Int64)
Code: 691. DB::Exception: Unexpected value 4 in enum. (UNKNOWN_ELEMENT_OF_ENUM)
```

`optimizeFunctionArrayElementForMap` inserts the constant into a column of the
key type and serializes it to build the name of the key subcolumn. For an
`Enum` key type `tryInsert` only range-checks the number, so a value outside
the `Enum` was accepted and `serializeText` then threw looking up its name. At
runtime the same expression returns the default value, like any key that is
missing from the map.

Convert the constant through `tryConvertFieldToType` first: it accepts both the
name and the numeric value of an enum value and rejects anything that is not in
the `Enum`, in which case the optimization is skipped and the whole map is read.
As a side effect `m[1]` is now rewritten to the same key subcolumn as `m['a']`;
before, a `UInt64` literal never inserted into the `Int8`/`Int16` column of the
enum, so the rewrite was silently declined for the numeric form.

Follow-up to ClickHouse#115380.

Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov pushed a commit to niyue/ClickHouse that referenced this pull request Oct 6, 2026
Two properties of the schema are only visible in the code: the server refuses
to start when alias columns are skipped in system log tables, because the whole
per-metric interface of the schema consists of `ALIAS` columns; and the engine
settings of the bucketed `Map` serialization belong to the default table
definition, so a configuration with an explicit `<engine>` does not get them.

Follow-up to ClickHouse#115380.

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

PedroTadim commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

🕵️ A server whose config has a <bucketed_metric_log> section now refuses to start:

Code: 137. DB::Exception: Unknown element 'bucketed_metric_log' found in config /etc/clickhouse-server/config.xml. If it is a new option, it should be added to ServerSettings or to the known config sections. (UNKNOWN_ELEMENT_IN_CONFIG)

This PR added bucketed_metric_log to LIST_OF_ALL_SYSTEM_LOGS in src/Interpreters/SystemLog.h, but not to known_complex_sections in ServerSettings::checkUnknownSettings (src/Core/ServerSettings.cpp), next to metric_log / transposed_metric_log / histogram_metric_log. It is the only system log in SystemLog.h missing from that list. The config fuzzer (casa_del_dolor) hit this on 26.11.1.1058.

The fix is one line, adding "bucketed_metric_log", to known_complex_sections.

This branch was successfully deployed

1 active deployment
staging - docs — f306dce2 Deployed Aug 23, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature 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.

7 participants