Repository navigation
Make getServerSetting return live values for runtime-changeable settings - #105172
Conversation
For settings such as `max_server_memory_usage` whose effective value is computed at startup or adjusted on config reload (memory limits, cache sizes, thread pool sizes, etc.), `system.server_settings` already reports the value the component is actually using, while `getServerSetting` reported only the raw value loaded from the config - typically `0` or some other placeholder. Extract the list of runtime overrides out of `dumpToSystemServerSettingsColumns` into a shared helper, expose it via `ServerSettings::tryGetLiveValueAsString`, and consult it from `getServerSetting` so both surfaces agree. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Workflow [PR], commit [ea7d7f0] Summary: ✅
AI ReviewSummaryThis PR makes Final VerdictStatus: ✅ Approve |
The changeable-settings map is keyed by canonical names, but `getServerSetting` accepts path-style aliases such as `query_cache.max_size_in_bytes` (alias for `query_cache_max_size_in_bytes`). Without resolving the alias first, the lookup missed the live value and the function silently fell back to the stale config value. Run `name` through `ServerSettingsTraits::resolveName` before consulting the map, and add a test that exercises a path alias.
…_values` The earlier follow-up [`7082d164f86`](7082d164f86) tried to support path-style names (e.g. `query_cache.max_size_in_bytes`) in `getServerSetting` by routing the lookup through `ServerSettingsTraits::resolveName`. That does not actually help: `LIST_OF_SERVER_SETTINGS_WITH_PATH` expands only `DECLARE(...)` entries, so path strings are never inserted into `aliases_to_settings` and `resolveName` returns the path verbatim. The follow-up test `getServerSetting('query_cache.max_size_in_bytes')` therefore throws `UNKNOWN_SETTING` from `BaseSettings::set`/`get` (see the Fast-test failure at https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105172&sha=7592dd7aeb3033734c7030b1fa315a1a7aac75f2&name_0=PR&name_1=Fast%20test). Revert the no-op `resolveName` call and drop the broken alias assertion so this PR stays focused on its stated goal: returning live values for runtime-changeable settings. Adding path-as-alias resolution is a separate, cross-cutting change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The `collectChangeableServerSettings` map hardcoded the value of
`s3queue_disable_streaming` to `"0"`, which made `system.server_settings`
display a stale value and now also makes `getServerSetting` (which routes
through `ServerSettings::tryGetLiveValueAsString`) return a stale value
that ignores the most recent config reload.
Replace the hardcoded `"0"` with the actual live value read back from the
global `ServerSettings`, which is kept up to date by `Context::setS3QueueDisableStreaming`
on every `SYSTEM RELOAD CONFIG`.
This fixes `test_storage_s3_queue/test_5.py::test_disable_streaming` and
the tests that cascade from it (`test_mv_settings`, `test_persistent_processing`,
`test_metadata_cache_exact_size_tracking`, `test_detach_attach_table`) which
all exercise `SELECT getServerSetting('s3queue_disable_streaming')` after a
`SYSTEM RELOAD CONFIG`.
…g-live-values # Conflicts: # src/Core/ServerSettings.cpp
| /// In that case the live value held by the component diverges from the value stored in `ServerSettings`, | ||
| /// which only reflects what was last loaded from the config. `system.server_settings` already returns | ||
| /// the live value for such settings - mirror that behaviour here. | ||
| if (auto live = server_settings.tryGetLiveValueAsString(global_context, setting_name)) |
There was a problem hiding this comment.
This looks like a hack. Why don't we update ServerSettings when updating configuration?
There was a problem hiding this comment.
I think this PR is deliberately matching the model that system.server_settings already uses. Updating ServerSettings during reload would be a broader ownership change: many values in this list are post-processed or component-owned live state (total_memory_tracker, caches, pools, throttlers), so making ServerSettings authoritative would require every reload path to write back the effective value after clamping or applying it, not just the raw config value.
That may be a cleaner long-term direction, but it is larger than this scoped fix. Sharing the existing live-value projection keeps getServerSetting consistent with system.server_settings without changing the current split between raw config state in ServerSettings and effective state in the components.
`system.server_settings` reports `keeper_hosts` (derived from the
`<zookeeper>` config) via a special-case overlay in
`StorageSystemServerSettings::fillData`, separate from the
`collectChangeableServerSettings` helper that `getServerSetting` now
consults. As a result `getServerSetting('keeper_hosts')` returned the
raw empty default while `system.server_settings` returned the live
endpoints, breaking the "both surfaces agree" contract for this
setting.
Move the `keeper_hosts` projection into `collectChangeableServerSettings`
so both surfaces share a single source of truth, and drop the duplicated
overlay from `fillData`. Extend the regression test to compare
`getServerSetting('keeper_hosts')` with `system.server_settings`.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed What changed: Verification: built clean and ran on a single-node embedded-Keeper server — I left the "why not update Resolved the |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 48/48 (100.00%) | Lost baseline coverage: none · Uncovered code |
|
A race condition was found: #106902. Let's revert |
For server settings whose effective value is computed at startup or adjusted on config reload (memory limits, cache sizes, thread pool sizes, etc.),
system.server_settingsalready reports the value the component is actually using, whilegetServerSettingreturned only the raw value loaded from the config — typically0or some other placeholder. For example:Extract the list of runtime overrides out of
dumpToSystemServerSettingsColumnsinto a shared helper, expose it viaServerSettings::tryGetLiveValueAsString, and consult it fromgetServerSettingso both surfaces agree.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
getServerSettingto return the live effective value for runtime-changeable server settings (such asmax_server_memory_usage,mark_cache_size,max_concurrent_queries, thread pool sizes, etc.), matching whatsystem.server_settingsreports.Documentation entry for user-facing changes
Version info
26.6.1.468