Expand cluster READ_COMMANDS with additional read-only commands and reorganize the list of commands by category by petyaslavova · Pull Request #3845 · redis/redis-py (original) (raw)
This PR improves the Redis cluster's READ_COMMANDS frozenset 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:
- Find specific commands
- Add new commands in the future
- Understand the command categorization
- Removed deprecated commands: Aligns with Redis 6.2+ best practices
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