-
Notifications
You must be signed in to change notification settings - Fork 16
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
Added a check for DNS updates #27
Conversation
7dc4b5e
to
e9b99cf
Compare
please rebase over https://github.com/nihohit/redis-rs/pull/29 instead of the bad lint fix. |
If this change is only for the cluster's sake, let's save the IP in the cluster instead of adding it to each connection. |
@nihohit Ready for another review |
did you benchmark this and verify there's no perf degradation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FSM, all comments are optional.
Please benchmark before merging, to verify there's no perf harm. Is it possible to test this with Polyglot before merging, to see if it changes the behavior there?
e887e98
to
585a8bd
Compare
@nihohit ready for a review with the new connections container |
Before reusing an old connection, check if its node has encountered a DNS change, where the node's endpoint now leads to a different IP address.
Implementation detailes:
connect_simple now returns both the connection and an optional String with the connection IP (only valid for TCP connections, for Unix returns None).
The cluster client now holds a ConnectionMap from the node's name to ClusterNode entries that holds both the connection and the IP. When we check if existing connection is valid in the get_or_create_conn function, we now also check if the node's address still points to the same IP.