-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-918: Add test that reads are not retried in a transaction #963
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
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
115 changes: 115 additions & 0 deletions
115
tests/UnifiedSpecTests/transactions/do-not-retry-read-in-transaction.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,115 @@ | ||
{ | ||
"description": "do not retry read in a transaction", | ||
"schemaVersion": "1.4", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.0.0", | ||
"topologies": [ | ||
"replicaset" | ||
] | ||
}, | ||
{ | ||
"minServerVersion": "4.2.0", | ||
"topologies": [ | ||
"sharded", | ||
"load-balanced" | ||
] | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"useMultipleMongoses": false, | ||
"observeEvents": [ | ||
"commandStartedEvent" | ||
], | ||
"uriOptions": { | ||
"retryReads": true | ||
} | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "retryable-read-in-transaction-test" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "coll" | ||
} | ||
}, | ||
{ | ||
"session": { | ||
"id": "session0", | ||
"client": "client0" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "find does not retry in a transaction", | ||
"operations": [ | ||
{ | ||
"name": "startTransaction", | ||
"object": "session0" | ||
}, | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"find" | ||
], | ||
"closeConnection": true | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "find", | ||
"object": "collection0", | ||
"arguments": { | ||
"filter": {}, | ||
"session": "session0" | ||
}, | ||
"expectError": { | ||
"isError": true, | ||
"errorLabelsContain": [ | ||
"TransientTransactionError" | ||
] | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client0", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"find": "coll", | ||
"filter": {}, | ||
"startTransaction": true | ||
}, | ||
"commandName": "find", | ||
"databaseName": "retryable-read-in-transaction-test" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
204 changes: 204 additions & 0 deletions
204
tests/UnifiedSpecTests/transactions/retryable-abort-handshake.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,204 @@ | ||
{ | ||
"description": "retryable abortTransaction on handshake errors", | ||
"schemaVersion": "1.4", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.2", | ||
"topologies": [ | ||
"replicaset", | ||
"sharded", | ||
"load-balanced" | ||
], | ||
"serverless": "forbid", | ||
"auth": true | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"useMultipleMongoses": false, | ||
"observeEvents": [ | ||
"commandStartedEvent", | ||
"connectionCheckOutStartedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "retryable-handshake-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "coll" | ||
} | ||
}, | ||
{ | ||
"session": { | ||
"id": "session0", | ||
"client": "client0" | ||
} | ||
}, | ||
{ | ||
"session": { | ||
"id": "session1", | ||
"client": "client0" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "coll", | ||
"databaseName": "retryable-handshake-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 11 | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "AbortTransaction succeeds after handshake network error", | ||
"skipReason": "DRIVERS-2032: Pinned servers need to be checked if they are still selectable", | ||
"operations": [ | ||
{ | ||
"name": "startTransaction", | ||
"object": "session0" | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection0", | ||
"arguments": { | ||
"session": "session0", | ||
"document": { | ||
"_id": 2, | ||
"x": 22 | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"session": "session1", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 2 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"saslContinue", | ||
"ping" | ||
], | ||
"closeConnection": true | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "runCommand", | ||
"object": "database0", | ||
"arguments": { | ||
"commandName": "ping", | ||
"command": { | ||
"ping": 1 | ||
}, | ||
"session": "session1" | ||
}, | ||
"expectError": { | ||
"isError": true | ||
} | ||
}, | ||
{ | ||
"name": "abortTransaction", | ||
"object": "session0" | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client0", | ||
"eventType": "cmap", | ||
"events": [ | ||
{ | ||
"connectionCheckOutStartedEvent": {} | ||
}, | ||
{ | ||
"connectionCheckOutStartedEvent": {} | ||
}, | ||
{ | ||
"connectionCheckOutStartedEvent": {} | ||
}, | ||
{ | ||
"connectionCheckOutStartedEvent": {} | ||
}, | ||
{ | ||
"connectionCheckOutStartedEvent": {} | ||
} | ||
] | ||
}, | ||
{ | ||
"client": "client0", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"insert": "coll", | ||
"documents": [ | ||
{ | ||
"_id": 2, | ||
"x": 22 | ||
} | ||
], | ||
"startTransaction": true | ||
}, | ||
"commandName": "insert", | ||
"databaseName": "retryable-handshake-tests" | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"ping": 1 | ||
}, | ||
"databaseName": "retryable-handshake-tests" | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"abortTransaction": 1, | ||
"lsid": { | ||
"$$sessionLsid": "session0" | ||
} | ||
}, | ||
"commandName": "abortTransaction", | ||
"databaseName": "admin" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"outcome": [ | ||
{ | ||
"collectionName": "coll", | ||
"databaseName": "retryable-handshake-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 11 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.
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.
I noted from the downstream changes in DRIVERS-746 that both of the "retryable" tests are skipped, so it was not necessary to add these to
UnifiedSpecTest::$incompleteTests
.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.
I noted it too and that is why I didn't add new lines in UnifiedSpecTest::$incompleteTests. Also I double checked the DRIVERS-2032 ticket which is the parent ticket of DRIVERS-746.