-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-332 Return an error for replica set name mismatch #648
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
Conversation
src/sdam/state/mod.rs
Outdated
) | ||
)?; | ||
let opts = &self.common.options; | ||
if let (Some(true), Some(set_name), Some(sel_server)) = |
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.
This would be way easier to write and read if https://rust-lang.github.io/rfcs/2497-if-let-chains.html was implemented :(
options.hosts.drain(1..); | ||
options.direct_connection = Some(true); | ||
options.repl_set_name = Some("invalid".to_string()); | ||
let client = Client::with_options(options)?; |
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.
This needs to be a Client
rather than a TestClient
because the latter executes a few operations with unwrap()
s, which fail and crash before the test can check anything.
I'm sorry we didn't discover this sooner, but I just went to look at the relevant section in the SDAM spec and noticed the language referenced in the ticket has now changed to:
It looks like shortly after RUST-332 was filed, DRIVERS-980 got filed which resulted in the language being changed. The relevant Rust ticket spun out from that is RUST-358. So I think we'll want to adopt the newer behavior here instead. As an aside, this is probably going to cause merge conflicts with #628 so we should keep that in mind for whichever of these PRs gets merged in later |
Whoops, missed that. Shouldn't be too hard to update to follow that. |
8c11f49
to
39463c1
Compare
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.
LGTM!
RUST-332 / RUST-358
This causes servers that don't match the repl set name given in the connection string to be marked as unknown, so any operation will return an error.