-
Notifications
You must be signed in to change notification settings - Fork 244
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
DRIVERS-1641: pre-4.4 mongos writeConcernError does not determine retryability #1486
Conversation
…retryability Synced with mongodb/specifications#1486
2231e2a
to
962d8af
Compare
…retryability Synced with mongodb/specifications#1486
Reverting to draft until I can address DRIVERS-2802. |
…retryability Synced with mongodb/specifications#1486
…retryability Synced with mongodb/specifications#1486
87f2617
to
b5acc2b
Compare
failPoint: | ||
configureFailPoint: failCommand | ||
# Trigger the fail point twice to allow asserting the error label in | ||
# the retry attempt's response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initially tripped me up while implementing the libmongoc POC and diagnosing some CI failures. When we assert that the RetryableWriteError label is added, those tests will implicitly have a retry attempt, so we need to fail the second attempt to ensure the label is present for our assertion.
This differs from the mongos test asserting that the label is not added. There, the driver makes no retry attempt so we need only fail once and inspect the insertOne
result for an error w/o the label.
…ryability Also clarify that pre-4.4 writeErrors[].code should never be used to determine retryability. This is intentionally untested because failCommand does not provide a way to mock writeErrors.
databaseName: *databaseName | ||
documents: | ||
- { _id: 1, x: 11 } | ||
- { _id: 2, x: 22 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In contrast to the mocked writeConcernError tests below, failing insert
with an errorCode
does prevent the write from being applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
https://jira.mongodb.org/browse/DRIVERS-1641
Also clarify that pre-4.4 writeErrors[].code should never be used to determine retryability. This is intentionally untested because failCommand does not provide a way to mock writeErrors.
POC: mongodb/mongo-c-driver#1501
Patch build: https://spruce.mongodb.com/version/65a19aa461837db75d4d8efe/tasks (4.2-replica-auth and 4.2-sharded-auth are the relevant tasks).
Please complete the following before merging: