-
Notifications
You must be signed in to change notification settings - Fork 979
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
Handle unknown endpoints in MOVED response #2290
Comments
We do not track the hostname to which a command was sent to as the actual socket address is just being held in the connection as internal information. The few places where we work with socket addresses are the SSL initializer and the reconnect mechanism that obtains the target address from an address supplier. To make things more complicated, the default cluster connection (used for key-less commands) connects to a random node of the cluster and on reconnect, the cluster node is being switched. For the time being, we attempt to resolve the host name from our topology by either checking for a host that maps to a particular port or use the hostname from the node that would be responsible for a particular slot while using the redirect port. |
We attempt resolving a host name from the MOVED redirect using Partitions. First, we try to handle the redirect by port lookup. If we cannot find a host with such a port, then we attempt to use the hostname from the node that would serve the slot. This isn't ideal as we do not track the logical hostname for connections. Additionally, our reconnect/address supplier mechanism does not expose the socket address for the connection.
We attempt resolving a host name from the MOVED redirect using Partitions. First, we try to handle the redirect by port lookup. If we cannot find a host with such a port, then we attempt to use the hostname from the node that would serve the slot. This isn't ideal as we do not track the logical hostname for connections. Additionally, our reconnect/address supplier mechanism does not expose the socket address for the connection.
From Redis 7.0+, unknown endpoints are supported as a MOVED target. Quote from MOVED redirection
However, the target detection code at ClusterDistributionChannelWriter sets the
target
to:6380
for the above example. As a result, the subsequent validations for cluster membership fail and even if these are suppressed usingClusterClientOptions.validateClusterNodeMembership(false)
, theRedisURI
creation for the new target fails due to an empty hostname.Shouldn't the target detection supply a non-empty host based on the endpoint that received the MOVED response
PS: Some cluster information from my test setup using
cluster-preferred-endpoint-type unknown-endpoint
(Redis 7.0+)The text was updated successfully, but these errors were encountered: