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-5720): on pre-4.4 sharded servers, the node driver uses error.writeConcern.code to determine retryability #4155

Merged
merged 24 commits into from
Jul 30, 2024

Conversation

aditi-khare-mongoDB
Copy link
Contributor

@aditi-khare-mongoDB aditi-khare-mongoDB commented Jun 17, 2024

Description

On pre-4.4 Mongosservers, no longer add a RetryableWriteLabel to WriteConcernError due to its code property.

What is changing?

Sync some retryable write spec tests and adhere to spec guidelines.

Is there new documentation needed for these changes?

No.

What is the motivation for this change?

Spec compliance.

Release Highlight

Fix retryability criteria for write concern errors on pre-4.4 sharded clusters

Previously, the driver would erroneously retry writes on pre-4.4 sharded clusters based on a nested code in the server response (error.result.writeConcernError.code). Per the common drivers specification, retryability should be based on the top-level code (error.code). With this fix, the driver avoids unnecessary retries.

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
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review June 17, 2024 21:20
@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as draft June 18, 2024 14:44
@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-5720/clarify-retryable-fields branch 2 times, most recently from fb7495d to dcef868 Compare June 20, 2024 19:06
@baileympearson baileympearson self-requested a review June 28, 2024 20:02
@baileympearson baileympearson self-assigned this Jun 28, 2024
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jun 28, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review July 1, 2024 14:03
src/error.ts Show resolved Hide resolved
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title test(NODE-5720): sync retryable write spec tests feat(NODE-5720): Clarify which tests are retryable on <4.4 Mongos and Mongod servers Jul 9, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title feat(NODE-5720): Clarify which tests are retryable on <4.4 Mongos and Mongod servers fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to determine retryability Jul 9, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to determine retryability fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to add RetryableWriteLabel Jul 9, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to add RetryableWriteLabel fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to determine retryability Jul 9, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-5720/clarify-retryable-fields branch from 25a4196 to 231fb80 Compare July 9, 2024 19:10
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title fix(NODE-5720): on pre-4.4 Mongos servers, the node driver uses WriteConcernError.code to determine retryability fix(NODE-5720): on pre-4.4 sharded servers, the node driver uses WriteConcernError.code to determine retryability Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants