Repository navigation
Revert "Revert "Enable the bucketed schema of system.metric_log by default"" - #124016
alexey-milovidov merged 9 commits into
Conversation
|
Workflow [PR], commit [4163234] Summary: ✅
AI ReviewSummaryThis PR restores the Final Verdict✅ Approved. LLVM Coverage ReportMeasured on commit 4163234.
Changed lines: Changed C/C++ lines covered: 142/149 (95.30%) · Uncovered code |
…ve `MergeTree` defaults Do not warn about a setting of the bucketed `Map` serialization that is not spelled in an explicit `engine` of `metric_log` when its effective `MergeTree` default already has the required value. Clarify in the documentation of `BucketedMetricLog` that an explicit `engine` keeps `wide` as the default only when `schema_type` is not set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes31 object files changed (+68.17 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units1118 translation units recompiled, 7526 s compile time in total, 1118 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.94 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
Address review: the test now runs the matcher explicitly with `enable_analyzer = 0` and `enable_analyzer = 1`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 On 35bc2c4, |
… a qualified asterisk with the old planner `SELECT t.* ... SETTINGS asterisk_include_alias_columns = 1, enable_analyzer = 0` dropped the alias columns (such as the per-metric aliases of the `bucketed` schema of `system.metric_log`), while unqualified `*` and the analyzer kept them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ugh `system.all_metric_log` The union table pinned the columns of the `bucketed` schema, where every metric is `ALIAS metrics['...']`. An `ALIAS` in a `Merge` table is expanded before reading, so for the rotated `metric_log_0` of the `wide` schema, which has no `metrics` column, the union table returned default values instead of the stored metrics. Declare these columns as ordinary ones in the union table, so that each underlying table provides them on its own: physically for `wide`, as its `ALIAS` for `bucketed`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… asterisk The previous commit declared the per-metric columns of the union table as ordinary columns, so `SELECT * FROM system.all_metric_log` started to compute about a thousand `metrics['...']` aliases of the underlying `bucketed` table for every row, and the query in `01161_all_system_tables` timed out after 300 seconds. Declare them as `MATERIALIZED`: they are still read by name from every underlying table, physically for `wide` and as its `ALIAS` for `bucketed`, but, like the `ALIAS` columns of `system.metric_log`, they are not expanded by an asterisk. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124016&sha=latest&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20sequential) #124016 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l_parts` of an explicit engine The setting only controls how zero-level parts are written before merges, not the bucket layout of merged parts, so an explicit `bucketed` engine that changes it to `with_buckets` should not get the warning that `metrics` will not be stored in 128 constant buckets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copying a `ColumnDefault` deep-clones its expression AST, and copying a `ColumnDescription` also clones its codec and TTL ASTs. With the bucketed `system.metric_log` schema (the default since ClickHouse#124016) the table has ~2200 `ALIAS` columns, and every metadata copy clones and later destroys all of their ASTs. A `system.dashboards` query copies that metadata many times: in debug and sanitizer builds `MergeTreeData::getInMemoryMetadataPtr` returns a fresh copy on every call (to catch lifetime bugs), and `StorageMerge::getInMemoryMetadataPtr` / `StorageMaterializedView::getInMemoryMetadataPtr` copy it on every call through `withVirtuals`. Under ASan the clones were 39% of the CPU of the test's queries, and `03540_system_dashboards` doubled its runtime on every debug and sanitizer lane and hit the 600 s timeout on amd_tsan with s3 storage. Add `StorageInMemoryMetadata::copySharingColumnASTs` (backed by `ColumnsDescription::copySharingASTs`, a tagged `ColumnDescription` constructor and `ColumnDefault::copySharingExpression`): the copy has its own metadata, columns description and column descriptions, and shares only the immutable ASTs. Use it at the three read-only per-call sites. It never goes through `ColumnsDescription::add`, whose function name normalizer modifies the AST in place. The copy constructor and assignment still deep-copy, so every mutable copy (ALTER, CREATE AS, ...) keeps owning its ASTs. In debug builds the lifetime check still returns a distinct metadata object per call; only a dangling reference into a column AST is no longer caught by it. Also add an rvalue `IStorage::setInMemoryMetadata` overload and move the local metadata in the `Merge`, `Distributed` and `Dummy` constructors. The `Distributed` constructor reads the columns for the sharding key after setting the metadata, so it now reads them from its `columns_` argument, which is what the metadata was built from. Measured on the test's 498 dashboard queries in `clickhouse local` (debug build): bucketed schema 25.2 s -> 20.6 s, wide schema unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reverts #124011
See #118318 (comment)
Workflow [PR]
Sync PR [sync-upstream/pr/124016]
Version info
26.10.1.1895-master(included in26.10and later)