fix(NODE-3711): retry txn end on retryable write #3045
Merged
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
The driver was retrying
commitTransaction
andabortTransaction
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
npm run check:lint
script<type>(NODE-xxxx)<!>: <description>