-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-980 Run load balancer tests on evergreen, and update existing tests #477
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
@@ -313,6 +313,7 @@ impl Connection { | |||
let (tx, rx) = mpsc::channel(1); | |||
self.pinned_sender = Some(tx); | |||
Ok(PinnedConnectionHandle { | |||
id: self.id, |
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 isn't needed for functionality, but it's very handy for debugging.
@@ -78,6 +78,10 @@ async fn concurrent_connections() { | |||
let _guard = LOCK.run_exclusively().await; | |||
|
|||
let mut options = CLIENT_OPTIONS.clone(); | |||
if options.load_balanced.unwrap_or(false) { |
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.
direct_connection
is explicitly incompatible with load_balanced
.
@@ -513,13 +513,11 @@ impl ConnectionPoolWorker { | |||
handler.handle_pool_cleared_event(event); | |||
}); | |||
|
|||
if !self.generation.is_load_balanced() { |
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 swear that some part of the spec said that the queue shouldn't be drained in load-balancing mode, but I was apparently hallucinating that.
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.
Did this draining behavior cause tests to fail? Intuitively, it makes sense to not drain in LB mode, since these requests will probably go to a working service rather than the one that caused a clear.
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.
Yep - https://github.com/mongodb/mongo-rust-driver/blob/master/src/test/spec/retryable_reads.rs#L74 failed (the second checkout succeeds rather than fails), and the load balancer spec specifically calls out retryable reads tests.
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.
Ah okay, so that test is specifically verifying the pool paused behavior, which shouldn't apply to load balancers. The spec doesn't currently clarify this so I filed DRIVERS-1942 to update it. In the meantime, I think we can preserve the existing behavior of not clearing the WaitQueue on pool clear if in load balanced mode and just skip that individual test.
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.
Updated - needed to skip the equivalent test for retryable writes as well.
} | ||
|
||
pub fn is_sharded(&self) -> bool { | ||
self.server_info.msg.as_deref() == Some("isdbgrid") |
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 returns true
for load-balanced toplogies, so to avoid having to manually maintain a bunch of fiddly boolean exclusions I refactored these.
@@ -513,13 +513,11 @@ impl ConnectionPoolWorker { | |||
handler.handle_pool_cleared_event(event); | |||
}); | |||
|
|||
if !self.generation.is_load_balanced() { |
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.
Did this draining behavior cause tests to fail? Intuitively, it makes sense to not drain in LB mode, since these requests will probably go to a working service rather than the one that caused a clear.
@@ -185,13 +190,20 @@ impl Handshaker { | |||
if options.load_balanced { | |||
command.body.insert("loadBalanced", true); | |||
} | |||
|
|||
#[cfg(test)] | |||
{ |
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.
(just out of curiosity) why does this statement need to be in its own scope?
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.
Applying attributes to individual statements turns out not to be available in stable Rust yet.
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! I just have one question but I imagine it won't result in any further changes.
e55cb94
to
afe3a39
Compare
RUST-980
This adds evergreen configuration to run the tests against a load-balancer, updates several existing tests to run on that topology, and fixes several bugs that those tests revealed.
A few unrelated changes got picked up in test syncs: serverless run configuration (which the runner already understood) and language changes.