Skip to content

RUST-981 Merge new load balancer spec tests #480

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

Merged
merged 24 commits into from
Oct 18, 2021

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Oct 6, 2021

RUST-981

This integrates the new load balancer spec tests, and fixes various bugs (largely around load balanced connection lifecycle) that they exposed.

This also fixes RUST-1037 and RUST-1042.

@@ -442,12 +437,8 @@ impl PinnedConnectionHandle {
})
}

/// Return the pinned connection to the normal connection pool.
pub(crate) async fn unpin_connection(&self) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously called by cursors on completion, but with the connection potentially shared by a cursor and transaction the unpin now happens (implicitly) when the final PinnedConnectionHandle for a given Connection is dropped via the final Arc causing the channel endpoint to drop.

@@ -155,7 +155,7 @@ impl<'de> Deserialize<'de> for ReadPreference {
"PrimaryPreferred" => Ok(ReadPreference::PrimaryPreferred {
options: preference.options,
}),
"SecondaryPreferred" => Ok(ReadPreference::SecondaryPreferred {
"SecondaryPreferred" | "secondaryPreferred" => Ok(ReadPreference::SecondaryPreferred {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the spec tests uses "secondaryPreferred" as a value; not sure whether this was meant to be case sensitive or not.

@@ -245,6 +255,8 @@ pub async fn run_unified_format_test(test_file: TestFile) {
}
}

test_runner.fail_point_guards.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This had to go after the event expectation evaluation because clearing the guards can now generate events in itself, which the tests don't take into account.

@@ -1817,6 +1817,7 @@ impl TestOperation for AssertNumberConnectionsCheckedOut {
) -> BoxFuture<'a, ()> {
async move {
let client = test_runner.get_client(&self.client);
client.sync_workers().await;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connections_checked_out() relies on the worker queue having been processed to be accurate.

@abr-egn abr-egn marked this pull request as ready for review October 6, 2021 20:16
@abr-egn
Copy link
Contributor Author

abr-egn commented Oct 7, 2021

The change in the previous PR to revert to skipping the wait queue clear for load-balanced topologies is causing another test failure here - it expects a pool cleared event that doesn't happen. Since this is a test specific to load balancers I'm inclined to go back to clearing the wait queue unconditionally and update that in the future if needed once the spec question gets ironed out.

@@ -1482,6 +1482,7 @@ impl TestOperation for AssertSameLsidOnLastTwoCommands {
) -> BoxFuture<'a, ()> {
async move {
let client = test_runner.entities.get(&self.client).unwrap().as_client();
client.sync_workers().await;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reduced but did not entirely remove flakiness of the test depending on this; as far as I can tell there are two ways this could fail: events not yet received (fixed here) or session non-reuse equivalent to the connection non-reuse elsewhere (not fixed). I've filed RUST-1056 to address the latter.

@abr-egn abr-egn force-pushed the RUST-981/lb-new-tests branch from bd51976 to c2505c0 Compare October 14, 2021 19:39
Copy link
Contributor

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@abr-egn abr-egn merged commit 8768f63 into mongodb:master Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants