-
Notifications
You must be signed in to change notification settings - Fork 244
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
DRIVERS-1785: clarify ordering of CMAP events when pool is cleared #1690
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
baileympearson
force-pushed
the
spec-fest-1
branch
from
October 29, 2024 16:36
050054d
to
54651e3
Compare
baileympearson
changed the title
DRIVERS-1785: add test to ensure pool is cleared before connection check-in
DRIVERS-1785: clarify ordering of CMAP events when pool is cleared
Oct 29, 2024
baileympearson
requested review from
W-A-James,
stIncMale,
matthewdale and
dariakp
and removed request for
a team
October 29, 2024 18:27
Merged
5 tasks
dariakp
reviewed
Oct 29, 2024
source/server-discovery-and-monitoring/server-discovery-and-monitoring.md
Outdated
Show resolved
Hide resolved
W-A-James
requested changes
Oct 29, 2024
source/server-discovery-and-monitoring/tests/unified/pool-clear-checkout-error.yml
Outdated
Show resolved
Hide resolved
matthewdale
approved these changes
Oct 30, 2024
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.
Looks good! 👍
dariakp
approved these changes
Oct 31, 2024
stIncMale
requested changes
Nov 1, 2024
source/server-discovery-and-monitoring/tests/unified/pool-clear-checkout-error.json
Outdated
Show resolved
Hide resolved
source/server-discovery-and-monitoring/tests/unified/pool-clear-min-pool-size-error.json
Outdated
Show resolved
Hide resolved
W-A-James
approved these changes
Nov 8, 2024
stIncMale
approved these changes
Nov 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Node POC: mongodb/node-mongodb-native#4296
This PR adds tests ensuring that drivers always clear the pool before checking a connection back in / emitting close events, regardless of if the pool cleared error occurs on establishment during minPoolSize population, connection checkout or during operation execution on a checked out connection.
This PR originally intended to just add a test that demonstrated that, when we encounter a pool clear error on an application connection, we clear the pool before checking the connection back into the pool. This avoids a small race condition between SDAM and connection checkout for subsequent requests in the pool - the subsequent requests might check out the errored connection before the pool is cleared.
As I was looking into this, I did realize we do have this coverage already. But as Matt pointed out on the drivers ticket, the ordering of events seemed to be specified differently in one CMAP minPoolSize test than in other CMAP and SDAM tests. The race condition isn't present for minPoolSize population, but Matt pointed out that if we expect a different ordering of events for minPoolSize population and connection checkout, we can't share connection establishment logic in both code paths. So I also updated the ordering of events for the incorrect CMAP test (pool clear must happen before connectionClosed events).
I also realized some tests only tested that handshakes clear the pool, while others test that authentication clears the pool. I added tests for both errors during the handshake and auth during minPoolSize population and connection checkout, and assert on the expected ordering of events.
Please complete the following before merging:
clusters, and serverless).