-
Notifications
You must be signed in to change notification settings - Fork 176
RUST-663 Support $merge and $out executing on secondaries #1360
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
base: main
Are you sure you want to change the base?
Conversation
src/client/executor.rs
Outdated
@@ -651,78 +661,9 @@ impl Client { | |||
let start_time = Instant::now(); | |||
let command_result = match connection.send_message(message).await { | |||
Ok(response) => { | |||
async fn handle_response<T: Operation>( |
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.
I pulled this out and renamed it for readability, but the body is unchanged.
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.
ha, I also did this in #1358 (minus the rename)
@@ -205,7 +205,7 @@ impl TopologyDescription { | |||
&self, | |||
address: &ServerAddress, | |||
command: &mut Command, | |||
criteria: Option<&SelectionCriteria>, | |||
criteria: &SelectionCriteria, |
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.
Another side effect: this method no longer receives an Option
, so it could be slightly simplified.
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!
src/client/executor.rs
Outdated
@@ -651,78 +661,9 @@ impl Client { | |||
let start_time = Instant::now(); | |||
let command_result = match connection.send_message(message).await { | |||
Ok(response) => { | |||
async fn handle_response<T: Operation>( |
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.
ha, I also did this in #1358 (minus the rename)
6c0c335
to
50c75de
Compare
Rebase required a little bit of rewriting, so please do another look over. |
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. we might not be able to merge this til the cargo-deny error is fixed because of the rules I added for RUST-1907
RUST-663
Attempt 1: add a new method on
Operation
that could update the stored selection criteria before server selection given a topology snapshot. Didn't work because server selection might need to wait for handshake to finish and if so the snapshot won't have the version information.Attempt 2: Update
Client::select_server
to take anOperation
rather than a string operation name, but it's called from various contexts that don't have an operation to give which would need to synthesize one, and that seemed worse.Attempt 3 (this PR): Plumb a single callback from the
Operation
intoselect_server
(no-op by default) to override selection criteria in the inner loop of server selection, based on the always-most-recent view of topology.As a side effect, I factored
Command
construction out into its own function so that it was easier to record the final effective selection criteria rather than the staticOperation
-associated criteria; I think this makes the inner portion of command execution a bit easier to read and makes it easier to keep track of what's going on between the various flavors ofexecute_whatever_with_whatever
in there.