-
Notifications
You must be signed in to change notification settings - Fork 100
PERL-918 Update retryable writes spec #165
Changes from all commits
22c4666
da823c7
a92e5c0
b8a0dad
94b8a02
9ba406d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,20 @@ sub _update_operation_time { | |
| return; | ||
| } | ||
|
|
||
| # Certain errors have to happen as soon as possible, such as write concern | ||
| # errors in a retryable write. This has to be seperate to the other functions | ||
| # due to not all result objects having the base response inside, so cannot be | ||
| # used to parse operationTime or $clusterTime | ||
| sub _assert_session_errors { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little nervous about this, but if all existing tests pass (particularly for bulk operations) then I'm okay with it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea this was the least complicated place to add this assertion - I couldn't see any information about the comment in The other single ops do throw WriteConcernErrors further down the stack, but only on the return value of the |
||
| my ( $self, $response ) = @_; | ||
|
|
||
| if ( $self->retryable_write ) { | ||
| $response->assert_no_write_concern_error; | ||
| } | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| sub __extract_from { | ||
| my ( $self, $response, $key ) = @_; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "_id": 1, | ||
| "x": 11 | ||
| }, | ||
| { | ||
| "_id": 2, | ||
| "x": 22 | ||
| } | ||
| ], | ||
| "minServerVersion": "3.99", | ||
| "tests": [ | ||
| { | ||
| "description": "BulkWrite succeeds after PrimarySteppedDown", | ||
| "clientOptions": { | ||
| "retryWrites": true | ||
| }, | ||
| "failPoint": { | ||
| "configureFailPoint": "failCommand", | ||
| "mode": { | ||
| "times": 1 | ||
| }, | ||
| "data": { | ||
| "failCommands": [ | ||
| "update" | ||
| ], | ||
| "errorCode": 189 | ||
| } | ||
| }, | ||
| "operation": { | ||
| "name": "bulkWrite", | ||
| "arguments": { | ||
| "requests": [ | ||
| { | ||
| "name": "deleteOne", | ||
| "arguments": { | ||
| "filter": { | ||
| "_id": 1 | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "insertOne", | ||
| "arguments": { | ||
| "document": { | ||
| "_id": 3, | ||
| "x": 33 | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "updateOne", | ||
| "arguments": { | ||
| "filter": { | ||
| "_id": 2 | ||
| }, | ||
| "update": { | ||
| "$inc": { | ||
| "x": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "options": { | ||
| "ordered": true | ||
| } | ||
| } | ||
| }, | ||
| "outcome": { | ||
| "result": { | ||
| "deletedCount": 1, | ||
| "insertedIds": { | ||
| "1": 3 | ||
| }, | ||
| "matchedCount": 1, | ||
| "modifiedCount": 1, | ||
| "upsertedCount": 0, | ||
| "upsertedIds": {} | ||
| }, | ||
| "collection": { | ||
| "data": [ | ||
| { | ||
| "_id": 2, | ||
| "x": 23 | ||
| }, | ||
| { | ||
| "_id": 3, | ||
| "x": 33 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "description": "BulkWrite succeeds after WriteConcernError ShutdownInProgress", | ||
| "clientOptions": { | ||
| "retryWrites": true | ||
| }, | ||
| "failPoint": { | ||
| "configureFailPoint": "failCommand", | ||
| "mode": { | ||
| "times": 1 | ||
| }, | ||
| "data": { | ||
| "failCommands": [ | ||
| "insert" | ||
| ], | ||
| "writeConcernError": { | ||
| "code": 91, | ||
| "errmsg": "Replication is being shut down" | ||
| } | ||
| } | ||
| }, | ||
| "operation": { | ||
| "name": "bulkWrite", | ||
| "arguments": { | ||
| "requests": [ | ||
| { | ||
| "name": "deleteOne", | ||
| "arguments": { | ||
| "filter": { | ||
| "_id": 1 | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "insertOne", | ||
| "arguments": { | ||
| "document": { | ||
| "_id": 3, | ||
| "x": 33 | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "updateOne", | ||
| "arguments": { | ||
| "filter": { | ||
| "_id": 2 | ||
| }, | ||
| "update": { | ||
| "$inc": { | ||
| "x": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "options": { | ||
| "ordered": true | ||
| } | ||
| } | ||
| }, | ||
| "outcome": { | ||
| "result": { | ||
| "deletedCount": 1, | ||
| "insertedIds": { | ||
| "1": 3 | ||
| }, | ||
| "matchedCount": 1, | ||
| "modifiedCount": 1, | ||
| "upsertedCount": 0, | ||
| "upsertedIds": {} | ||
| }, | ||
| "collection": { | ||
| "data": [ | ||
| { | ||
| "_id": 2, | ||
| "x": 23 | ||
| }, | ||
| { | ||
| "_id": 3, | ||
| "x": 33 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
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.
Comment is now mildly confusing given extra error check.
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.
Oh oops I did have a comment there about the extra check, must have got caught with a debugging cleanup...