Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4863

Do not use RetryableWriteError for non-server errors

    • 3
    • Not Needed
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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

            Assignee:
            alena.khineika@mongodb.com Alena Khineika
            Reporter:
            daria.pardue@mongodb.com Daria Pardue
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: