Port config callbacks to Redis 8 module API#657
Open
bigmountainben wants to merge 1 commit into
Open
Conversation
Redis 8.4's setModuleEnumConfig passes the prefixed "raft.<name>" to the registered callback, while the bool/string/numeric setters still pass the unprefixed "<name>". Strip a leading "<prefix>." at the top of each getter/setter so the strcasecmp chains match either form. Move sc_list_init(&rr->blocked_command_list) ahead of ConfigInit() in RedisRaftCtxInit() so the list is initialized before any registered config callback can run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
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.
Summary
<prefix>.in everyRedisRaftConfiggetter/setter so the callbacks work against both Redis ≤ 8.3 (unprefixed"<name>") and Redis 8.4+, wheresetModuleEnumConfigpasses the prefixed"raft.<name>"to the callback while the bool/string/numeric setters still pass the unprefixed form.sc_list_init(&rr->blocked_command_list)ahead ofConfigInit()inRedisRaftCtxInit()so the list is initialized before any registered config callback can run during registration.Background
In Redis 8.4 the module config plumbing was tightened:
setModuleEnumConfignow hands the callback the full"<module-prefix>.<name>"it was registered under, while the other typed setters continue to pass the bare"<name>". The existingstrcasecmp(name, conf_*)chains insrc/config.cmatched the bare form only, so anyCONFIG SET raft.trace ...(orraft.loglevel) on Redis 8.4 would silently fall through.The fix is a one-liner per callback (
name = stripConfPrefix(name);) that normalizes both forms; no API signatures change and pre-8.4 builds are unaffected.Test plan
CONFIG SET raft.trace nodeandCONFIG SET raft.loglevel debuground-trip viaCONFIG GETon Redis 8.4.CONFIG SET raft.log-fsync no(bool),CONFIG SET raft.addr 127.0.0.1:5001(string),CONFIG SET raft.periodic-interval 200(numeric) all still apply on Redis 8.4.RedisRaftCtxInit()completes — verifies theblocked_command_listinit reorder).