-
Notifications
You must be signed in to change notification settings - Fork 244
DRIVERS-2501 Break NoWritesPerformed-Only Error Sequence #1349
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
783415f
DRIVERS-2501 Break NoWritesPerformed-Only Error Sequence
prestonvasquez 2f260e8
GODRIVER-2501 update changelog
prestonvasquez f93e21f
GODRIVER-2501 make all-NWP an if/then statement
prestonvasquez bd9045e
DRIVERS-2501 give spec test unique collection name
prestonvasquez b6748ea
DRIVERS-2501 update MWV to 6.0
prestonvasquez 0ee3980
DRIVERS-2501 rename originalError currentError
prestonvasquez d84eef8
DRIVER-2501 no-retryableWritesSupport should return previous error
prestonvasquez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
source/retryable-writes/tests/unified/insertOne-noWritesPerformedError.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"description": "retryable-writes insertOne noWritesPerformedErrors", | ||
"schemaVersion": "1.0", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "6.0", | ||
"topologies": [ | ||
"replicaset" | ||
] | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"useMultipleMongoses": false, | ||
"observeEvents": [ | ||
"commandFailedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "retryable-writes-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "no-writes-performed-collection" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "InsertOne fails after NoWritesPerformed error", | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 2 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"insert" | ||
], | ||
"errorCode": 64, | ||
"errorLabels": [ | ||
"NoWritesPerformed", | ||
"RetryableWriteError" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection0", | ||
"arguments": { | ||
"document": { | ||
"x": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"errorCode": 64, | ||
"errorLabelsContain": [ | ||
"NoWritesPerformed", | ||
"RetryableWriteError" | ||
] | ||
} | ||
} | ||
], | ||
"outcome": [ | ||
{ | ||
"collectionName": "no-writes-performed-collection", | ||
"databaseName": "retryable-writes-tests", | ||
"documents": [] | ||
} | ||
] | ||
} | ||
] | ||
} |
54 changes: 54 additions & 0 deletions
54
source/retryable-writes/tests/unified/insertOne-noWritesPerformedError.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
description: "retryable-writes insertOne noWritesPerformedErrors" | ||
|
||
schemaVersion: "1.0" | ||
|
||
runOnRequirements: | ||
- minServerVersion: "6.0" | ||
topologies: [ replicaset ] | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
useMultipleMongoses: false | ||
observeEvents: [ commandFailedEvent ] | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &databaseName retryable-writes-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collectionName no-writes-performed-collection | ||
|
||
tests: | ||
- description: "InsertOne fails after NoWritesPerformed error" | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: | ||
times: 2 | ||
data: | ||
failCommands: | ||
- insert | ||
errorCode: 64 | ||
errorLabels: | ||
- NoWritesPerformed | ||
- RetryableWriteError | ||
- name: insertOne | ||
object: *collection0 | ||
arguments: | ||
document: | ||
x: 1 | ||
expectError: | ||
errorCode: 64 | ||
errorLabelsContain: | ||
- NoWritesPerformed | ||
- RetryableWriteError | ||
outcome: | ||
- collectionName: *collectionName | ||
databaseName: *databaseName | ||
documents: [] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is
previousError
in the code below intended to be the first error encountered? If not, andpreviousError
could be updated multiple times, the behavior below seems to conflict with this statement as the first error is never permanently saved.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.
Assuming that an error occurs, the idea is to always set "previousError" with the first error encountered, without condition. Otherwise, if the error is NOT labeled "NoWritesPerformed", then update the "previousError" to the "originalError":
This behavior will "save" the first error only on the condition that the sequence of errors encountered are all labeled "NoWritesPerformed". Otherwise, a sequence of errors all labeled "NoWritesPerformed" will result in a "null" error.