-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-3388 Propagate Original Error for Write Errors Labeled NoWritesPerformed #1117
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
23 commits
Select commit
Hold shift + click to select a range
046ef86
initial commit
juliusgeo e042e44
major refactor, I think I have the logic correct this time
juliusgeo 27870fe
remove uneeded stuff
juliusgeo b32d420
Merge remote-tracking branch 'upstream/master' into PYTHON-3388
juliusgeo bf0e8db
fix mypy
juliusgeo 76727df
raising the WriteConcernError messes with spec tests
juliusgeo 2120179
major refactor to ensure we are placing the subsequent failpoint corr…
juliusgeo 1747e38
in the middle of a large refactor, saving progress
juliusgeo f40daec
finish refactor, test passing now
juliusgeo 527c8c3
we need to have NoWritesPerformed label to return original error
juliusgeo 4bcdd21
skip some tests, change to using self.assertSomething, remove todo, f…
juliusgeo b68ed63
add back in line that was removed
juliusgeo 5f96242
update minversion
juliusgeo f8122bf
add lock, change logic to match go-driver
juliusgeo 824008b
refactor logic and tests
juliusgeo 31f148d
add assertion to make mypy shut up
juliusgeo bdd5b46
remove unecessary line
juliusgeo 2800643
fix up whitespace
juliusgeo b60847d
remove stuff from mongoclient init
juliusgeo 643c109
remove assertion
juliusgeo 98fd502
make sure to save last_error
juliusgeo 23be66e
change back to using only one variable
juliusgeo 67c73fc
pull in latest spec tests
juliusgeo 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
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
test/retryable_writes/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": [] | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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.
There's a missing condition here. If the current error is NoWritesPerformed and the last error is None, then we must raise the current error even though it's labelled NoWritesPerformed. This is True for all the cases above with
assert last_error is not None
too.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.
Removing the assertion and refactoring fixed this.