-
Notifications
You must be signed in to change notification settings - Fork 178
RUST-2125 Run tests using LB URI when present #1279
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
Changes from all commits
b98aa5b
387474e
1e8fdd0
dcd3b52
ce47a6b
34eff7f
7fac791
4eab7be
4720b56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ impl<'a, R> BulkWrite<'a, R> | |
where | ||
R: BulkWriteResult, | ||
{ | ||
pub(crate) async fn new( | ||
pub(crate) fn new( | ||
client: Client, | ||
models: &'a [WriteModel], | ||
offset: usize, | ||
|
@@ -260,7 +260,7 @@ where | |
fn handle_response_async<'b>( | ||
&'b self, | ||
response: RawCommandResponse, | ||
context: ExecutionContext<'b>, | ||
mut context: ExecutionContext<'b>, | ||
) -> BoxFuture<'b, Result<Self::O>> { | ||
async move { | ||
let response: WriteResponseBody<Response> = response.body()?; | ||
|
@@ -292,9 +292,12 @@ where | |
None, | ||
self.options.and_then(|options| options.comment.clone()), | ||
); | ||
let pinned_connection = self | ||
.client | ||
.pin_connection_for_cursor(&specification, context.connection)?; | ||
|
||
let pinned_connection = self.client.pin_connection_for_cursor( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a distinct bug from RUST-2131, where the original code should have been conditionally using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch! combining the pinning methods makes sense |
||
&specification, | ||
context.connection, | ||
context.session.as_deref_mut(), | ||
)?; | ||
let iteration_result = match context.session { | ||
Some(session) => { | ||
let mut session_cursor = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ impl TestOperation for AssertSessionPinned { | |
async move { | ||
let is_pinned = | ||
with_mut_session!(test_runner, self.session.as_str(), |session| async { | ||
session.transaction.pinned_mongos().is_some() | ||
session.transaction.is_pinned() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also a distinct bug, just missing that there are now more cases than |
||
}) | ||
.await; | ||
assert!(is_pinned); | ||
|
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.
Using
try_recv
rather thanrecv
means the re-entrant case becomes an error rather than a deadlock, which seems much better behavior to me. The hypothetical downside is that it could fail in a race condition, but since any individual pinned connection is used in a strictly linear sequence that doesn't apply here.