name_resolution: include structural attributes in Address PartialEq#2631
Open
nathanielford wants to merge 8 commits intohyperium:masterfrom
Open
name_resolution: include structural attributes in Address PartialEq#2631nathanielford wants to merge 8 commits intohyperium:masterfrom
nathanielford wants to merge 8 commits intohyperium:masterfrom
Conversation
dfawley
reviewed
May 6, 2026
Collaborator
dfawley
left a comment
There was a problem hiding this comment.
I don't recall if there is a reason it was like this before, but this SGTM.
Can we not derive(PartialEq,Eq)? (If not why not?)
Collaborator
Author
|
No reason not to use derive! I just didn't think of it right off since I was in the weeds. Have fixed that. Also included a perhaps not needed unit test in order to at least capture the thinking. If we feel it's not worth the bytes, though, I can pull it. |
dfawley
reviewed
May 7, 2026
…nually written hash impl
…into refactor/AddressHashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is for the grpc-Rust official library, and not for tonic.
Motivation
In the process of writing the Pick First LB policy, I realized that there were edge cases characterized by the following:
The reason for this is that the addresses cannot be included in the hashing, because they are type-erased. I think all load balancers are likely to run into this issue.
Solution
Updating PartialEq in order to validate that the address attributes are equal in addition to the network type and address field. This means new Addresses with different attributes should be hashed into the same bucket but that looking an address with attribute set A will not fetch an address with attribute set B.
There may be a better way to handle this, or a reason it hasn't been done already - I'd be grateful for any feedback that anyone can provide on this front.