fix(NODE-7411): iterate all servers on close#4967
Draft
johnmtll wants to merge 7 commits into
Draft
Conversation
The method had a premature 'return' inside the for loop, which caused it to only close connections on the first server and exit immediately. This fix removes the return statement so all servers have their checked-out connections closed when MongoClient.close() is called. This bug would affect multi-server topologies (replica sets, sharded clusters) where only the first server's connections would be properly closed.
…deployments - Remove 'single' topology restriction from metadata to support replicaset/sharded - Use readPreference: 'secondaryPreferred' to exercise connections to secondaries - Switch from insert to find operations to validate reads against secondaries
39e064b to
1b7b0c5
Compare
7c08cc1 to
7c109ec
Compare
This file contains hidden or 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
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.
Description
Summary of Changes
Supplants:
Additional Coverage:
Adds additional coverage for resource clearing to the mongo client tests, ensuring that cursors and sessions are properly wiped after closure, regardless of connection state. Also closes a missing test gap which ensures duplicate/misordered calls of connect()/close() dont cause fatal behaviour (increasing coverage slightly).
Adjusts client closure SDAM tests to ensure event ordering is maintained when a closure spans 2 connection pools.
Notes for Reviewers
Connpool tests validate SDAM requirements at the connpool level, whereas the clientclose tests ensure that those requirements persist when a coordinator attempts to close all connections across mutliple connpools. The domain of this 'coordination testing' is explicitly owned by the client close tests and the extension of the duplicate behaviour in connection_pool.test.ts is where domain-affinity to the mongo client is solidified.
What is the motivation for this change?
Release Highlight
Release notes highlight
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript