-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: Retryability
The retryable writes spec has the following to say on the subject of RetryableWriteError labels:
Why does the driver only add the RetryableWriteError label to errors that occur on a MongoClient with retryWrites set to true?
------------------------------------------------------------------------------------------------------------------------------
The driver does this to maintain consistency with the MongoDB server.
Servers that support the RetryableWriteError label (MongoDB version 4.4 and newer)
only add the label to an error when the client has added a txnNumber to the
command, which only happens when the retryWrites option is true on the client.
For the driver to add the label even if retryWrites is not true would be
inconsistent with the server and potentially confusing to developers.
Currently, we attach this label to non-server errors, which is likely against the spec's intent. We should update our retryability implementation to use a different label for retryable non-server errors (such as the PoolClearedError) in order to comply with the spirit of the spec.
Acceptance Criteria
- The PoolClearedError constructor should add the new MongoErrorLabel.PoolRequstedRetry label instead of misused MongoErrorLabel.RetryableWriteError.
- isRetryableWriteError should check for one of those errors to determine if retryOperation is required
Testing Requirements
- All existed tests should pass
- The '2. Test that drivers properly retry after encountering PoolClearedErrors.' test should rely on PoolRequstedRetry instead of RetryableWriteError
- Add the 'Test that drivers return the original error after encountering an error with a PoolRequstedRetry label' test
Documentation Requirements
Follow Up Requirements
None
Coordination expectations
None
Dependencies
None