Skip to content

Port config callbacks to Redis 8 module API#657

Open
bigmountainben wants to merge 1 commit into
RedisLabs:masterfrom
bigmountainben:redis8-module-api
Open

Port config callbacks to Redis 8 module API#657
bigmountainben wants to merge 1 commit into
RedisLabs:masterfrom
bigmountainben:redis8-module-api

Conversation

@bigmountainben
Copy link
Copy Markdown

@bigmountainben bigmountainben commented May 13, 2026

Summary

  • Strip a leading <prefix>. in every RedisRaftConfig getter/setter so the callbacks work against both Redis ≤ 8.3 (unprefixed "<name>") and Redis 8.4+, where setModuleEnumConfig passes the prefixed "raft.<name>" to the callback while the bool/string/numeric setters still pass the unprefixed 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 during registration.

Background

In Redis 8.4 the module config plumbing was tightened: setModuleEnumConfig now hands the callback the full "<module-prefix>.<name>" it was registered under, while the other typed setters continue to pass the bare "<name>". The existing strcasecmp(name, conf_*) chains in src/config.c matched the bare form only, so any CONFIG SET raft.trace ... (or raft.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

  • Build against Redis 8.4 and run the integration suite.
  • CONFIG SET raft.trace node and CONFIG SET raft.loglevel debug round-trip via CONFIG GET on 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.
  • Same commands still work against an older Redis (≤ 8.3) build to confirm no regression.
  • Module loads cleanly with config options supplied at load time (so the setter callbacks fire before RedisRaftCtxInit() completes — verifies the blocked_command_list init reorder).

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>
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 13, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant