HELP-68823 Fix invalid_me comparison and normalize host strings#1319
Merged
abr-egn merged 1 commit intomongodb:mainfrom Mar 5, 2025
Merged
HELP-68823 Fix invalid_me comparison and normalize host strings#1319abr-egn merged 1 commit intomongodb:mainfrom
abr-egn merged 1 commit intomongodb:mainfrom
Conversation
isabelatkinson
approved these changes
Mar 5, 2025
Contributor
isabelatkinson
left a comment
There was a problem hiding this comment.
LGTM! This seems like a good fix for now.
In particular, we have some public APIs (e.g. ToplogyDescription::servers) that hand out &ServerDescription values
Would this make sense to revisit in 4.0? i.e. return owned ServerDescriptions in the public API and convert from the internal type in those methods
Contributor
Author
Yeah, especially for places where the overhead of a copy isn't likely to be significant like events I think we should do a pass and bias towards returning owned values. Filed RUST-2170 to track. |
abr-egn
added a commit
to abr-egn/mongo-rust-driver
that referenced
this pull request
Mar 5, 2025
abr-egn
added a commit
that referenced
this pull request
Mar 5, 2025
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.
HELP-68823
This wasn't the fix that I was intending to put into mainline, but that turns out to have a lot more in the way of wrinkles than I expected. In particular, we have some public APIs (e.g.
ToplogyDescription::servers) that hand out&ServerDescriptionvalues, which locks us into having the underlying data structure storing that type either as the primary (how it's currently done) or as some kind of internally-mutable cache (ew).There may be some clever path forward for split types that maintains API compatibility that I didn't see, but for the moment I think it's best to get the simple fix in and unblock downstream users. This PR, while minimal, fixes the core issue and explicitly normalizes anything that parses as an IP address, so it should be reasonably robust, and I've gone through and audited all the other uses of
ServerAddress'sDisplayimpl and they're all test code or error messages so I think the chance of another recurrence of this problem is low.