Repository navigation
Conversation
Keep the ordinary build on its original dense source path. Enable the process-counter prototype only through an explicit research build option, with a public functional-trained sample layout and isolated validation. Document unresolved allocation, signal and lifetime contracts.
|
Workflow [PR], commit [ecb05e2] Summary: ❌
AI ReviewSummaryThis PR replaces dense Findings❌ Blockers
Missing context / blind spots
Tests
Final VerdictStatus: ❌ Block Preserve nonallocating publication after worker launch and during cleanup, add focused regression coverage, and supply the pending hot-path measurements. |
Recognize `ProfileEvents::PagedExperiment` and `ProfileEvents::PagedExperimentStorage` as namespaces in the event checker. Use project includes, adjust the standalone include root, and remove an unused import. Check `close` failures during initialization through the existing configuration error exit. CI report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/118532/db233bc80012312a072618b2dede3570e2832d1f/pr/result_style_check.json Related: ClickHouse#118532
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes163 object files changed (+101.41 KiB total), 0 added.
716 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 units1502 translation units recompiled, 8331 s compile time in total, 1502 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.06 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. Symbol sizes
|
| Binary | Symbol | Master | PR | Δ |
|---|---|---|---|---|
programs/clickhouse |
ProfileEvents::global_counters_storage |
14.69 MiB | removed | -14.69 MiB (-100.00%) |
programs/clickhouse |
ProfileEvents::Counters::global_storage |
new | 1.69 MiB | +1.69 MiB |
Capture the wait duration under the scheduler mutex using a plain `Stopwatch`, and publish the pending measurement after unlocking. Retain its `ThreadGroup` through publication. Keep dequeued requests marked pending until their wait metric is recorded, then acknowledge callback completion under the mutex. This reuses the existing cancellation handshake so `free` cannot complete ahead of an active callback's metric publication. Run queue-limit failure callbacks outside the queue mutex too, avoiding lock inversion with cancellation. Finish rejection accounting before callbacks can release request ownership, and do not count a concurrent queue drain twice. Add two focused `FifoQueue` regression tests. Lazy counter allocation can still fail during destructor publication; this does not resolve the experiment's nonallocating-update contract. Related: ClickHouse#118532 Review: ClickHouse#118532 (comment)
Add a named-event token and migrate CPU scheduler wait publication. Keep the initial forty-event reservation catalogue independent of the learned hot rank. Extend standalone validation with reservation and allocation-failure cases.
…ogue Resolve the pinned public event IDs and validate the mandatory CPU, memory-reservation and IO event sets against the shipped rank. Exercise reserved updates and cold-allocation failure at hot budgets 40 and 128; reject insufficient capacity and unsupported catalogue formats. ClickHouse#118532 (comment) ClickHouse#118532 (comment)
Mark generated event declarations as used by their trait specializations and register `nonAllocatingEvent` as an API rather than an event name in the existing checker exclusions. https://github.com/ClickHouse/ClickHouse/actions/runs/34229527818/job/102072421201 ClickHouse#118532
Reject paged process storage before backing allocation, including all-hot configurations. Preserve the standalone paged adapter and add explicit/default dense and paged rejection checks. Update the experiment documentation to distinguish the incomplete named-event subset from the dynamic cleanup contract. ClickHouse#118532 (comment)
Enable size-class-aware eager backing in normal jemalloc builds. All counter cells exist before publication; updates retain their nonallocating contract. Keep other allocator builds contiguous and select splitting only when the aligned allocation estimator proves a net memory saving. Remove the production experiment flag, environment parsing and reservation API. Replace the standalone research harness in the mergeable diff with benchmarks of actual `Counters` and regression coverage for all event IDs. Preserve the research harness and measurements separately. Add deterministic `CPULeaseAllocation` grant/failure races against `free` while wait-time publication is outside the scheduler mutex. ClickHouse#118532 (comment) ClickHouse#118532 (comment) ClickHouse#118532 (comment)
The small benchmark link can omit the TLS definition accessed through inline assembly. Retain the verified symbol in the normal Linux/FreeBSD executable link so Release/ThinLTO benchmarks run without a manual relink. Limit the option to the standalone executable; tests-only configurations do not create that target. Production server link options are unchanged.
Keep the intentional moved-from `reset` coverage with a narrow suppression. Qualify `FifoQueue::purgeQueue` in the destructor to make its existing base-class dispatch explicit. Reproduced both diagnostics on the real test translation units and verified the fixes with the same targeted clang-tidy checks. ClickHouse#118532 https://s3.amazonaws.com/clickhouse-test-reports/PRs/118532/76ce3ea9e933b06bb98571dab6cbd788629c60aa/pr/build_arm_tidy/build_clickhouse/build_clickhouse.log
|
📊 Cloud Performance Report ✅ AI verdict: Release-transition baseline: compared against the most recent available 26.9 masters at or before the trusted base-commit anchor because no 26.10 master baseline exists there. 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
|
Exclude `preallocate` and `incrementNonAllocating` from event declaration validation, like the other namespace functions. ClickHouse#118532 https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=6f5ebf8fd03f9107df4478c4974a8bca3c1b3106&name_0=PR&name_1=Style%20check
Satisfy `cppcoreguidelines-init-variables`; both allocation branches still assign the pointer before use. ClickHouse#118532 https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=6f5ebf8fd03f9107df4478c4974a8bca3c1b3106&name_0=PR&name_1=Build%20%28arm_tidy%29
Replace the integer exception and empty catch with `std::exception` and `EXPECT_THROW`, preserving cleanup under allocation denial while satisfying clang-tidy. Validation: configured clang-tidy 21 passes on the counter and test translation units; 15 focused debug tests pass with ThinLTO; C++ style check passes. ClickHouse#118532 https://github.com/ClickHouse/ClickHouse/actions/runs/36160482455/job/108156142362
|
Dear @Michicosun, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Keep failed-read metrics hot across all readers. Reserve connection-error backing before either HTTP connection path. Reserve Keeper server metrics globally before startup and publish through checked non-allocating updates, including arbitrary-thread Raft callbacks. Global Keeper exports are retained; these dispatcher metrics no longer accumulate in unused worker-local counters. Related: ClickHouse#118532 (comment) Related: ClickHouse#118532 (comment) Related: ClickHouse#118532 (comment) Related: ClickHouse#118532 (comment)
Keep the uncontended path unchanged. Reserve cold wait events before blocking or timed acquisition and use checked non-allocating publication while holding the mutex. Add deterministic tests for acquisition and timeout, including parent accounting.
Preserve the reviewed `ProfileEvents` fixes and include current public CI and dependency updates. Prior CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=4c71c8c4d3cd0887b2e89d5437e7721c6435fc99&name_0=PR Related: ClickHouse#118532
Keep the global memory-exception guard added to `MetadataOperationsHolder::rollback` while preserving preallocated counter publication. Related: ClickHouse#118532
Replace the undefined `AdaptiveAggregationSpillBacklogSheds` reference with public `ZooKeeperWatchResponse` in the counter, profiled-lock, and allocation-interceptor tests. The replacement is outside both hot catalogues, preserving cold-page coverage. The undefined event failed the `unit_tests_dbms` link in debug and sanitizer builds; syntax-only validation cannot detect it. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=b0cec097ad9b30984f74c9d5e806b9673a277a4d&name_0=PR Related: ClickHouse#118532 Build logs: https://github.com/ClickHouse/ClickHouse/actions/runs/41965702189/job/127048833325 https://github.com/ClickHouse/ClickHouse/actions/runs/41965702189/job/127048833416
Preserve the profile-counter safety changes while incorporating current public dependencies and CI fixes. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=409f5e091ab2797a8252164c71906d43fc4f1e8e&name_0=PR Related: ClickHouse#118532
The storage-memory profile shows a cold page allocated from `MemoryTracker::settleDriftOnQueryEnd` during `ThreadGroup` destruction. Keep both drift events in resident storage and use checked nonallocating publication: cleanup may run on a different thread than construction. Add a cross-thread cleanup test that verifies nested scope accounting and settles synthetic drift while allocations are denied. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=409f5e091ab2797a8252164c71906d43fc4f1e8e&name_0=PR Memory report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/118532/409f5e091ab2797a8252164c71906d43fc4f1e8e/pr/storage_memory_check/storage_memory_report.html Related: ClickHouse#118532
Preserve timed-lock outcome handling and allocation-interceptor coverage while keeping the profile-counter safeguards. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=44ffac3f765c8d3cf6b7b1397899f9c8a5f0ba75&name_0=PR Related: ClickHouse#118532
Separate backing memory tracking from the aggregation level. Default thread/process counters use the active trackers; persistent ThreadStatus worker backing explicitly uses global accounting. Preserve that policy across row/page allocation, moves, and destruction. Add real ProfileEventsScope and moved-part attribution checks for query/user charges and balanced destruction. Keep cold-update memory-limit exception suppression while restoring accounting. Review: ClickHouse#118532 (comment) CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118532&sha=44ffac3f765c8d3cf6b7b1397899f9c8a5f0ba75&name_0=PR Related: ClickHouse#118532
Keep per-endpoint expired-connection accounting in `HTTPConnectionPool` while retaining checked nonallocating counter publication. Related: ClickHouse#118532
Preserve the query-owned backing policy and nonallocating publishers. Related: ClickHouse#118532
Keep `AmberConnectionsReset`, `AmberConnectionsPreserved`, and `AmberConnectionsExpired` resident for HTTP cleanup on arbitrary threads. Mark `NonAllocatingEvent::value` as `[[nodiscard]]` for the newly enabled clang-tidy rule. Validation: source invariants and isolated accessor tidy check passed. No full compile or accounting runtime test was performed after this merge. Related: ClickHouse#118532
Preserve both the new upstream thread-profile-events test and the profile-counter reservation/accounting tests. Related: ClickHouse#118532
Scope `DENY_ALLOCATIONS_IN_SCOPE` to the timer cleanup callback so throwing the test exception can allocate its runtime object. Verify the callback runs while an exception is unwinding. The previous CI process aborted in `ColdTimerPreparesBeforeCleanup` after all allocation-interceptor tests had passed. New runtime validation is pending; local source and format checks passed. Related: ClickHouse#118532 CI: https://github.com/ClickHouse/ClickHouse/actions/runs/43977464930/job/133706106555
Publish a reservation bitmap after every CPU row owns a page. Warm calls check one bit per counter instance while still traversing current parents. Keep the bitmap with backing so moves and resets retain reservations. Add concurrency and parent-change tests and warmed benchmarks using the actual compression timer and exclusive/shared parts locks through the four-level sharded hierarchy. The current 64-bit row layout remains 1728 B. Source and layout checks passed; new full-runtime tests and performance measurements remain pending because dev was unreachable and the local build configuration was stale. Review: ClickHouse#118532 (comment) Related: ClickHouse#118532
| std::optional<MemoryTrackerBlockerInThread> blocker; | ||
| if (tracking == MemoryTracking::Global) | ||
| blocker.emplace(VariableContext::Global); | ||
| auto fresh = std::make_unique<Count[]>(cold_page_size); |
There was a problem hiding this comment.
[Blocker] Reserve global thread-startup counters before launching the worker
GlobalThreadPoolThreadCreationMicroseconds and GlobalThreadPoolExpansions are still cold. ThreadPoolImpl::ThreadFromThreadPool publishes them at src/Common/ThreadPool.cpp:910-914, after starting its worker at line 908. In a fresh counter scope, either publication can now reach this allocation. If it throws std::bad_alloc, construction unwinds without calling ThreadFromThreadPool's destructor, so its live std::thread member is destroyed without being joined and terminates the process. LockMemoryExceptionInThread suppresses tracker exceptions, but cannot prevent allocator failure.
Please make these events resident or reserve their complete counter chain before starting the worker, and add focused coverage of allocation failure around thread startup. Reserving only the lock-wait and shrink events does not protect this construction path.
Store
ProfileEventsin inline hot counters and lazy 32-counter pages at every level. Keep error/cleanup events resident. Query-owned backing stays query/user-accounted; persistent worker, user and global backing uses global accounting. Cold updates contribute to usage without enforcing memory limits synchronously.Cache completed page reservations while still traversing current parents, avoiding repeated all-CPU scans. Add warmed benchmarks for actual compression timers and exclusive/shared parts locks. Before/after timings remain pending. The bitmap fits existing padding in the measured 64-bit row layout: 1,728 B before and after.
At
094b2332c6f3, storage CI retained 15,400 B more: 60 cold pages (15,360 B) plus 40 B elsewhere. Initial thread backing is filtered out and static storage is absent, so this is not a net-footprint comparison. The failure remains unresolved; filters and thresholds are unchanged. Earlier focused benchmarks showed ~9% more writer CPU; no net performance win is claimed.All 17 allocation-interceptor tests, including the three accounting tests, passed in non-sanitized
amd_debugat094b2332c6f3. The process later aborted in the timer test because throwing occurred inside an allocation-denied scope; the guard now covers cleanup only. New cache tests cover concurrent reservations, reset, move and reparenting. Current-head runtime validation is pending; local checks cover source invariants, formatting and field layout only. Dev SSH was unreachable and the local build configuration is stale.Related: #129357
Related: #121545
Memory report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/118532/094b2332c6f3cad31c74fdfd771ea867d5ce058e/pr/storage_memory_check/storage_memory_report.html
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Store profile counters in inline hot storage and lazy cold pages to reduce backing memory when few events are used. Cold updates can allocate, and fully populated storage can use more memory. Query-owned backing remains query-accounted; required error and cleanup counters are reserved before use.
Workflow [PR]
Sync PR [sync-upstream/pr/118532]