553 lines
14 KiB
JSON
553 lines
14 KiB
JSON
{
|
|
"description": "commit-retry",
|
|
"schemaVersion": "1.4",
|
|
"runOnRequirements": [
|
|
{
|
|
"minServerVersion": "4.0",
|
|
"topologies": [
|
|
"replicaset"
|
|
]
|
|
},
|
|
{
|
|
"minServerVersion": "4.1.8",
|
|
"topologies": [
|
|
"sharded",
|
|
"load-balanced"
|
|
]
|
|
}
|
|
],
|
|
"createEntities": [
|
|
{
|
|
"client": {
|
|
"id": "client0",
|
|
"useMultipleMongoses": false,
|
|
"observeEvents": [
|
|
"commandStartedEvent"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"database": {
|
|
"id": "database0",
|
|
"client": "client0",
|
|
"databaseName": "withTransaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"collection": {
|
|
"id": "collection0",
|
|
"database": "database0",
|
|
"collectionName": "test"
|
|
}
|
|
},
|
|
{
|
|
"session": {
|
|
"id": "session0",
|
|
"client": "client0"
|
|
}
|
|
}
|
|
],
|
|
"initialData": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "withTransaction-tests",
|
|
"documents": []
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "commitTransaction succeeds after multiple connection errors",
|
|
"runOnRequirements": [
|
|
{
|
|
"serverless": "forbid"
|
|
}
|
|
],
|
|
"operations": [
|
|
{
|
|
"name": "failPoint",
|
|
"object": "testRunner",
|
|
"arguments": {
|
|
"client": "client0",
|
|
"failPoint": {
|
|
"configureFailPoint": "failCommand",
|
|
"mode": {
|
|
"times": 2
|
|
},
|
|
"data": {
|
|
"failCommands": [
|
|
"commitTransaction"
|
|
],
|
|
"closeConnection": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "withTransaction",
|
|
"object": "session0",
|
|
"arguments": {
|
|
"callback": [
|
|
{
|
|
"name": "insertOne",
|
|
"object": "collection0",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"document": {
|
|
"_id": 1
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"insert": "test",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "insert",
|
|
"databaseName": "withTransaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": "majority",
|
|
"wtimeout": 10000
|
|
},
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": "majority",
|
|
"wtimeout": 10000
|
|
},
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outcome": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "withTransaction-tests",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "commitTransaction retry only overwrites write concern w option",
|
|
"runOnRequirements": [
|
|
{
|
|
"serverless": "forbid"
|
|
}
|
|
],
|
|
"operations": [
|
|
{
|
|
"name": "failPoint",
|
|
"object": "testRunner",
|
|
"arguments": {
|
|
"client": "client0",
|
|
"failPoint": {
|
|
"configureFailPoint": "failCommand",
|
|
"mode": {
|
|
"times": 2
|
|
},
|
|
"data": {
|
|
"failCommands": [
|
|
"commitTransaction"
|
|
],
|
|
"closeConnection": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "withTransaction",
|
|
"object": "session0",
|
|
"arguments": {
|
|
"callback": [
|
|
{
|
|
"name": "insertOne",
|
|
"object": "collection0",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"document": {
|
|
"_id": 1
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"writeConcern": {
|
|
"w": 2,
|
|
"journal": true,
|
|
"wtimeoutMS": 5000
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"insert": "test",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "insert",
|
|
"databaseName": "withTransaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": 2,
|
|
"j": true,
|
|
"wtimeout": 5000
|
|
},
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": "majority",
|
|
"j": true,
|
|
"wtimeout": 5000
|
|
},
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": "majority",
|
|
"j": true,
|
|
"wtimeout": 5000
|
|
},
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outcome": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "withTransaction-tests",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "commit is not retried after MaxTimeMSExpired error",
|
|
"operations": [
|
|
{
|
|
"name": "failPoint",
|
|
"object": "testRunner",
|
|
"arguments": {
|
|
"client": "client0",
|
|
"failPoint": {
|
|
"configureFailPoint": "failCommand",
|
|
"mode": {
|
|
"times": 1
|
|
},
|
|
"data": {
|
|
"failCommands": [
|
|
"commitTransaction"
|
|
],
|
|
"errorCode": 50
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "withTransaction",
|
|
"object": "session0",
|
|
"arguments": {
|
|
"callback": [
|
|
{
|
|
"name": "insertOne",
|
|
"object": "collection0",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"document": {
|
|
"_id": 1
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"maxCommitTimeMS": 60000
|
|
},
|
|
"expectError": {
|
|
"errorCodeName": "MaxTimeMSExpired",
|
|
"errorLabelsContain": [
|
|
"UnknownTransactionCommitResult"
|
|
],
|
|
"errorLabelsOmit": [
|
|
"TransientTransactionError"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"insert": "test",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "insert",
|
|
"databaseName": "withTransaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"autocommit": false,
|
|
"maxTimeMS": 60000,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outcome": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "withTransaction-tests",
|
|
"documents": []
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|