268 lines
6.6 KiB
JSON
268 lines
6.6 KiB
JSON
{
|
|
"description": "transaction-options-repl",
|
|
"schemaVersion": "1.9",
|
|
"runOnRequirements": [
|
|
{
|
|
"minServerVersion": "4.0",
|
|
"topologies": [
|
|
"replicaset"
|
|
]
|
|
}
|
|
],
|
|
"createEntities": [
|
|
{
|
|
"client": {
|
|
"id": "client0",
|
|
"useMultipleMongoses": false,
|
|
"observeEvents": [
|
|
"commandStartedEvent"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"database": {
|
|
"id": "database0",
|
|
"client": "client0",
|
|
"databaseName": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"collection": {
|
|
"id": "collection0",
|
|
"database": "database0",
|
|
"collectionName": "test"
|
|
}
|
|
},
|
|
{
|
|
"session": {
|
|
"id": "session0",
|
|
"client": "client0"
|
|
}
|
|
}
|
|
],
|
|
"initialData": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "transaction-tests",
|
|
"documents": []
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "readConcern snapshot in startTransaction options",
|
|
"operations": [
|
|
{
|
|
"object": "testRunner",
|
|
"name": "createEntities",
|
|
"arguments": {
|
|
"entities": [
|
|
{
|
|
"session": {
|
|
"id": "session1",
|
|
"client": "client0",
|
|
"sessionOptions": {
|
|
"defaultTransactionOptions": {
|
|
"readConcern": {
|
|
"level": "majority"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"object": "session1",
|
|
"name": "startTransaction",
|
|
"arguments": {
|
|
"readConcern": {
|
|
"level": "snapshot"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"object": "collection0",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"session": "session1",
|
|
"document": {
|
|
"_id": 1
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"object": "session1",
|
|
"name": "commitTransaction"
|
|
},
|
|
{
|
|
"object": "session1",
|
|
"name": "startTransaction",
|
|
"arguments": {
|
|
"readConcern": {
|
|
"level": "snapshot"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"object": "collection0",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"session": "session1",
|
|
"document": {
|
|
"_id": 2
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 2
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"object": "session1",
|
|
"name": "abortTransaction"
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"insert": "test",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": {
|
|
"$$sessionLsid": "session1"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"level": "snapshot"
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "insert",
|
|
"databaseName": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session1"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
},
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "commitTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"insert": "test",
|
|
"documents": [
|
|
{
|
|
"_id": 2
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": {
|
|
"$$sessionLsid": "session1"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "2"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"level": "snapshot",
|
|
"afterClusterTime": {
|
|
"$$exists": true
|
|
}
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "insert",
|
|
"databaseName": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"abortTransaction": 1,
|
|
"lsid": {
|
|
"$$sessionLsid": "session1"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "2"
|
|
},
|
|
"startTransaction": {
|
|
"$$exists": false
|
|
},
|
|
"autocommit": false,
|
|
"readConcern": {
|
|
"$$exists": false
|
|
},
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "abortTransaction",
|
|
"databaseName": "admin"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outcome": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "transaction-tests",
|
|
"documents": [
|
|
{
|
|
"_id": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|