Repository navigation
Conversation
|
Workflow [PR], commit [ef440ae] Summary: ❌
AI ReviewSummaryThis PR adds the Findings
Final VerdictFunctionally this looks correct, but I would document the new alias on the official server-settings reference before merge. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 92/95 (96.84%) · Uncovered code |
b837e7a to
aab22c1
Compare
serxa
left a comment
There was a problem hiding this comment.
Looks good, but failed tests are related
|
Dear @azat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
aab22c1 to
bed3b35
Compare
217bbab to
4427419
Compare
|
Actually those were events from just two tests, while now we have it more wide spread:
|
|
I will tune the limits to increase number of |
…7_trace_events_stress_long
Get sample probability from the first active memory tracker, otherwise settings for total memory tracker may override the settings for the nested tracker. I.e. consider total_memory_profiler_sample_min_allocation_size=4MiB and the following query: select 1 settings max_untracked_memory=0, memory_profiler_sample_probability=1 It should record some MemorySample, but, because of max_untracked_memory=0 (which uses sample probability calculation inside MemoryTracker::allocImpl()/freeImpl(), w/o it it uses correct getSampleProbability()) w/o this patch it will fallback to total_memory_profiler_sample_min_allocation_size, and will not record anything.
4300de2 to
e8d4167
Compare
total_memory_profiler_* overrides per-query memory_profiler_sample_* settings and enable memory sample profiler on CI
e8d4167 to
ace00c6
Compare
ace00c6 to
93d37cb
Compare
MemorySample are more useful then Memory in trace_log
93d37cb to
a188f50
Compare
The `check-settings-style` script parsed only the `DECLARE` and `DECLARE_WITH_ALIAS` declarators, but `LIST_OF_SERVER_SETTINGS_*`, `FORMAT_FACTORY_SETTINGS` and `LIST_OF_COORDINATION_SETTINGS` name the with-alias declarator `ALIAS` instead. The first actual `ALIAS(...)` usage - the `total_memory_profiler_sample_probability` alias of `total_memory_tracker_sample_probability` - made the `cpp` style check fail with `Could not find setting (maybe obsolete?) total_memory_tracker_sample_probability`, because the canonical setting name was never registered as a declaration. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Prove the `total_memory_profiler_sample_probability` / `total_memory_tracker_sample_probability` server setting alias contract directly at the `ServerSettings::loadSettingsFromConfig` level: - loading via the alias populates the canonical setting; - loading via the canonical name still works (regression guard for the new alias-loading loop); - a config that specifies both the canonical name and its alias is rejected. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
# Conflicts: # src/Core/ServerSettings.cpp
Addresses the AI review Major on ClickHouse#88405: the new `total_memory_profiler_sample_probability` alias was accepted by config parsing but was not rendered on the public help surface that documents setting aliases. `ServerSettings` was the only settings collection that did not register its aliases in `system.documentation`, because it lacked the `getAllAliasNames` / `resolveName` API that `Settings` and `MergeTreeSettings` expose. Add `getAllAliasNames` and `resolveName` to `ServerSettings` (mirroring the other two collections) and call `addSettingAliases` for server settings in `StorageSystemDocumentation`, so the alias now appears as `Alias of \`total_memory_tracker_sample_probability\`.`. Extend the focused gtest to assert the alias is enumerable and resolvable. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed The alias I intentionally did not touch |
Enabling `memory_profiler_sample_probability` in the default test profile (this PR's `tests/config/users.d/memory_profiler.xml`) makes ordinary queries emit `MemorySample` rows under their own `query_id`. The assertions in `00974_query_profiler.sql` read `system.trace_log` filtering only by `query_id` and `symbol`, so a `MemorySample` stack that happens to contain `%Source%` (likely during a `numbers_mt` scan) could satisfy the check even if the real/CPU query profiler stopped emitting samples, silently weakening the regression coverage. Constrain each assertion to the `trace_type` it is meant to exercise (`Real` for the real-time profiler checks, `CPU` for the CPU profiler check), so only samples from the intended profiler can satisfy it. The expected output is unchanged. Addresses the unresolved review comment on tests/config/users.d/memory_profiler.xml.
…e='Real' The new default `memory_profiler_sample_probability=0.001` causes ordinary queries to emit `MemorySample` rows under their own query_id. The test forces the real-time profiler but only asserted `count(*) > 1` on `system.trace_log` filtered by query_id, so the assertion could pass on sampled allocations alone even if the real-time profiler stopped emitting traces. Constrain the check to `trace_type = 'Real'`, matching the earlier fix to 00974_query_profiler. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…race_log Two fast test runs on 2e80898 timed out (60s per-test limit) in 01473_event_time_microseconds and 03096_order_by_system_tables, both of which start with `SYSTEM FLUSH LOGS` and wait for the shared `system.trace_log` backlog. The suite-wide `memory_profiler_sample_probability = 0.001` samples every memory tracker event, and with `max_untracked_memory = 1Mi` small allocations reach the tracker as ~1MiB batches, so the whole test suite floods `trace_log` with `MemorySample` rows and the flush exceeds the fast test timeout. CIDB shows these tests time out only ~monthly on random PRs, but three times across two runs on this PR - so it is related. Add `memory_profiler_sample_min_allocation_size = 4Mi` to the test profile, matching `total_memory_profiler_sample_min_allocation_size` in `config.d/memory_profiler.yaml`, so only genuinely large allocations are sampled. All tests that rely on sampling small allocations (01526, 02497, 02818, 04411) set the threshold explicitly and are unaffected; 01092 allocates far above 4MiB with probability 1. Update `01293_show_settings.reference` for the new changed setting. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=88405&sha=2e80898b66ca81e200389e23a0f059eda107f608&name_0=PR&name_1=Fast%20test PR: ClickHouse#88405 Co-Authored-By: Claude Fable 5 <[email protected]>
|
The last two Fixed in 652f894 by adding |
# Conflicts: # src/Core/ServerSettings.cpp
…ple` `ServerSettings::loadSettingsFromConfig` rejects a config that contains both `total_memory_tracker_sample_probability` and its new alias `total_memory_profiler_sample_probability`. `config.xml` no longer ships the canonical key, but `config.yaml.example` still did, so a YAML-based deployment that keeps the shipped main config and adds the alias in an override file would fail to start. Comment the key out there as well, using the alias name, exactly as in `config.xml`. Also cover the merged main-config + override case in `gtest_server_settings_alias`: the alias coming from an override layer is loaded, and the canonical name in the main config plus the alias in an override is still rejected.
…timing-sensitive The flaky check on this PR reported `00974_query_profiler` failing on the first `system.trace_log` assertion (`sleep(0.5)` with a `100ms` real-time profiler period): no `Real` sample was recorded for the query. The test has been flaky in this way on unrelated pull requests and on master as well. Lower `query_profiler_real_time_period_ns` to `10ms` for that query, so ~50 ticks are expected during the sleep instead of ~5, and a few missed ticks on a loaded sanitizer runner no longer make the assertion fail.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 92/95 (96.84%) · Uncovered code |
The flaky check (amd_asan_ubsan) failed 3 runs of `00974_query_profiler` even after shortening the profiler period to 10 ms: the `sleep(0.5)` sub-test got 0 `FunctionSleep` samples with `trace_type = 'Real'`. Profiler samples are sent to the trace pipe with `WriteBufferFromFileDescriptorDiscardOnFailure` over a non-blocking pipe: when a concurrent sample-heavy query (e.g. another instance of this test in the flaky check, or the suite-wide memory sample profiler this PR enables) keeps the pipe full, samples are silently dropped, and the single sleeping thread produces so few of them that all can be lost at once, while the sample-heavy `numbers_mt` sub-tests passed in the same failing runs. Sleep in 16 threads (one single-row block per thread via `numbers_mt(16)` with `max_block_size = 1`) instead of one: an order of magnitude more samples, and the sub-test also survives a single thread failing to create its profiler timer. The reference output is unchanged. Same fix as in ClickHouse#113107 (verified there locally 10/10 and 8/8 under a synthetic trace-pipe flood). CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=88405&sha=f5c9438a6df42a63494bba778b56fbe1a3191f10&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 PR: ClickHouse#88405 Co-Authored-By: Claude Fable 5 <[email protected]>
| DECLARE(Seconds, replicated_fetches_http_receive_timeout, 0, R"(HTTP receive timeout for fetch part requests. Inherited from default profile `http_receive_timeout` if not set explicitly.)", 0) \ | ||
| DECLARE(UInt64, total_memory_profiler_step, 0, R"(Whenever server memory usage becomes larger than every next step in number of bytes the memory profiler will collect the allocating stack trace. Zero means disabled memory profiler. Values lower than a few megabytes will slow down server.)", 0) \ | ||
| DECLARE(Double, total_memory_tracker_sample_probability, 0, R"( | ||
| ALIAS(Double, total_memory_tracker_sample_probability, 0, R"( |
There was a problem hiding this comment.
docs/reference/settings/server-settings/settings/total-memory.mdx still renders only ## total_memory_tracker_sample_probability, while session-setting aliases get a generated **Aliases**: line. After this change and the updated shipped config examples, a user who searches the docs for total_memory_profiler_sample_probability still will not find the documented setting page. Please update/regenerate the English server-settings docs so the alias is visible there too.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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 sizes4 object files changed (+48.35 KiB total), 0 added.
737 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 units95 translation units recompiled, 745 s compile time in total, 94 of them have a recent master baseline. |
|
Dear @azat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
2 similar comments
|
Dear @azat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @azat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Two changes related to the memory sample profiler:
total_memory_profiler_sample_probabilityserver setting as an alias of the existingtotal_memory_tracker_sample_probability, for naming consistency with the per-querymemory_profiler_sample_probabilitysetting and the othertotal_memory_profiler_*server settings. Server settings can now be loaded from the config via either an alias or the canonical name.total_memory_tracker_sample_probabilityplus a per-querymemory_profiler_sample_probabilityin the test profile) so thatMemorySampleevents are collected across the whole test suite, not just a couple of tests.Note on the merge with master: the original change to
MemoryTracker::allocImpl/free(so that the globaltotal_memory_profiler_*settings no longer override per-querymemory_profiler_sample_*settings) has been dropped, because it was superseded by #101267, which reworked sampling intogetResolvedSampleConfigtogether with the.changedgating inconfigureMemoryTrackerFromSettingsand landed on master. After merging master,src/Common/MemoryTracker.cppis identical to master, so this PR no longer changes the memory profiler logic.Related: #101267
Changelog category (leave one):
Changelog entry:
Added a
total_memory_profiler_sample_probabilityserver setting as an alias oftotal_memory_tracker_sample_probability.