Expand cluster READ_COMMANDS with additional read-only commands and reorganize the list of commands by category #3845
+75
−12
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.
This PR improves the Redis cluster's
READ_COMMANDSfrozenset by:Adding existing read-only commands that are exposed in redis-py but were missing from the cluster routing list.
Reorganizing the entire list into 12 logical sections with inline comments for better maintainability:
Bit Operations (3 commands)
Scripting (3 commands)
Key Operations (9 commands)
String Operations (5 commands)
Geo Operations (4 commands)
Hash Operations (14 commands)
List Operations (5 commands)
Set Operations (10 commands)
Sorted Set Operations (19 commands)
Stream Operations (5 commands)
JSON Module (9 commands)
RediSearch Module (4 commands)
Removing deprecated commands:
GEORADIUS - Deprecated in Redis 6.2 (use GEOSEARCH instead)
GEORADIUSBYMEMBER - Deprecated in Redis 6.2 (use GEOSEARCH instead)
Impact
Improved cluster replica routing: 5 additional read-only commands can now be safely routed to replica nodes for load distribution
Better code organization: Commands are now grouped by data type/module, making it easier to:
Testing
The changes maintain backward compatibility as they only add new commands to the read-only set and reorganize existing ones. No API changes or breaking changes.
This PR addresses the issue where the cluster's READ_COMMANDS list was severely outdated and missing many read-only operations that could safely be executed on replicas.
Fixes #2802