Skip to content
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

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jan 2, 2024

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:

  • Update changelog.
  • Make sure there are generated JSON files from the YAML test files.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, sharded clusters, and serverless).

@jmikola jmikola requested a review from a team as a code owner January 2, 2024 16:25
@jmikola jmikola requested review from kkloberdanz and removed request for a team January 2, 2024 16:25
jmikola added a commit to jmikola/mongo-c-driver that referenced this pull request Jan 2, 2024
@jmikola jmikola force-pushed the drivers-1641 branch 2 times, most recently from 2231e2a to 962d8af Compare January 2, 2024 18:22
jmikola added a commit to jmikola/mongo-c-driver that referenced this pull request Jan 2, 2024
@jmikola jmikola marked this pull request as draft January 2, 2024 21:02
@jmikola
Copy link
Member Author

jmikola commented Jan 2, 2024

Reverting to draft until I can address DRIVERS-2802.

jmikola added a commit to jmikola/mongo-c-driver that referenced this pull request Jan 12, 2024
jmikola added a commit to jmikola/mongo-c-driver that referenced this pull request Jan 12, 2024
@jmikola jmikola force-pushed the drivers-1641 branch 2 times, most recently from 87f2617 to b5acc2b Compare January 12, 2024 20:01
jmikola added a commit to jmikola/mongo-c-driver that referenced this pull request Jan 12, 2024
@jmikola jmikola marked this pull request as ready for review January 12, 2024 21:07
failPoint:
configureFailPoint: failCommand
# Trigger the fail point twice to allow asserting the error label in
# the retry attempt's response.
Copy link
Member Author

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 }
Copy link
Member Author

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.

Copy link
Contributor

@kkloberdanz kkloberdanz left a comment

Choose a reason for hiding this comment

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

Looks good!

@jmikola jmikola merged commit 3e60a7c into mongodb:master Jan 16, 2024
4 checks passed
@jmikola jmikola deleted the drivers-1641 branch January 16, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants