Skip to content

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 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 tests/UnifiedSpecTests/transactions/retryable-abort-handshake.json
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",
Copy link
Member

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.

Copy link
Contributor Author

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.

"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
}
]
}
]
}
]
}
Loading