Add runtime management of eligible server options via CONFIG GET/SET#1965
Draft
vazois wants to merge 2 commits into
Draft
Add runtime management of eligible server options via CONFIG GET/SET#1965vazois wants to merge 2 commits into
vazois wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds runtime management of eligible
GarnetServerOptionsthrough the RESPCONFIG GET/CONFIG SETcommands. These options can be viewed and adjusted at runtime because they are read live at their point of use and require no physical change to the running server (no restart, no reallocation).How
ServerConfigType(libs/server/ServerConfigType.cs) is now apublicenum augmented with a member per runtime-adjustable option, plus aCOUNTsentinel. Time-based members carry an explicit unit suffix (_MS/_SECONDS/_MICROS) matching the underlyingGarnetServerOptionsproperty so the unit is unambiguous at every use site.RuntimeServerConfig(libs/server/RuntimeServerConfig.cs, newpublicclass) is along[]-backed table indexed byServerConfigType. It is allocation-free, contiguous, O(1) indexed, and read/written withVolatile(atomic on 64-bit). Each slot is a raw 8-byte cell whose interpretation (int/long/bool/enum/ seconds-based timeout / string) is described by per-option metadata (ConfigKind). Values are seeded fromGarnetServerOptionsat startup (Init) and mutated at runtime viaTrySet(with per-option range/type validation).StoreWrapper.runtimeConfigso the live value is reachable across both the server and cluster layers.GarnetServerOptionsremains onStoreWrapperfor options that are not runtime-adjustable.ServerConfig.cs:CONFIG GET/CONFIG SETresolve parameter names (honoring aliases, e.g.cluster-timeout→cluster-node-timeout) viaRuntimeServerConfig.TryGetTypeand read/write the table.timeout,save,appendonly,databases) are exposed throughCONFIG GET/GET *but rejectCONFIG SETwith a clear "read-only" error; their values are computed from live server state.slave-read-onlystays per-session, following RedisREADWRITE/READONLYsemantics, and is resolved by theCONFIG GEThandler which has the session in scope.libs/serverandlibs/clusterto read from the table.Runtime-adjustable options included
cluster-node-timeout,replica-sync-delay,replica-offset-max-lag,aof-tail-witness-freq,aof-replay-max-drift,repl-diskless-sync-delay,repl-attach-timeout,cluster-replication-reestablishment-timeout,compaction-max-segments,compaction-force-delete,compaction-type,slowlog-log-slower-than,object-scan-count-limit,sg-get.Tests
test/standalone/Garnet.test/RespConfigTests.cs:ConfigGetSetRuntimeOptionsTest— round-trips integer, long, boolean, enum, seconds-timeout, alias, and multi-option forms.ConfigSetRuntimeOptionValidationTest— rejects malformed / out-of-range values without mutating state.ConfigGetAllAndReadOnlyRejectionTest— read-only params reject SET;GET *includes read-only + per-sessionslave-read-only.RespAdminCommandsTests.SimpleConfigGetcontinues to pass (timeout/save/appendonly/slave-read-only/databases/cluster-node-timeout).TreatWarningsAsErrorson);dotnet format --verify-no-changesclean.Notes
Scope was intentionally limited to "Category A" fully runtime-safe options; not every option is wired up yet. Some previously-considered options (e.g.
repl-sync-timeout,gossip-delay) were left out because they are captured at startup and would require additional plumbing.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
Copilot-Session: 16393bf0-b771-4b90-a5f5-49cc389cd3fc