-
Notifications
You must be signed in to change notification settings - Fork 2.4k
(ClusterClient).ForEachNode does not cover all nodes #701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why do you want to tap every client? AFAIR go-redis only uses nodes in Probably |
I want to wrap each client to find out which one of them has successfully executed a command (as you have suggested here). In the current setup, each wrapped process command returns an error because the one that succeeds is not wrapped (the Some potentially unnecessary context (as to why those ports are there, and why I'm not sure if the GC would remove them - they are valid): the redis cluster runs in a Docker container where the ports are exposed as :7000-:7005, but inside the container the nodes find each other using that IP address (172.17.0.2). I hope what I'm saying makes sense. I do realize however that my setup is odd due to this IP/Docker thing, but I wonder if my suggested change to the code would not make everything a bit more correct. What are your thoughts? |
My guess was that you want to measure latency to every node in the cluster, which can be achieved with What do you really try to achieve?
If |
The problem is that it's a loopback address in the Docker container, but not on my local machine. The cluster advertises it. When the library tries to connect to it, it fails, but when it tries to connect to simply :7004, that works fine. Do you see the issue? |
Sorry, forgot to answer your first question.
TL;DR I want to know which node in the cluster ran a command. I'm trying to wrap the cluster process to apply tracing to each command that runs on it, using our tracing library (dd-trace-go). As it works now, I am not able to tell which node runs the command and that is kind of essential when tracing Redis calls. So I was hoping to somehow work with WrapClient to be able to tell which is the client that ran my command successfully (returning a non-nil error) and use that. |
Actually it seems that go-redis uses the See here. |
Resolved in PR. |
In a cluster with 3 masters (ports 7000-7002) and 3 slaves (ports 7003-7005) connected as:
Using
WrapProcess
insideForEachNode
does not wrap each client, leaving gaps.ForEachNode
uses afor
loop to go through each master (state.masters
) and slave (state.slaves
), but omits some nodes (state.nodes.nodes
).In the above setup, the
state
field contains:Even though
ForEachNode
goes as expected through each unique node, it does not offer the possibility to tap into every client. One possible fix could be:Would this change or a similar one make sense? Or am I doing something stupid?
The text was updated successfully, but these errors were encountered: