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
WIP: Add support to fallback to all results of getaddrinfo() (ipv6/ ipv4 dual-stack, DNS-RR) #6374
base: 4.0
Are you sure you want to change the base?
Conversation
Thanks @chr4, I'll evaluate this change with Redis 6 as target, with the possibility to back port to Redis 5. Right now I don't have the full picture to really evaluate if it's ok to merge this: in the past the code have assumed that instances could be identified by their IP address, especially in Sentinel (for Redis Cluster things are simpler because of the Node ID), so I need to check if every safety assumption remains the same after merging this change. |
Thanks! There's an issue addressing another one of the identification-by-IP-address cases in redis-server I'm currently working on. I've added "WIP" to the PR title to reflect this. Will push more changes next week after some testing. |
This will most likely block non-blocking, but allows retrying connections in addrinfo->ai_next.
…try without addr bind
Pushed some more changes. We're running this in our staging environment, so far without any issues (with one caveat: The hostnames in the Redis config shouldn't point to localhost (e.g. in As I changed some buffers to use hostnames instead of ip adresses, I'm not quite sure about the buffer length. Naturally Also, there's the potential of exchanging a lot of code to use hostnames instead of IPs (e.g. in the |
@hwware It overlaps with the hostname support, but #8282 probably doesn't really address dual stack scenarios where we need to maintain and use different addresses. I am not sure this is such a common problem, and addressing it is going to be pretty complex as Sentinel already makes too many assumptions about addresses uniquely identifying instances. |
|
This pull request introduces support to store hostnames in the
sentinelAddr
struct instead of resolved IP adresses.This fixes the issue of:
AAAA
record is set, but the connection can only be established via ipv4 (or vice-versa)), or other networking problems.It seems to me that after
getaddrinfo()
the correct behaviour should be to iterate over alladdrinfo
structs usingai_next
until a connection succeeds. This behaviour is mostly already implemented, but overridden by some (apparently conciously chosen) decisions.The comments mention performance reasons and an reduced amount of DNS lookups, so this might introduce some overhead. At least in our setup, an additional DNS request upon a (re)-connect seems to be less of an issue than problems with the dual-stack setup.
This fixes (or at least should fix):
Test are green, but this wasn't extensively tested in production yet.
Opinions welcome!
NOTE: This PR is against the
4.0
branch, as this is the currently shipped version with Ubuntu 18.04 LTS, but can be easily rebased upon request onunstable
or5.0
.NOTE: This patch includes some changes to
hiredis
. I've included them here for now, but it might be wise to add an additional pull request to https://github.com/redis/hiredis if this turns out to be a good idea.