Skip to content
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

fix(NODE-4649): use SDAM handling for errors from min pool size population #3424

Merged
merged 10 commits into from Sep 28, 2022

Conversation

dariakp
Copy link
Contributor

@dariakp dariakp commented Sep 27, 2022

Description

NODE-4649/NODE-3135

What is changing?

CMAP

  • connection pool now saves a reference to the server that it is attached to
  • new serverError property on the pool allows access to the server description error for the purpose of generating a more descriptive pool cleared error
  • per the spec, connection establishment should emit a connection closed event on error, this is now implemented
  • min pool size errors are now handled via SDAM error handling (using the new handleError server class method)

SDAM

  • makeOperationDescription was refactored to pull out SDAM-specific error handling logic (corresponding to handleError in the spec) into a class method on the server
  • the new server class method handleError is as spec compliant as it can be while still handling the load balancer logic alongside the non-loadbalanced logic
    • TODO (added to next subtask): we should update the staleness check to read connection generation from the error instead of the connection, since we want it to be able to handle errors that occur while establishing a connection, too; this requires injecting the connection generation into the error in the createConnection method (or elsewhere down the chain); the staleness check should be added to the handleError logic

CMAP Tests

  • The runner now requires a server to be passed in; due to the reuse of the client in the failpoint establishment, we have to juggle the original "real" server pool established by the client with the one we generate for testing, hence the new #originalServerPool property
  • The 'error during minPoolSize population clears pool' test is unskipped since the functionality is now implemented
Is there new documentation needed for these changes?

No

What is the motivation for this change?

Spec compliance

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@dariakp dariakp marked this pull request as ready for review September 28, 2022 14:32
nbbeeken
nbbeeken previously approved these changes Sep 28, 2022
src/cmap/connection_pool.ts Outdated Show resolved Hide resolved
@nbbeeken nbbeeken added the Team Review Needs review from team label Sep 28, 2022
@nbbeeken nbbeeken merged commit ef3b55d into main Sep 28, 2022
@nbbeeken nbbeeken deleted the NODE-4649/make-cmap-sdam-aware branch September 28, 2022 16:27
ZLY201 pushed a commit to ZLY201/node-mongodb-native that referenced this pull request Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
2 participants