Conversation
| uint64_t max_batch_bytes_size = coordination_settings[CoordinationSetting::max_requests_batch_bytes_size]; | ||
| size_t max_batch_size = coordination_settings[CoordinationSetting::max_requests_batch_size]; | ||
| const auto & dynamic_settings = keeper_context->getDynamicSettings(); | ||
| uint64_t operation_timeout_ms = dynamic_settings[CoordinationSetting::operation_timeout_ms].totalMilliseconds(); |
There was a problem hiding this comment.
but you didn't mark it as hot reloadable
There was a problem hiding this comment.
operation_timeout_ms is passed into nuraft, so wouldn't be easy to hot reload.
It's ok to use getDynamicSettings() for non-reloadable settings. Unless you think it would be better to have a style convention to always do getCoordinationSettings() even if there's already a perfectly good instance of CoordinationSettings right there in a local variable. (I was thinking the opposite: use getDynamicSettings everywhere and remove getCoordinationSettings. But that would require checking all call sites to fix the ones that hold on to the returned reference for too long.)
There was a problem hiding this comment.
Ah now I see what is going on. It is a bit confusing and people could easily mess up as you have access to all settings in both.
There was a problem hiding this comment.
So what do you propose? Convention to use getCoordinationSettings for non-reloadable settings? Split settings into two separate structs? Remove getCoordinationSettings and update all call sites to use getDynamicSettings? Merge as is? Abandon this PR? I'm ok with most of these options, unclear which is best.
There was a problem hiding this comment.
I would just have getCoordinationSettings, and have the logic for dynamic settings.
Using getDynamicSettings everywhere could be misleading and understood as all settings here are dynamic.
There was a problem hiding this comment.
Do you mean remove getDynamicSettings or have a convention to not use it for non-reloadable settings?
There was a problem hiding this comment.
Renamed getCoordinationSettings to getFixedCoordinationSettings, and getDynamicSettings to getCoordinationSettings.
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
|
The test |
…Settings -> getFixedSettings
|
The |
|
Update changelog, this is a very good change. |
|
Stress test (arm_msan) - tracking issue: #102241, should be fixed by #102305 |
LLVM Coverage Report
Changed lines: 83.48% (283/339) | lost baseline coverage: 8 line(s) · Uncovered code |

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A few Keeper server settings are now hot-reloaded if config file is changed at runtime: max_requests_batch_size, max_requests_batch_bytes_size, max_request_size, quorum_reads.
I got tired of restarting the server all the time when benchmarking, so here's a way to tweak things on the fly.
To make a setting hot-reloadable, add
HOT_RELOADflag to its declaration inCoordinationSettings.cpp, and usekeeper_context->getCoordinationSettings()to get the latest value.This turned out much easier than expected. I always thought this would have to be slow or complicated (rcu! hazard pointers! thread-cached refcount!) and require changing all the call sites. But no, it's fine, you can just cache a shared_ptr in a thread-local variable to avoid all cacheline contention.
This PR only makes a couple easiest settings reloadable, just to make sure it works:
max_requests_batch_size,max_requests_batch_bytes_size,quorum_reads.Maybe we should do this to ServerSettings too, maybe replacing some of the laborious manual change propagation in the config reload callback.
Version info
26.4.1.826