Closed KevinLussier-Netskope closed 6 months ago
Good finding.
I wonder which scenarios this check is expected to help in, any idea?
It shouldn't have been triggered since @
was introduced.
After some digging in legacy it seems that this check was added 2015, must have been Redis 4 at that time.
I found an example in an issue where :0@
is received from Redis.
(I also searched for CLUSTER_NODE_NOADDR in the Redis source code)
If I understand it correctly it's in scenarios where node-ips are reused for new cluster nodes, like when running a Redis cluster in K8s. The check is probably still needed then, but with your correction. It would be great with an additional testcase for this though.
I found an example in an issue where
:0@
is received from Redis. (I also searched for CLUSTER_NODE_NOADDR in the Redis source code)If I understand it correctly it's in scenarios where node-ips are reused for new cluster nodes, like when running a Redis cluster in K8s. The check is probably still needed then, but with your correction. It would be great with an additional testcase for this though.
Yes. that example that you linked is precisely what was seen in our Redis Cluster. Hence the need for the fix :-). I'll try to add a test case to cover this.
The current implementation assumes that the entire part is only 2 characters when the IP and port are not set (IP is empty and port is 0). However, this is incorrect because the '@cport' is also present so the current check fails. Additionally, there may be an optional ',hostname' as well which is not accounted for.
The fix here simply changes the logic from "if the part is ':0'" to "if the part starts with ':0'".