Skip to content

Conversation

prestonvasquez
Copy link
Member

GODRIVER-3032

Summary

For a pre-4.4 mongos response, we can trust that mongos will have already retried the operation if necessary. Drivers should not retry to avoid "excessive retrying".

Under similar circumstances, the specifications now clarify that drivers should not consider codes within writeErrors from a mongod or mongos response. Notably, the Go Driver does not currently do this.

Background & Motivation

From the comments on the related drivers ticket:

Pre and post 4.4 mongos will retry on retryable codes within the writeConcernError field (it chooses to retry based on the "effective status" from a command response - 4.2 code and current master - which will check the write concern status - 4.2 and master). So in both cases drivers should not retry because mongos would only return a retryable write concern error if it exhausts its retry attempts. The only difference pre and post 4.4 with regard to write concern errors is that mongos will not retry on WriteConcernFailed in post 4.4 (as called out by the retryable error label proposal), but I don't think that affects drivers behavior because according to their retryable writes spec, that code isn't considered retryable.

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the review-priority-low Low Priority PR for Review: within 3 business days label Jan 3, 2025
@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

./v2/x/mongo/driver

incompatible changes

##WriteCommandError.Retryable: changed from func(*./v2/x/mongo/driver/description.VersionRange) bool to func(./v2/x/mongo/driver/description.ServerKind, *./v2/x/mongo/driver/description.VersionRange) bool
##WriteConcernError.Retryable: changed from func() bool to func(./v2/x/mongo/driver/description.ServerKind, *./v2/x/mongo/driver/description.VersionRange) bool
WriteConcernError: no longer implements RetryablePoolError

@prestonvasquez prestonvasquez marked this pull request as ready for review January 3, 2025 23:17
@prestonvasquez prestonvasquez requested review from qingyang-hu and removed request for matthewdale January 14, 2025 16:09
Copy link
Collaborator

@qingyang-hu qingyang-hu left a comment

Choose a reason for hiding this comment

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

👍 LGTM!

@prestonvasquez prestonvasquez merged commit 91e55bd into mongodb:master Jan 15, 2025
30 of 35 checks passed
@prestonvasquez prestonvasquez deleted the GODRIVER-3032 branch January 15, 2025 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-priority-low Low Priority PR for Review: within 3 business days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants