Repository navigation
Conversation
… units
registerAggregateFunctionTimeseries() registered all 20 timeSeries*ToGrid
aggregate functions in a single translation unit. Each registration passes its
own generic lambda to createAggregateFunctionTimeseries, which dispatches over
2 value types (Float64, Float32) and 2 timestamp/interval pairs (DateTime64,Int64
and UInt32,Int32), so the unit carried 20 x 4 = 80 full instantiations of the
1305-line AggregateFunctionTimeseriesBase.h.
Under ThinLTO the object file is LLVM bitcode carrying full IR, several times
larger than a native object, and the unit reached 56,842,736 B against the
50,000,000 B ceiling that utils/check-large-objects.sh enforces as a post-link
command on the programs/clickhouse edge. Build (amd_release) and Build
(arm_release) are the only MasterCI builds configured with -DENABLE_THINLTO=1,
which is why they were the only flavours to fail; amd_binary, the debug builds,
the sanitizer builds and arm_tidy all carry -DENABLE_THINLTO=0 and built the
same commit fine.
Each traits header now owns a registration function in its own .cpp, the shared
dispatch machinery moves to AggregateFunctionTimeseriesHelpers.h, and
registerAggregateFunctionTimeseries() becomes 11 calls. The 20 registration
blocks are moved byte-for-byte. registerAggregateFunctions.cpp keeps its single
entry point and is untouched, TU_EXCLUDES gains nothing, the 50 MB limit is
unchanged, and no CMake change is needed because the directory is globbed.
The Setting:: externs stay in a .cpp behind
assertTimeSeriesAggregateFunctionsEnabled(), so the header pulls in no settings
machinery for the 12 units that include it. The nested TimeSeriesToGrid
namespace is required rather than cosmetic: createWithValueType and
createWithTimestampAndValueTypes also name unrelated anonymous-namespace helpers
in AggregateFunctionTimeSeriesGroupArray.cpp and AggregateFunctionLast2Samples.cpp.
factory.registerAlias("timeSeriesLastToGrid", ...) was the one statement in the
old body outside the 20 documentation blocks; it moves with its target and stays
after it, because registerAlias resolves the target at call time.
Measured with the release build's flags: the object matches CI to within 96 B
(56,842,832 B locally), check-large-objects.sh exits 1 before and 0 after, and
the largest object in that directory falls to 11,249,200 B. Per-object bytes are
what the gate measures; total bytes in the directory rise from 67.2 MB to
83.8 MB, since 10 more units each re-emit parts of the shared base header.
SELECT * FROM system.functions WHERE name ILIKE 'timeSeries%' is byte-identical
before and after over all 16 columns (48 rows, same md5), including the
timeSeriesLastToGrid alias row; that comparison was verified able to fail by
dropping one registration and observing the missing row. All 22 existing
timeSeries stateless tests pass, with verdicts identical to the pristine binary.
Related: ClickHouse#112842
Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold read of the
What I verified independently of the author, since this is pure code motion and the risk is a lost Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260916-040100 |
|
Workflow [PR], commit [60c63c1] Summary: ❌
AI ReviewSummaryThis PR splits the Final Verdict✅ No findings. The current patch looks like behavior-preserving code motion that fixes the intended release-build object-size failure. |
Build profile diff (arm_release)Comparing Binary sizesNo master baseline size data yet for Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
10.11 MiB | 69.06 KiB | -10.04 MiB (-99.33%) |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.92 MiB | +1.92 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.69 MiB | +1.69 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.23 MiB | +1.23 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.21 MiB | +1.21 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.15 MiB | +1.15 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.13 MiB | +1.13 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 1.01 MiB | +1.01 MiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
75.46 KiB | 817.02 KiB | +741.55 KiB (+982.64%) |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 699.20 KiB | +699.20 KiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 623.58 KiB | +623.58 KiB |
src/AggregateFunctions/CMakeFiles/clickhouse_aggregate_functions.dir/TimeSeries/AggregateFunctionTi… |
new | 604.08 KiB | +604.08 KiB |
716 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 ⚠️
18 translation units recompiled, 82 s compile time in total, 8 of them have a recent master baseline.
| Translation unit | Master | PR | Δ vs median |
|---|---|---|---|
src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesHelpers.cpp |
39.7 s | 2.2 s | -37.5 s (-94%) |
Translation units without a recent master baseline:
src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesLinearRegression.cpp: 9.5 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesExtrapolatedValue.cpp: 9.2 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesCompensatedSum.cpp: 7.7 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesMin.cpp: 7.5 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesChanges.cpp: 7.5 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesMax.cpp: 7.2 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesCount.cpp: 5.7 ssrc/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesInstantValue.cpp: 5.6 s
Symbol sizes
| Binary | Symbol | Master | PR | Δ |
|---|---|---|---|---|
programs/clickhouse |
DB::registerAggregateFunctionTimeseries(DB::AggregateFunctionFactory&) |
167.92 KiB | removed | -167.92 KiB (-100.00%) |
CI finish ledger - 60c63c1Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
Session id: cron:our-pr-ci-monitor:20260916-070103 |
|
@groeneai merge master. |
…series-registration-translation-units Co-Authored-By: Claude Opus 5 <[email protected]>
|
Merged |
|
Correction to the comment above: your revert #120336 merged at 09:00:23Z, one minute after I pushed, so the head here carries pre-revert master The revert restores That makes this PR preparation for the re-land rather than a master fix. Your call: I re-do the split against post-revert master (16 registrations instead of 20), or I close this PR and the split rides with the re-land. I will not touch the PR until you say which. |
|
📊 Cloud Performance Report ✅ AI verdict: 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
|
Related: #112842
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Registration of the
timeSeries*ToGridaggregate functions is split across one translation unit per traits header, so no single object file exceeds the 50 MB limit checked at link time. No user-visible change.Description
Build (amd_release)andBuild (arm_release)fail on master at theprograms/clickhouselink, onutils/check-large-objects.sh:Red on both arches at
3a43db4d688fand again atc2b4e8be753dthree hours later, each time dropping 26downstream jobs: every
Stateless tests (*_release)shard, bothClickBench, all 12Performance Comparison (*, master_head), and thePost Hooksupload of the master-head perf baselinebinary. Offered on #112842; opened because the builds are still red with no revert or fix in flight.
Root cause.
registerAggregateFunctionTimeseries()registered all 20timeSeries*ToGridfunctions inone translation unit, each instantiating
AggregateFunctionTimeseries<Traits, ...>for 2 value types x 2timestamp types: 80 instantiations of the shared base header. Only the ThinLTO flavours reach the limit,
since there the
.ois LLVM bitcode carrying full IR; every non-LTO flavour built the same commit fine.Change. One registration function per traits header, each in its own
.cpp, the shared dispatchmachinery in a new
AggregateFunctionTimeseriesHelpers.h, andregisterAggregateFunctionTimeseries()reduced to 11 calls. Pure code motion: the 20 registration blocks move byte-for-byte;
registerAggregateFunctions.cpp,utils/check-large-objects.shand CMake are untouched (the directory isglobbed). The in-flight PromQL PRs touching this file will need a rebase. Listing the unit in
TU_EXCLUDESwould also clear the red but retires the gate for it; happy to switch if you prefer.Validation. With the release flags the object measures 56,842,832 B locally against CI's
56,842,736 B and the check exits 1; after the split the largest is 11,249,200 B and it exits 0.
SELECT * FROM system.functions WHERE name ILIKE 'timeSeries%'is byte-identical before and after (48rows, same md5), including the
timeSeriesLastToGridalias row; verified able to fail by dropping aregistration. All 22 existing timeSeries stateless tests pass, identically to the base binary.
Per-object sizes under
clickhouse_aggregate_functions.dir/TimeSeries/, ThinLTO (click to expand)The gate measures the per-object maximum, which falls from 56.8 MB to 11.2 MB. Total bytes in the
directory rise from 67.2 MB to 83.8 MB, since 10 more units each re-emit parts of the shared base header.
Workflow [PR]
Sync PR [sync-upstream/pr/120316]