Skip to content
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

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

barshaul
Copy link

@barshaul barshaul commented Aug 24, 2023

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.

@barshaul barshaul force-pushed the dns_check branch 3 times, most recently from 7dc4b5e to e9b99cf Compare August 28, 2023 08:54
@barshaul barshaul requested a review from nihohit August 28, 2023 08:54
@barshaul barshaul marked this pull request as ready for review August 28, 2023 08:55
@nihohit
Copy link

nihohit commented Aug 28, 2023

please rebase over https://github.com/nihohit/redis-rs/pull/29 instead of the bad lint fix.

@nihohit
Copy link

nihohit commented Aug 30, 2023

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.
Adding get_ip to the ConnectionLike trait makes this a breaking change.

@barshaul
Copy link
Author

@nihohit Ready for another review

@nihohit
Copy link

nihohit commented Sep 12, 2023

did you benchmark this and verify there's no perf degradation?

Copy link

@nihohit nihohit left a 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?

@barshaul barshaul force-pushed the dns_check branch 2 times, most recently from e887e98 to 585a8bd Compare September 13, 2023 16:42
@barshaul
Copy link
Author

@nihohit ready for a review with the new connections container

@nihohit nihohit merged commit 371e52c into amazon-contributing:main Sep 14, 2023
@barshaul barshaul deleted the dns_check branch September 14, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants