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-3711): retry txn end on retryable write #3045

Merged
merged 1 commit into from Dec 1, 2021
Merged

fix(NODE-3711): retry txn end on retryable write #3045

merged 1 commit into from Dec 1, 2021

Conversation

durran
Copy link
Member

@durran durran commented Nov 18, 2021

Description

The driver was retrying commitTransaction and abortTransaction but previously failing 4 spec tests that were tricking the driver to base retries on these commands on error code. The retryable writes spec defines the specific errors that are retryable, and the transactions spec states these 2 commands must adhere to that specification. The fact that an operation is retryable is stated as:

When connected to a MongoDB instance that supports retryable writes (versions 3.6+), the driver MUST treat all errors with the RetryableWriteError label as retryable.

Note that the ticket was scoped to these two commands only, so the full gambit of retryable writes was not touched. There is a ticket to address that in NODE-3769.

What is changing?

This adds a new check for for if a transaction command can be retried, isRetryableEndTransactionError, which bases this solely on if the error contains a "RetryableWriteError" and does not look at the error code.

Is there new documentation needed for these changes?

No

What is the motivation for this change?

NODE-3711

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

@durran durran added the wip label Nov 18, 2021
@durran durran force-pushed the NODE-3711 branch 4 times, most recently from 0620ec0 to c149413 Compare November 18, 2021 14:03
@durran durran changed the title test(NODE-3711): unskip transaction retry spec tests test(NODE-3711): respect retryable write error on txn errors Nov 18, 2021
@durran durran removed the wip label Nov 18, 2021
@durran durran marked this pull request as ready for review November 18, 2021 15:05
@durran durran changed the title test(NODE-3711): respect retryable write error on txn errors test(NODE-3711): retry txn end on retryable write Nov 18, 2021
@durran durran changed the title test(NODE-3711): retry txn end on retryable write fix(NODE-3711): retry txn end on retryable write Nov 18, 2021
@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Dec 1, 2021
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Just have a question to clarify the intent of the implementation, otherwise LGTM

src/error.ts Show resolved Hide resolved
@dariakp dariakp added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Dec 1, 2021
@dariakp dariakp merged commit 7b00d0f into main Dec 1, 2021
@dariakp dariakp deleted the NODE-3711 branch December 1, 2021 19:22
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
3 participants