nebulex_redis_adapter
nebulex_redis_adapter copied to clipboard
Support string slot values in CLUSTER SHARD response
It appears Redis 7.0.14 returns slot values in the CLUSTER SHARDS command response that are represented as strings.
With string slots, nebulex_redis_adapter fails to correctly set up redis cluster shards in the client. This results in consistent MOVED responses.
Redis 7.0.14 responses
<REDACTED_IP>:6379> INFO
# Server
redis_version:7.0.14
...
<REDACTED_IP:6379> CLUSTER SHARDS
1) 1) "slots"
2) 1) "4096"
2) "5119"
3) "nodes"
4) 1) 1) "id"
2) <REDACTED_ID>
3) "port"
4) (integer) 11041
5) "ip"
6) <REDACTED_IP>
7) "endpoint"
8) <REDACTED_IP>
9) "role"
10) "replica"
11) "replication-offset"
12) (integer) 1743874443
13) "health"
14) "online"
...
Redis 7.2.2 responses
localhost:6380> INFO
# Server
redis_version:7.2.2
...
localhost:6380> CLUSTER SHARDS
1) 1) "slots"
2) 1) (integer) 10923
2) (integer) 16383
3) "nodes"
4) 1) 1) "id"
2) "fb359c5f566b29a0d3859fee3ca8c8c12f3ece79"
3) "port"
4) (integer) 6382
5) "ip"
6) "10.10.10.13"
7) "endpoint"
8) "10.10.10.13"
9) "role"
10) "master"
11) "replication-offset"
12) (integer) 266
13) "health"
14) "online"
...
Updating the handler for CLUSTER SHARDS response to support both string or integer slot values.
Note: Possibly related Redis fix: https://github.com/redis/redis/commit/4031a187321be26fc96c044fec3ee759841e8379
Thanks for the fix. Overall LGTM, I just added a comment. Also, you should rebase since I merged your other PR. Thanks.