Repository navigation
[8.6-rse] [MOD-15867] coord: search.CLUSTERSET AUTH <pw> short-form using module API - #9827
Merged
Merged
Conversation
…ule API (#9779) * Implement MRClusterTopology_FromAPI function to retrieve cluster topology from module API * Add parse_topology_short_form function to handle short form topology parsing * Add tests and new required mock API * Refactor RMCK_GetClusterNodesList and RMCK_GetClusterNodeInfo to use std::string::copy for safer string handling * Address SonarCloud lints in new short-form code - cluster_topology.c: take RedisModule_ClusterGetSlotRangesByNodeId result as pointer-to-const (S5350). - redismock.cpp: switch the cluster-mock locks from std::lock_guard<std::mutex> to std::scoped_lock (S5997, S6012); use const references in iteration loops (S5350); mark unused ctx/master_id parameters as unnamed (S1172). - test_cpp_cluster_topology.cpp: pass addNode's slots by const reference (S1238); use nullptr instead of NULL (S4962). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Drop unreachable ip[0] == '?' check in MRClusterTopology_FromAPI The "?" sentinel is a CLUSTER SHARDS reply convention for an unknown endpoint; the RedisModule_GetClusterNodeInfo API doesn't return it. Drop the check and the NODE_D fixture that exercised it. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Align cluster slot-ranges API name with upstream Redis PR #14953 Rename RedisModule_ClusterGetSlotRangesByNodeId → RedisModule_GetClusterNodeSlotRanges to match the symbol name in the upstream Redis PR that adds this API (redis/redis#14953). Move the redismodule.h declaration and REDISMODULE_GET_API call to the same position upstream places them (next to GetClusterNodeInfo) so the file stays close to a straight diff against upstream once the PR lands. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Manage cluster-API allocations explicitly instead of via auto-memory * address review comments * move validity checks to logged branch * RedisModule_GetClusterNodeSlotRanges never returns NULL * add defensive check back * fix security concern --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> (cherry picked from commit 9a6b9b1)
2 of 4 tasks
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
GuyAv46
approved these changes
May 25, 2026
|
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
May 25, 2026
GuyAv46
added this pull request to the merge queue
May 25, 2026
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.



Description
Backport of #9779 to
8.6-rse.Describe the changes in the pull request
search.CLUSTERSETaccepts only the long form (MYID … RANGES n SHARD … SLOTRANGE … ADDR … MASTER …), which forces the orchestrator to enumerate every shard's slot range, host, and port.search.CLUSTERSET AUTH <password>, that builds the topology directly from the Redis Module cluster API. The newMRClusterTopology_FromAPIwalksRedisModule_GetClusterNodesList/GetClusterNodeInfo/GetClusterNodeSlotRanges, keeps master nodes that own slots, sets the password on every endpoint, and marks the local node (REDISMODULE_NODE_MYSELF) asmy_shard_idx.RedisEnterprise_ParseTopologydispatches to the short form whenargc == 3 && RedisModule_GetClusterNodeSlotRanges.RedisModule_GetClusterNodeSlotRanges(upstream Redis PR Add RM_GetClusterNodeSlotRanges module API redis/redis#14953, planned for OSS Redis 8.10 and backported to Enterprise 8.4), the orchestrator can send a 3-argumentsearch.CLUSTERSET AUTH <pw>and the module computes the topology itself. Long-form behavior is unchanged when the gate isn't taken.Which additional issues this PR fixes
Main objects this PR modified
MRClusterTopology_FromAPI(new) —src/coord/rmr/cluster_topology.c. Manages module-owned slot range arrays explicitly viaRedisModule_ClusterFreeSlotRanges(per PR review preference to avoidRedisModule_AutoMemory).parse_topology_short_form(new) andRedisEnterprise_ParseTopologydispatch —src/coord/rmr/redise.cRedisModule_GetClusterNodeSlotRangesdeclaration added tosrc/redismodule.hat the same position upstream places it (next toGetClusterNodeInfo/GetClusterNodesList); to be removed when the file is re-synced from upstream after #14953 lands.GetClusterNodesList,GetClusterNodeInfo,GetMyClusterID,GetClusterSize,GetClusterNodeSlotRanges,FreeClusterNodesList) —tests/cpptests/redismock/MRClusterTopology_FromAPI(test_cpp_cluster_topology.cpp) and 5 dispatch/short-form tests appended totest_cpp_clusterset.cpp. Verified end-to-end against a 3-node cluster built from #14953.Mark if applicable
The API change is the new
search.CLUSTERSET AUTH <password>short form. The long form is untouched.Release Notes
search.CLUSTERSETnow accepts a 3-argument short form,search.CLUSTERSET AUTH <password>, on hosts that exposeRedisModule_GetClusterNodeSlotRanges(OSS Redis 8.10+ / Enterprise 8.4+ backport). The orchestrator no longer needs to spell out shards and slot ranges — the module fetches them from the cluster.Follow-up
src/redismodule.his re-synced from upstream after #14953 lands, drop the manual declaration ofRedisModule_GetClusterNodeSlotRangesadded here (it should already match upstream's position, so this is a straight diff).&& RedisModule_GetClusterNodeSlotRangeshalf of the dispatch gate inRedisEnterprise_ParseTopology, and use it for OSS as well instead of callingCLUSTER SHARDS.🤖 Generated with Claude Code
Note
Medium Risk
Changes how cluster topology is discovered and which nodes/slots are included; wrong filtering or API misuse could mis-route coordination, though behavior is gated on the new API pointer and covered by new tests.
Overview
Adds a 3-argument
search.CLUSTERSET AUTH <password>path when the host exposesRedisModule_GetClusterNodeSlotRanges, so the orchestrator no longer has to send the fullMYID/RANGES/SHARDtopology.MRClusterTopology_FromAPIbuilds the sameMRClusterTopologyfromGetClusterNodesList,GetClusterNodeInfo, and per-node slot ranges: masters with slots only, optional password on every endpoint,my_shard_idxwhen the local node is a slotted master (replica or slot-less local node staysUINT32_MAXlike the long parser).RedisEnterprise_ParseTopologyroutesargc == 3to the short parser; the long form is unchanged otherwise.Declares
RedisModule_GetClusterNodeSlotRangesin vendoredredismodule.huntil upstream sync.SetClusterCommanddrops verbose invalid-arg / per-shard range logging on failure. redismock gains a configurable cluster mock and tests forFromAPIand short-form dispatch.Reviewed by Cursor Bugbot for commit 57316d0. Bugbot is set up for automated code reviews on this repo. Configure here.