443 lines
10 KiB
JSON
443 lines
10 KiB
JSON
{
|
|
"runOn": [
|
|
{
|
|
"minServerVersion": "4.0",
|
|
"topology": [
|
|
"replicaset"
|
|
]
|
|
},
|
|
{
|
|
"minServerVersion": "4.1.8",
|
|
"topology": [
|
|
"sharded"
|
|
]
|
|
}
|
|
],
|
|
"database_name": "transaction-tests",
|
|
"collection_name": "test",
|
|
"data": [
|
|
{
|
|
"_id": 1
|
|
},
|
|
{
|
|
"_id": 2
|
|
},
|
|
{
|
|
"_id": 3
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "update",
|
|
"operations": [
|
|
{
|
|
"name": "startTransaction",
|
|
"object": "session0"
|
|
},
|
|
{
|
|
"name": "updateOne",
|
|
"object": "collection",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"_id": 4
|
|
},
|
|
"update": {
|
|
"$inc": {
|
|
"x": 1
|
|
}
|
|
},
|
|
"upsert": true
|
|
},
|
|
"result": {
|
|
"matchedCount": 0,
|
|
"modifiedCount": 0,
|
|
"upsertedCount": 1,
|
|
"upsertedId": 4
|
|
}
|
|
},
|
|
{
|
|
"name": "replaceOne",
|
|
"object": "collection",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"x": 1
|
|
},
|
|
"replacement": {
|
|
"y": 1
|
|
}
|
|
},
|
|
"result": {
|
|
"matchedCount": 1,
|
|
"modifiedCount": 1,
|
|
"upsertedCount": 0
|
|
}
|
|
},
|
|
{
|
|
"name": "updateMany",
|
|
"object": "collection",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"_id": {
|
|
"$gte": 3
|
|
}
|
|
},
|
|
"update": {
|
|
"$set": {
|
|
"z": 1
|
|
}
|
|
}
|
|
},
|
|
"result": {
|
|
"matchedCount": 2,
|
|
"modifiedCount": 2,
|
|
"upsertedCount": 0
|
|
}
|
|
},
|
|
{
|
|
"name": "commitTransaction",
|
|
"object": "session0"
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"_id": 4
|
|
},
|
|
"u": {
|
|
"$inc": {
|
|
"x": 1
|
|
}
|
|
},
|
|
"upsert": true
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"readConcern": null,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"x": 1
|
|
},
|
|
"u": {
|
|
"y": 1
|
|
}
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"_id": {
|
|
"$gte": 3
|
|
}
|
|
},
|
|
"u": {
|
|
"$set": {
|
|
"z": 1
|
|
}
|
|
},
|
|
"multi": true
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "commitTransaction",
|
|
"database_name": "admin"
|
|
}
|
|
}
|
|
],
|
|
"outcome": {
|
|
"collection": {
|
|
"data": [
|
|
{
|
|
"_id": 1
|
|
},
|
|
{
|
|
"_id": 2
|
|
},
|
|
{
|
|
"_id": 3,
|
|
"z": 1
|
|
},
|
|
{
|
|
"_id": 4,
|
|
"y": 1,
|
|
"z": 1
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "collections writeConcern ignored for update",
|
|
"operations": [
|
|
{
|
|
"name": "startTransaction",
|
|
"object": "session0",
|
|
"arguments": {
|
|
"options": {
|
|
"writeConcern": {
|
|
"w": "majority"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "updateOne",
|
|
"object": "collection",
|
|
"collectionOptions": {
|
|
"writeConcern": {
|
|
"w": "majority"
|
|
}
|
|
},
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"_id": 4
|
|
},
|
|
"update": {
|
|
"$inc": {
|
|
"x": 1
|
|
}
|
|
},
|
|
"upsert": true
|
|
},
|
|
"result": {
|
|
"matchedCount": 0,
|
|
"modifiedCount": 0,
|
|
"upsertedCount": 1,
|
|
"upsertedId": 4
|
|
}
|
|
},
|
|
{
|
|
"name": "replaceOne",
|
|
"object": "collection",
|
|
"collectionOptions": {
|
|
"writeConcern": {
|
|
"w": "majority"
|
|
}
|
|
},
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"x": 1
|
|
},
|
|
"replacement": {
|
|
"y": 1
|
|
}
|
|
},
|
|
"result": {
|
|
"matchedCount": 1,
|
|
"modifiedCount": 1,
|
|
"upsertedCount": 0
|
|
}
|
|
},
|
|
{
|
|
"name": "updateMany",
|
|
"object": "collection",
|
|
"collectionOptions": {
|
|
"writeConcern": {
|
|
"w": "majority"
|
|
}
|
|
},
|
|
"arguments": {
|
|
"session": "session0",
|
|
"filter": {
|
|
"_id": {
|
|
"$gte": 3
|
|
}
|
|
},
|
|
"update": {
|
|
"$set": {
|
|
"z": 1
|
|
}
|
|
}
|
|
},
|
|
"result": {
|
|
"matchedCount": 2,
|
|
"modifiedCount": 2,
|
|
"upsertedCount": 0
|
|
}
|
|
},
|
|
{
|
|
"name": "commitTransaction",
|
|
"object": "session0"
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"_id": 4
|
|
},
|
|
"u": {
|
|
"$inc": {
|
|
"x": 1
|
|
}
|
|
},
|
|
"upsert": true
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"readConcern": null,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"x": 1
|
|
},
|
|
"u": {
|
|
"y": 1
|
|
}
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"update": "test",
|
|
"updates": [
|
|
{
|
|
"q": {
|
|
"_id": {
|
|
"$gte": 3
|
|
}
|
|
},
|
|
"u": {
|
|
"$set": {
|
|
"z": 1
|
|
}
|
|
},
|
|
"multi": true
|
|
}
|
|
],
|
|
"ordered": true,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": null
|
|
},
|
|
"command_name": "update",
|
|
"database_name": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"commitTransaction": 1,
|
|
"lsid": "session0",
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": null,
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"w": "majority"
|
|
}
|
|
},
|
|
"command_name": "commitTransaction",
|
|
"database_name": "admin"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|