From 70508e7a890e83a471cdc115eb1f988685d2202f Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 13:56:14 -0500 Subject: [PATCH 01/55] Remove JSON for legacy transaction tests --- source/transactions/tests/legacy/abort.json | 622 --- source/transactions/tests/legacy/bulk.json | 532 -- .../tests/legacy/causal-consistency.json | 306 -- source/transactions/tests/legacy/commit.json | 926 ---- source/transactions/tests/legacy/count.json | 121 - .../tests/legacy/create-collection.json | 205 - .../tests/legacy/create-index.json | 238 - source/transactions/tests/legacy/delete.json | 328 -- .../legacy/error-labels-blockConnection.json | 160 - .../legacy/error-labels-errorLabels.json | 314 -- .../tests/legacy/error-labels.json | 1791 ------ .../tests/legacy/errors-client.json | 97 - source/transactions/tests/legacy/errors.json | 223 - .../tests/legacy/findOneAndDelete.json | 222 - .../tests/legacy/findOneAndReplace.json | 256 - .../tests/legacy/findOneAndUpdate.json | 414 -- source/transactions/tests/legacy/insert.json | 649 --- .../transactions/tests/legacy/isolation.json | 226 - .../tests/legacy/mongos-pin-auto.json | 4816 ----------------- .../mongos-recovery-token-errorLabels.json | 149 - .../tests/legacy/mongos-recovery-token.json | 380 -- .../transactions/tests/legacy/pin-mongos.json | 1230 ----- .../tests/legacy/read-concern.json | 1629 ------ .../transactions/tests/legacy/read-pref.json | 721 --- source/transactions/tests/legacy/reads.json | 544 -- .../legacy/retryable-abort-errorLabels.json | 1817 ------- .../tests/legacy/retryable-abort.json | 406 -- ...-commit-errorLabels-forbid_serverless.json | 240 - .../legacy/retryable-commit-errorLabels.json | 1711 ------ .../retryable-commit-forbid_serverless.json | 429 -- .../tests/legacy/retryable-commit.json | 222 - .../tests/legacy/retryable-writes.json | 344 -- .../tests/legacy/run-command.json | 307 -- .../legacy/transaction-options-repl.json | 181 - .../tests/legacy/transaction-options.json | 1405 ----- source/transactions/tests/legacy/update.json | 443 -- .../tests/legacy/write-concern.json | 1279 ----- 37 files changed, 25883 deletions(-) delete mode 100644 source/transactions/tests/legacy/abort.json delete mode 100644 source/transactions/tests/legacy/bulk.json delete mode 100644 source/transactions/tests/legacy/causal-consistency.json delete mode 100644 source/transactions/tests/legacy/commit.json delete mode 100644 source/transactions/tests/legacy/count.json delete mode 100644 source/transactions/tests/legacy/create-collection.json delete mode 100644 source/transactions/tests/legacy/create-index.json delete mode 100644 source/transactions/tests/legacy/delete.json delete mode 100644 source/transactions/tests/legacy/error-labels-blockConnection.json delete mode 100644 source/transactions/tests/legacy/error-labels-errorLabels.json delete mode 100644 source/transactions/tests/legacy/error-labels.json delete mode 100644 source/transactions/tests/legacy/errors-client.json delete mode 100644 source/transactions/tests/legacy/errors.json delete mode 100644 source/transactions/tests/legacy/findOneAndDelete.json delete mode 100644 source/transactions/tests/legacy/findOneAndReplace.json delete mode 100644 source/transactions/tests/legacy/findOneAndUpdate.json delete mode 100644 source/transactions/tests/legacy/insert.json delete mode 100644 source/transactions/tests/legacy/isolation.json delete mode 100644 source/transactions/tests/legacy/mongos-pin-auto.json delete mode 100644 source/transactions/tests/legacy/mongos-recovery-token-errorLabels.json delete mode 100644 source/transactions/tests/legacy/mongos-recovery-token.json delete mode 100644 source/transactions/tests/legacy/pin-mongos.json delete mode 100644 source/transactions/tests/legacy/read-concern.json delete mode 100644 source/transactions/tests/legacy/read-pref.json delete mode 100644 source/transactions/tests/legacy/reads.json delete mode 100644 source/transactions/tests/legacy/retryable-abort-errorLabels.json delete mode 100644 source/transactions/tests/legacy/retryable-abort.json delete mode 100644 source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.json delete mode 100644 source/transactions/tests/legacy/retryable-commit-errorLabels.json delete mode 100644 source/transactions/tests/legacy/retryable-commit-forbid_serverless.json delete mode 100644 source/transactions/tests/legacy/retryable-commit.json delete mode 100644 source/transactions/tests/legacy/retryable-writes.json delete mode 100644 source/transactions/tests/legacy/run-command.json delete mode 100644 source/transactions/tests/legacy/transaction-options-repl.json delete mode 100644 source/transactions/tests/legacy/transaction-options.json delete mode 100644 source/transactions/tests/legacy/update.json delete mode 100644 source/transactions/tests/legacy/write-concern.json diff --git a/source/transactions/tests/legacy/abort.json b/source/transactions/tests/legacy/abort.json deleted file mode 100644 index 2398e48712..0000000000 --- a/source/transactions/tests/legacy/abort.json +++ /dev/null @@ -1,622 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "implicit abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "two aborts", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "abortTransaction", - "object": "session0", - "result": { - "errorContains": "cannot call abortTransaction twice" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abort without start", - "operations": [ - { - "name": "abortTransaction", - "object": "session0", - "result": { - "errorContains": "no transaction started" - } - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abort directly after no-op commit", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "abortTransaction", - "object": "session0", - "result": { - "errorContains": "Cannot call abortTransaction after calling commitTransaction" - } - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abort directly after commit", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "abortTransaction", - "object": "session0", - "result": { - "errorContains": "Cannot call abortTransaction after calling commitTransaction" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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 - } - ] - } - } - }, - { - "description": "abort ignores TransactionAborted", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorContains": "E11000" - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorCodeName": "NoSuchTransaction", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abort does not apply writeConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": 10 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/bulk.json b/source/transactions/tests/legacy/bulk.json deleted file mode 100644 index 8ed78649f8..0000000000 --- a/source/transactions/tests/legacy/bulk.json +++ /dev/null @@ -1,532 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "bulk", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": 2 - } - }, - "upsert": true - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 3 - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 4 - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 5 - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 6 - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 7 - } - } - }, - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - } - }, - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 2 - }, - "replacement": { - "y": 2 - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 3 - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 4 - } - } - }, - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "update": { - "$set": { - "z": 1 - } - } - } - }, - { - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gte": 6 - } - } - } - } - ] - }, - "result": { - "deletedCount": 4, - "insertedCount": 6, - "insertedIds": { - "0": 1, - "3": 3, - "4": 4, - "5": 5, - "6": 6, - "7": 7 - }, - "matchedCount": 7, - "modifiedCount": 7, - "upsertedCount": 1, - "upsertedIds": { - "2": 2 - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 1 - } - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "$set": { - "x": 2 - } - }, - "upsert": 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": { - "insert": "test", - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "y": 1 - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "y": 2 - } - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "update", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 3 - }, - "limit": 1 - }, - { - "q": { - "_id": 4 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gte": 2 - } - }, - "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": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$gte": 6 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "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, - "y": 1 - }, - { - "_id": 2, - "y": 2, - "z": 1 - }, - { - "_id": 5, - "z": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/causal-consistency.json b/source/transactions/tests/legacy/causal-consistency.json deleted file mode 100644 index 46b4ba839d..0000000000 --- a/source/transactions/tests/legacy/causal-consistency.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1, - "count": 0 - } - ], - "tests": [ - { - "description": "causal consistency", - "clientOptions": { - "retryWrites": false - }, - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - } - } - ], - "ordered": true, - "lsid": "session0", - "readConcern": null, - "txnNumber": null, - "startTransaction": null, - "autocommit": null, - "writeConcern": null - }, - "command_name": "update", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - } - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "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, - "count": 2 - } - ] - } - } - }, - { - "description": "causal consistency disabled", - "clientOptions": { - "retryWrites": false - }, - "sessionOptions": { - "session0": { - "causalConsistency": false - } - }, - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": null, - "autocommit": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - } - } - ], - "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": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "count": 1 - }, - { - "_id": 2 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/commit.json b/source/transactions/tests/legacy/commit.json deleted file mode 100644 index d55a6b611c..0000000000 --- a/source/transactions/tests/legacy/commit.json +++ /dev/null @@ -1,926 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commit", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "rerun commit after empty transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "multiple commits in a row", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "write concern error on commit", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": 10 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commit without start", - "operations": [ - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorContains": "no transaction started" - } - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "commit after no-op abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorContains": "Cannot call commitTransaction after calling abortTransaction" - } - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "commit after abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorContains": "Cannot call commitTransaction after calling abortTransaction" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ] - }, - { - "description": "multiple commits after empty transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "reset session state commit", - "clientOptions": { - "retryWrites": false - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorContains": "no transaction started" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": null, - "startTransaction": null, - "autocommit": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "reset session state abort", - "clientOptions": { - "retryWrites": false - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0", - "result": { - "errorContains": "no transaction started" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": null, - "startTransaction": null, - "autocommit": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/count.json b/source/transactions/tests/legacy/count.json deleted file mode 100644 index 357bc252d6..0000000000 --- a/source/transactions/tests/legacy/count.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0.2", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "tests": [ - { - "description": "count", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "count", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorCodeName": "OperationNotSupportedInTransaction", - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "count": "test", - "query": { - "_id": 1 - }, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "count", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/create-collection.json b/source/transactions/tests/legacy/create-collection.json deleted file mode 100644 index d65159d024..0000000000 --- a/source/transactions/tests/legacy/create-collection.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "explicitly create collection using create command", - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "session": "session0", - "collection": "test" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "test", - "writeConcern": null - }, - "command_name": "drop", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "create": "test", - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "create", - "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" - } - } - ] - }, - { - "description": "implicitly create collection using insert", - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "test", - "writeConcern": null - }, - "command_name": "drop", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/create-index.json b/source/transactions/tests/legacy/create-index.json deleted file mode 100644 index cd0d75d0bc..0000000000 --- a/source/transactions/tests/legacy/create-index.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "create index on a non-existing collection", - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "createIndex", - "object": "collection", - "arguments": { - "session": "session0", - "name": "t_1", - "keys": { - "x": 1 - } - } - }, - { - "name": "assertIndexNotExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test", - "index": "t_1" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test", - "index": "t_1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "test", - "writeConcern": null - }, - "command_name": "drop", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "test", - "indexes": [ - { - "name": "t_1", - "key": { - "x": 1 - } - } - ], - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "createIndexes", - "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" - } - } - ] - }, - { - "description": "create index on a collection created within the same transaction", - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "session": "session0", - "collection": "test" - } - }, - { - "name": "createIndex", - "object": "collection", - "arguments": { - "session": "session0", - "name": "t_1", - "keys": { - "x": 1 - } - } - }, - { - "name": "assertIndexNotExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test", - "index": "t_1" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "transaction-tests", - "collection": "test", - "index": "t_1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "test", - "writeConcern": null - }, - "command_name": "drop", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "create": "test", - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "create", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "test", - "indexes": [ - { - "name": "t_1", - "key": { - "x": 1 - } - } - ], - "lsid": "session0", - "writeConcern": null - }, - "command_name": "createIndexes", - "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" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/delete.json b/source/transactions/tests/legacy/delete.json deleted file mode 100644 index 2e21494536..0000000000 --- a/source/transactions/tests/legacy/delete.json +++ /dev/null @@ -1,328 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "tests": [ - { - "description": "delete", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$lte": 3 - } - } - }, - "result": { - "deletedCount": 2 - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$lte": 3 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 4 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "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": 5 - } - ] - } - } - }, - { - "description": "collection writeConcern ignored for delete", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "deleteMany", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$lte": 3 - } - } - }, - "result": { - "deletedCount": 2 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$lte": 3 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "delete", - "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" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/error-labels-blockConnection.json b/source/transactions/tests/legacy/error-labels-blockConnection.json deleted file mode 100644 index 848f56fa3c..0000000000 --- a/source/transactions/tests/legacy/error-labels-blockConnection.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", - "clientOptions": { - "socketTimeoutMS": 100 - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "blockConnection": true, - "blockTimeMS": 150 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/error-labels-errorLabels.json b/source/transactions/tests/legacy/error-labels-errorLabels.json deleted file mode 100644 index 50d90c36f8..0000000000 --- a/source/transactions/tests/legacy/error-labels-errorLabels.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ] - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/error-labels.json b/source/transactions/tests/legacy/error-labels.json deleted file mode 100644 index ac1265517f..0000000000 --- a/source/transactions/tests/legacy/error-labels.json +++ /dev/null @@ -1,1791 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "DuplicateKey errors do not contain transient label", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 1 - } - ] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorContains": "E11000" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - }, - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "NotWritablePrimary errors contain transient label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 10107 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "WriteConflict errors contain transient label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 112 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "NoSuchTransaction errors contain transient label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 251 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "NoSuchTransaction errors on commit contain transient label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 251 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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": [] - } - } - }, - { - "description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 4 - }, - "data": { - "failCommands": [ - "insert", - "find", - "aggregate", - "distinct" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "session": "session0" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": {}, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "errmsg": "multiple errors reported" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "codeName": "WriteConcernFailed", - "errmsg": "waiting for replication timed out", - "errInfo": { - "wtimeout": true - } - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 100, - "errmsg": "Not enough data-bearing nodes" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 79, - "errmsg": "No write concern mode named 'blah' found in replica set configuration" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "RetryableWriteConcern", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 50 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "maxTimeMS": 60000, - "session": "session0" - }, - "result": { - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult", - "TransientTransactionError" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": {}, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "maxTimeMS": 60000 - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "add UnknownTransactionCommitResult label to MaxTimeMSExpired", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 50 - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 50, - "errmsg": "operation exceeded time limit" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/errors-client.json b/source/transactions/tests/legacy/errors-client.json deleted file mode 100644 index d163e91ec5..0000000000 --- a/source/transactions/tests/legacy/errors-client.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "Client side error in command starting transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "x": 1 - } - }, - "error": true - }, - { - "name": "assertSessionTransactionState", - "object": "testRunner", - "arguments": { - "session": "session0", - "state": "starting" - } - } - ] - }, - { - "description": "Client side error when transaction is in progress", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "x": 1 - } - }, - "error": true - }, - { - "name": "assertSessionTransactionState", - "object": "testRunner", - "arguments": { - "session": "session0", - "state": "in_progress" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/errors.json b/source/transactions/tests/legacy/errors.json deleted file mode 100644 index 356e3eec0d..0000000000 --- a/source/transactions/tests/legacy/errors.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "start insert start", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "startTransaction", - "object": "session0", - "result": { - "errorContains": "transaction already in progress" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ] - }, - { - "description": "start twice", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0", - "result": { - "errorContains": "transaction already in progress" - } - } - ] - }, - { - "description": "commit and start twice", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0", - "result": { - "errorContains": "transaction already in progress" - } - } - ] - }, - { - "description": "write conflict commit", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "startTransaction", - "object": "session1" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "result": { - "errorCodeName": "WriteConflict", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session1", - "result": { - "errorCodeName": "NoSuchTransaction", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - } - ] - }, - { - "description": "write conflict abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "startTransaction", - "object": "session1" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "result": { - "errorCodeName": "WriteConflict", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "abortTransaction", - "object": "session1" - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/findOneAndDelete.json b/source/transactions/tests/legacy/findOneAndDelete.json deleted file mode 100644 index e7aab710d6..0000000000 --- a/source/transactions/tests/legacy/findOneAndDelete.json +++ /dev/null @@ -1,222 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "tests": [ - { - "description": "findOneAndDelete", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - } - }, - "result": { - "_id": 3 - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - } - }, - "result": null - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "remove": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "remove": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "collection writeConcern ignored for findOneAndDelete", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - } - }, - "result": { - "_id": 3 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "remove": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/findOneAndReplace.json b/source/transactions/tests/legacy/findOneAndReplace.json deleted file mode 100644 index 595b5c58b3..0000000000 --- a/source/transactions/tests/legacy/findOneAndReplace.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "tests": [ - { - "description": "findOneAndReplace", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3 - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "replacement": { - "x": 1 - }, - "upsert": true, - "returnDocument": "After" - }, - "result": { - "_id": 4, - "x": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "update": { - "x": 1 - }, - "new": true, - "upsert": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3, - "x": 1 - }, - { - "_id": 4, - "x": 1 - } - ] - } - } - }, - { - "description": "collection writeConcern ignored for findOneAndReplace", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/findOneAndUpdate.json b/source/transactions/tests/legacy/findOneAndUpdate.json deleted file mode 100644 index 8044f04766..0000000000 --- a/source/transactions/tests/legacy/findOneAndUpdate.json +++ /dev/null @@ -1,414 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "tests": [ - { - "description": "findOneAndUpdate", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3 - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "returnDocument": "After" - }, - "result": { - "_id": 4, - "x": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3, - "x": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3, - "x": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": true, - "upsert": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": 42 - }, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": 42 - }, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3, - "x": 2 - }, - { - "_id": 4, - "x": 1 - } - ] - } - } - }, - { - "description": "collection writeConcern ignored for findOneAndUpdate", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 3 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/insert.json b/source/transactions/tests/legacy/insert.json deleted file mode 100644 index 2f29d4fa31..0000000000 --- a/source/transactions/tests/legacy/insert.json +++ /dev/null @@ -1,649 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "insert", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 2, - "1": 3 - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "insertedId": 4 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 5 - } - }, - "result": { - "insertedId": 5 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 5 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - } - }, - { - "description": "insert with session1", - "operations": [ - { - "name": "startTransaction", - "object": "session1" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session1" - }, - "result": { - "insertedIds": { - "0": 2, - "1": 3 - } - } - }, - { - "name": "commitTransaction", - "object": "session1" - }, - { - "name": "startTransaction", - "object": "session1" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session1", - "document": { - "_id": 4 - } - }, - "result": { - "insertedId": 4 - } - }, - { - "name": "abortTransaction", - "object": "session1" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session1", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": "session1", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session1", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session1", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session1", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - } - }, - { - "description": "collection writeConcern without transaction", - "clientOptions": { - "retryWrites": false - }, - "operations": [ - { - "name": "insertOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": null, - "startTransaction": null, - "autocommit": null, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "collection writeConcern ignored for insert", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "insertMany", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - }, - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 2, - "1": 3 - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/isolation.json b/source/transactions/tests/legacy/isolation.json deleted file mode 100644 index fc33781473..0000000000 --- a/source/transactions/tests/legacy/isolation.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "one transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "result": [] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [] - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1 - } - ] - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "two transactions", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session1" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "result": [] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [] - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "result": [] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1 - } - ] - }, - { - "name": "commitTransaction", - "object": "session1" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/mongos-pin-auto.json b/source/transactions/tests/legacy/mongos-pin-auto.json deleted file mode 100644 index 36965dcb7f..0000000000 --- a/source/transactions/tests/legacy/mongos-pin-auto.json +++ /dev/null @@ -1,4816 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ], - "tests": [ - { - "description": "remain pinned after non-transient Interrupted error on insertOne", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorCodeName": "Interrupted" - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - } - }, - { - "description": "unpin after transient error within a transaction", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on insertOne insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on insertMany insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on updateOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on replaceOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on updateMany update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteOne delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteMany delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on find find", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on countDocuments aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "session": "session0", - "filter": {} - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on aggregate aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on distinct distinct", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient Interrupted error on runCommand insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on insertOne insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on insertOne insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on insertMany insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on insertMany insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on updateOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on updateOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on replaceOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on replaceOne update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on updateMany update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on updateMany update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on deleteOne delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteOne delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on deleteMany delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteMany delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on findOneAndDelete findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on findOneAndUpdate findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on findOneAndReplace findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on bulkWrite insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on bulkWrite update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite update", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on bulkWrite delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite delete", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "session": "session0", - "requests": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on find find", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on find find", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on countDocuments aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "session": "session0", - "filter": {} - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on countDocuments aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "session": "session0", - "filter": {} - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on aggregate aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on aggregate aggregate", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on distinct distinct", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on distinct distinct", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient connection error on runCommand insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient ShutdownInProgress error on runCommand insert", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.json b/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.json deleted file mode 100644 index 874dae2f69..0000000000 --- a/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction retry succeeds on new mongos", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/mongos-recovery-token.json b/source/transactions/tests/legacy/mongos-recovery-token.json deleted file mode 100644 index 3be3857ddd..0000000000 --- a/source/transactions/tests/legacy/mongos-recovery-token.json +++ /dev/null @@ -1,380 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction explicit retries include recoveryToken", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction retry fails on new mongos", - "useMultipleMongoses": true, - "clientOptions": { - "heartbeatFrequencyMS": 30000 - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 7 - }, - "data": { - "failCommands": [ - "commitTransaction", - "isMaster", - "hello" - ], - "closeConnection": true - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ], - "errorCodeName": "NoSuchTransaction" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction sends recoveryToken", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/pin-mongos.json b/source/transactions/tests/legacy/pin-mongos.json deleted file mode 100644 index 6e1d143d5c..0000000000 --- a/source/transactions/tests/legacy/pin-mongos.json +++ /dev/null @@ -1,1230 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ], - "tests": [ - { - "description": "countDocuments", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "distinct", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "_id", - "session": "session0" - }, - "result": [ - 1, - 2 - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "find", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "result": [ - { - "_id": 2 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "insertOne", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 3 - }, - "session": "session0" - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 4 - }, - "session": "session0" - }, - "result": { - "insertedId": 4 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 5 - }, - "session": "session0" - }, - "result": { - "insertedId": 5 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 6 - }, - "session": "session0" - }, - "result": { - "insertedId": 6 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 7 - }, - "session": "session0" - }, - "result": { - "insertedId": 7 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 8 - }, - "session": "session0" - }, - "result": { - "insertedId": 8 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 9 - }, - "session": "session0" - }, - "result": { - "insertedId": 9 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 10 - }, - "session": "session0" - }, - "result": { - "insertedId": 10 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - }, - { - "_id": 8 - }, - { - "_id": 9 - }, - { - "_id": 10 - } - ] - } - } - }, - { - "description": "mixed read write operations", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 3 - }, - "session": "session0" - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "result": 1 - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 4 - }, - "session": "session0" - }, - "result": { - "insertedId": 4 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 5 - }, - "session": "session0" - }, - "result": { - "insertedId": 5 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 6 - }, - "session": "session0" - }, - "result": { - "insertedId": 6 - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 7 - }, - "session": "session0" - }, - "result": { - "insertedId": 7 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - } - ] - } - } - }, - { - "description": "multiple commits", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 3, - "1": 4 - } - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "remain pinned after non-transient error on commit", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 3, - "1": 4 - } - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 51 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "TransientTransactionError" - ], - "errorCode": 51 - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "unpin after transient error within a transaction", - "useMultipleMongoses": true, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unpin after transient error within a transaction and commit", - "useMultipleMongoses": true, - "clientOptions": { - "heartbeatFrequencyMS": 30000 - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 7 - }, - "data": { - "failCommands": [ - "insert", - "isMaster", - "hello" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ], - "errorCodeName": "NoSuchTransaction" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null, - "recoveryToken": 42 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/read-concern.json b/source/transactions/tests/legacy/read-concern.json deleted file mode 100644 index 99495ddc4b..0000000000 --- a/source/transactions/tests/legacy/read-concern.json +++ /dev/null @@ -1,1629 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "tests": [ - { - "description": "only first countDocuments includes readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 2 - } - } - }, - "result": 3 - }, - { - "name": "countDocuments", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 2 - } - } - }, - "result": 3 - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": "session0", - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "only first find includes readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "only first aggregate includes readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": "session0", - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "only first distinct includes readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": [ - 1, - 2, - 3, - 4 - ] - }, - { - "name": "distinct", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": [ - 1, - 2, - 3, - 4 - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "only first runCommand includes readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "lsid": "session0", - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "countDocuments ignores collection readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "countDocuments", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 2 - } - } - }, - "result": 3 - }, - { - "name": "countDocuments", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 2 - } - } - }, - "result": 3 - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "find ignores collection readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "aggregate ignores collection readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "distinct ignores collection readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "distinct", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": [ - 1, - 2, - 3, - 4 - ] - }, - { - "name": "distinct", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": [ - 1, - 2, - 3, - 4 - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "runCommand ignores database readConcern", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "runCommand", - "object": "database", - "databaseOptions": { - "readConcern": { - "level": "majority" - } - }, - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/read-pref.json b/source/transactions/tests/legacy/read-pref.json deleted file mode 100644 index f06a72246a..0000000000 --- a/source/transactions/tests/legacy/read-pref.json +++ /dev/null @@ -1,721 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "default readPreference", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "result": [ - { - "count": 1 - } - ] - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "primary readPreference", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Primary" - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "result": [ - { - "count": 1 - } - ] - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Secondary" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "secondary readPreference", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Secondary" - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "primaryPreferred readPreference", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "PrimaryPreferred" - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "nearest readPreference", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Nearest" - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "aggregate", - "object": "collection", - "collectionOptions": { - "readPreference": { - "mode": "Primary" - } - }, - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "secondary write only", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Secondary" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/reads.json b/source/transactions/tests/legacy/reads.json deleted file mode 100644 index ce9353a66a..0000000000 --- a/source/transactions/tests/legacy/reads.json +++ /dev/null @@ -1,544 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "tests": [ - { - "description": "collection readConcern without transaction", - "operations": [ - { - "name": "find", - "object": "collection", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "readConcern": { - "level": "majority" - }, - "lsid": "session0", - "txnNumber": null, - "startTransaction": null, - "autocommit": null - }, - "command_name": "find", - "database_name": "transaction-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "find", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "batchSize": 3 - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "find", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "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 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "aggregate", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "result": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "aggregate", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$numberLong": "42" - }, - "collection": "test", - "batchSize": 3, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false - }, - "command_name": "getMore", - "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 - }, - { - "_id": 4 - } - ] - } - } - }, - { - "description": "distinct", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "session": "session0", - "fieldName": "_id" - }, - "result": [ - 1, - 2, - 3, - 4 - ] - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "distinct", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "readConcern": null, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-abort-errorLabels.json b/source/transactions/tests/legacy/retryable-abort-errorLabels.json deleted file mode 100644 index 8e4a50a699..0000000000 --- a/source/transactions/tests/legacy/retryable-abort-errorLabels.json +++ /dev/null @@ -1,1817 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "abortTransaction only retries once with RetryableWriteError from server", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction does not retry without RetryableWriteError label", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11600, - "errorLabels": [] - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after NotWritablePrimary", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after NotPrimaryOrSecondary", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 13436, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after NotPrimaryNoSecondaryOk", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 13435, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after InterruptedDueToReplStateChange", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after InterruptedAtShutdown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11600, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after PrimarySteppedDown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after ShutdownInProgress", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 91, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after HostNotFound", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 7, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after HostUnreachable", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 6, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after SocketException", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 9001, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after NetworkTimeout", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after WriteConcernError InterruptedAtShutdown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11600, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11602, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after WriteConcernError PrimarySteppedDown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 189, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after WriteConcernError ShutdownInProgress", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-abort.json b/source/transactions/tests/legacy/retryable-abort.json deleted file mode 100644 index 61be87a910..0000000000 --- a/source/transactions/tests/legacy/retryable-abort.json +++ /dev/null @@ -1,406 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "abortTransaction only performs a single retry", - "clientOptions": { - "retryWrites": false - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction does not retry after Interrupted", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11601, - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction does not retry after WriteConcernError Interrupted", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "writeConcernError": { - "code": 11601, - "errmsg": "operation was interrupted" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "abortTransaction succeeds after connection error", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.json b/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.json deleted file mode 100644 index bf65ed6eab..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.json +++ /dev/null @@ -1,240 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction succeeds after InterruptedAtShutdown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11600, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after ShutdownInProgress", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 91, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-commit-errorLabels.json b/source/transactions/tests/legacy/retryable-commit-errorLabels.json deleted file mode 100644 index 2e060c8a81..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-errorLabels.json +++ /dev/null @@ -1,1711 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction does not retry error without RetryableWriteError label", - "clientOptions": { - "retryWrites": false - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11600, - "errorLabels": [] - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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": [] - } - } - }, - { - "description": "commitTransaction retries once with RetryableWriteError from server", - "clientOptions": { - "retryWrites": false - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after NotWritablePrimary", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after NotPrimaryOrSecondary", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 13436, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after NotPrimaryNoSecondaryOk", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 13435, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after InterruptedDueToReplStateChange", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after PrimarySteppedDown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after HostNotFound", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 7, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after HostUnreachable", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 6, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after SocketException", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 9001, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after NetworkTimeout", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after WriteConcernError InterruptedAtShutdown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11600, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11602, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after WriteConcernError PrimarySteppedDown", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 189, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after WriteConcernError ShutdownInProgress", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-commit-forbid_serverless.json b/source/transactions/tests/legacy/retryable-commit-forbid_serverless.json deleted file mode 100644 index 374f18d7ef..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-forbid_serverless.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction fails after two errors", - "clientOptions": { - "retryWrites": false - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction applies majority write concern on retries", - "clientOptions": { - "retryWrites": false - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": 2, - "j": true, - "wtimeout": 5000 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": 2, - "j": true, - "wtimeout": 5000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commitTransaction succeeds after connection error", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-commit.json b/source/transactions/tests/legacy/retryable-commit.json deleted file mode 100644 index e56440d303..0000000000 --- a/source/transactions/tests/legacy/retryable-commit.json +++ /dev/null @@ -1,222 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "commitTransaction fails after Interrupted", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11601, - "closeConnection": false - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorCodeName": "Interrupted", - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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": [] - } - } - }, - { - "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 100, - "errmsg": "Not enough data-bearing nodes" - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0", - "result": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/retryable-writes.json b/source/transactions/tests/legacy/retryable-writes.json deleted file mode 100644 index 93ad04ef8f..0000000000 --- a/source/transactions/tests/legacy/retryable-writes.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "increment txnNumber", - "clientOptions": { - "retryWrites": true - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "result": { - "insertedId": 3 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "session": "session0" - }, - "result": { - "insertedIds": { - "0": 4, - "1": 5 - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": 42 - }, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "4" - }, - "startTransaction": null, - "autocommit": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - } - }, - { - "description": "writes are not retried", - "clientOptions": { - "retryWrites": true - }, - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/run-command.json b/source/transactions/tests/legacy/run-command.json deleted file mode 100644 index 2f36786b3a..0000000000 --- a/source/transactions/tests/legacy/run-command.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "run command with default read preference", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "result": { - "n": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ] - }, - { - "description": "run command with secondary read preference in client option and primary read preference in transaction options", - "clientOptions": { - "readPreference": "secondary" - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Primary" - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "result": { - "n": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ] - }, - { - "description": "run command with explicit primary read preference", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "runCommand", - "object": "database", - "command_name": "insert", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - }, - "readPreference": { - "mode": "Primary" - } - }, - "result": { - "n": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ] - }, - { - "description": "run command fails with explicit secondary read preference", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "runCommand", - "object": "database", - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "readPreference": { - "mode": "Secondary" - } - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - } - ] - }, - { - "description": "run command fails with secondary read preference from transaction options", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Secondary" - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "find", - "arguments": { - "session": "session0", - "command": { - "find": "test" - } - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/transaction-options-repl.json b/source/transactions/tests/legacy/transaction-options-repl.json deleted file mode 100644 index 33324debb8..0000000000 --- a/source/transactions/tests/legacy/transaction-options-repl.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "readConcern snapshot in startTransaction options", - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - } - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "snapshot" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "snapshot" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "snapshot" - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "snapshot", - "afterClusterTime": 42 - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/transaction-options.json b/source/transactions/tests/legacy/transaction-options.json deleted file mode 100644 index 6bcfae9d33..0000000000 --- a/source/transactions/tests/legacy/transaction-options.json +++ /dev/null @@ -1,1405 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [], - "tests": [ - { - "description": "no transaction options set", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": 42 - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "transaction options inherited from client", - "clientOptions": { - "w": 1, - "readConcernLevel": "local" - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local", - "afterClusterTime": 42 - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "transaction options inherited from defaultTransactionOptions", - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - }, - "maxCommitTimeMS": 60000 - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": 42 - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "startTransaction options override defaults", - "clientOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readConcern": { - "level": "snapshot" - }, - "writeConcern": { - "w": 1 - }, - "maxCommitTimeMS": 30000 - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": 42 - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "defaultTransactionOptions override client options", - "clientOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": 42 - }, - "writeConcern": null, - "maxTimeMS": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "readConcern local in defaultTransactionOptions", - "clientOptions": { - "w": 1 - }, - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readConcern": { - "level": "local" - } - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "result": { - "insertedId": 2 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - }, - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local", - "afterClusterTime": 42 - }, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": { - "w": 1 - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "client writeConcern ignored for bulk", - "clientOptions": { - "w": "majority" - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": 1 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ], - "session": "session0" - }, - "result": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "0": 1 - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": null, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": 1 - } - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "readPreference inherited from client", - "clientOptions": { - "readPreference": "secondary" - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "readPreference inherited from defaultTransactionOptions", - "clientOptions": { - "readPreference": "primary" - }, - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readPreference": { - "mode": "Secondary" - } - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "startTransaction overrides readPreference", - "clientOptions": { - "readPreference": "primary" - }, - "sessionOptions": { - "session0": { - "defaultTransactionOptions": { - "readPreference": { - "mode": "Primary" - } - } - } - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "readPreference": { - "mode": "Secondary" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "result": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "commitTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "commitTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/source/transactions/tests/legacy/update.json b/source/transactions/tests/legacy/update.json deleted file mode 100644 index df2c480e5f..0000000000 --- a/source/transactions/tests/legacy/update.json +++ /dev/null @@ -1,443 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "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" - } - } - ] - } - ] -} diff --git a/source/transactions/tests/legacy/write-concern.json b/source/transactions/tests/legacy/write-concern.json deleted file mode 100644 index 5d17f741ee..0000000000 --- a/source/transactions/tests/legacy/write-concern.json +++ /dev/null @@ -1,1279 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.0", - "topology": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topology": [ - "sharded", - "load-balanced" - ] - } - ], - "database_name": "transaction-tests", - "collection_name": "test", - "data": [ - { - "_id": 0 - } - ], - "tests": [ - { - "description": "commit with majority", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "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" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0 - }, - { - "_id": 1 - } - ] - } - } - }, - { - "description": "commit with default", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "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": 0 - }, - { - "_id": 1 - } - ] - } - } - }, - { - "description": "abort with majority", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0 - } - ] - } - } - }, - { - "description": "abort with default", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "database_name": "transaction-tests" - } - }, - { - "command_started_event": { - "command": { - "abortTransaction": 1, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": null, - "autocommit": false, - "writeConcern": null - }, - "command_name": "abortTransaction", - "database_name": "admin" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0 - } - ] - } - } - }, - { - "description": "start with unacknowledged write concern", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "arguments": { - "options": { - "writeConcern": { - "w": 0 - } - } - }, - "result": { - "errorContains": "transactions do not support unacknowledged write concern" - } - } - ] - }, - { - "description": "start with implicit unacknowledged write concern", - "clientOptions": { - "w": 0 - }, - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "result": { - "errorContains": "transactions do not support unacknowledged write concern" - } - } - ] - }, - { - "description": "unacknowledged write concern coll insertOne", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "result": { - "insertedId": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "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": 0 - }, - { - "_id": 1 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll insertMany", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertMany", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - }, - "result": { - "insertedIds": { - "0": 1, - "1": 2 - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "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": 0 - }, - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll bulkWrite", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "bulkWrite", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ] - }, - "result": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "0": 1 - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "insert", - "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": 0 - }, - { - "_id": 1 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll deleteOne", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "deleteOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 0 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "delete", - "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": [] - } - } - }, - { - "description": "unacknowledged write concern coll deleteMany", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "deleteMany", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "result": { - "deletedCount": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 0 - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "delete", - "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": [] - } - } - }, - { - "description": "unacknowledged write concern coll updateOne", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateOne", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 0 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": true - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "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": 0, - "x": 1 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll updateMany", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateMany", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 0 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": true - } - ], - "ordered": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "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": 0, - "x": 1 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll findOneAndDelete", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndDelete", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "result": { - "_id": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "remove": true, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "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": [] - } - } - }, - { - "description": "unacknowledged write concern coll findOneAndReplace", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndReplace", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "result": { - "_id": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "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": 0, - "x": 1 - } - ] - } - } - }, - { - "description": "unacknowledged write concern coll findOneAndUpdate", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 0 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": "session0", - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": null, - "writeConcern": null - }, - "command_name": "findAndModify", - "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": 0, - "x": 1 - } - ] - } - } - } - ] -} From 1d3730c80b700b3685ee9004fdb6b302f7b150cb Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 14:35:20 -0500 Subject: [PATCH 02/55] Batch convert legacy spec files --- source/transactions/tests/unified/bulk.yml | 430 ++++ .../tests/unified/causal-consistency.yml | 274 +++ source/transactions/tests/unified/commit.yml | 820 +++++++ source/transactions/tests/unified/count.yml | 117 + .../tests/unified/create-collection.yml | 200 ++ .../tests/unified/create-index.yml | 223 ++ source/transactions/tests/unified/delete.yml | 282 +++ .../unified/error-labels-blockConnection.yml | 166 ++ .../unified/error-labels-errorLabels.yml | 293 +++ .../tests/unified/error-labels.yml | 1525 ++++++++++++ .../tests/unified/errors-client.yml | 103 + source/transactions/tests/unified/errors.yml | 194 ++ .../tests/unified/findOneAndDelete.yml | 210 ++ .../tests/unified/findOneAndReplace.yml | 236 ++ .../tests/unified/findOneAndUpdate.yml | 362 +++ source/transactions/tests/unified/insert.yml | 566 +++++ .../transactions/tests/unified/isolation.yml | 192 ++ .../tests/unified/mongos-pin-auto.yml | 2116 +++++++++++++++++ .../mongos-recovery-token-errorLabels.yml | 150 ++ .../tests/unified/mongos-recovery-token.yml | 359 +++ .../transactions/tests/unified/pin-mongos.yml | 708 ++++++ .../tests/unified/read-concern.yml | 798 +++++++ .../transactions/tests/unified/read-pref.yml | 476 ++++ source/transactions/tests/unified/reads.yml | 352 +++ .../unified/retryable-abort-errorLabels.yml | 1656 +++++++++++++ .../tests/unified/retryable-abort.yml | 392 +++ ...e-commit-errorLabels-forbid_serverless.yml | 240 ++ .../unified/retryable-commit-errorLabels.yml | 1516 ++++++++++++ .../retryable-commit-forbid_serverless.yml | 395 +++ .../tests/unified/retryable-commit.yml | 219 ++ .../tests/unified/retryable-writes.yml | 324 +++ .../tests/unified/run-command.yml | 270 +++ .../unified/transaction-options-repl.yml | 176 ++ .../tests/unified/transaction-options.yml | 1029 ++++++++ source/transactions/tests/unified/update.yml | 378 +++ .../tests/unified/write-concern.yml | 853 +++++++ 36 files changed, 18600 insertions(+) create mode 100644 source/transactions/tests/unified/bulk.yml create mode 100644 source/transactions/tests/unified/causal-consistency.yml create mode 100644 source/transactions/tests/unified/commit.yml create mode 100644 source/transactions/tests/unified/count.yml create mode 100644 source/transactions/tests/unified/create-collection.yml create mode 100644 source/transactions/tests/unified/create-index.yml create mode 100644 source/transactions/tests/unified/delete.yml create mode 100644 source/transactions/tests/unified/error-labels-blockConnection.yml create mode 100644 source/transactions/tests/unified/error-labels-errorLabels.yml create mode 100644 source/transactions/tests/unified/error-labels.yml create mode 100644 source/transactions/tests/unified/errors-client.yml create mode 100644 source/transactions/tests/unified/errors.yml create mode 100644 source/transactions/tests/unified/findOneAndDelete.yml create mode 100644 source/transactions/tests/unified/findOneAndReplace.yml create mode 100644 source/transactions/tests/unified/findOneAndUpdate.yml create mode 100644 source/transactions/tests/unified/insert.yml create mode 100644 source/transactions/tests/unified/isolation.yml create mode 100644 source/transactions/tests/unified/mongos-pin-auto.yml create mode 100644 source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml create mode 100644 source/transactions/tests/unified/mongos-recovery-token.yml create mode 100644 source/transactions/tests/unified/pin-mongos.yml create mode 100644 source/transactions/tests/unified/read-concern.yml create mode 100644 source/transactions/tests/unified/read-pref.yml create mode 100644 source/transactions/tests/unified/reads.yml create mode 100644 source/transactions/tests/unified/retryable-abort-errorLabels.yml create mode 100644 source/transactions/tests/unified/retryable-abort.yml create mode 100644 source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml create mode 100644 source/transactions/tests/unified/retryable-commit-errorLabels.yml create mode 100644 source/transactions/tests/unified/retryable-commit-forbid_serverless.yml create mode 100644 source/transactions/tests/unified/retryable-commit.yml create mode 100644 source/transactions/tests/unified/retryable-writes.yml create mode 100644 source/transactions/tests/unified/run-command.yml create mode 100644 source/transactions/tests/unified/transaction-options-repl.yml create mode 100644 source/transactions/tests/unified/transaction-options.yml create mode 100644 source/transactions/tests/unified/update.yml create mode 100644 source/transactions/tests/unified/write-concern.yml diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml new file mode 100644 index 0000000000..935048e484 --- /dev/null +++ b/source/transactions/tests/unified/bulk.yml @@ -0,0 +1,430 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulk +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: bulk + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectResult: + deletedCount: 1 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + insertOne: + document: + _id: 1 + - + updateOne: + filter: + _id: 1 + update: + $set: + x: 1 + - + updateOne: + filter: + _id: 2 + update: + $set: + x: 2 + upsert: true + - + insertOne: + document: + _id: 3 + - + insertOne: + document: + _id: 4 + - + insertOne: + document: + _id: 5 + - + insertOne: + document: + _id: 6 + - + insertOne: + document: + _id: 7 + - + replaceOne: + filter: + _id: 1 + replacement: + 'y': 1 + - + replaceOne: + filter: + _id: 2 + replacement: + 'y': 2 + - + deleteOne: + filter: + _id: 3 + - + deleteOne: + filter: + _id: 4 + - + updateMany: + filter: + _id: + $gte: 2 + update: + $set: + z: 1 + - + deleteMany: + filter: + _id: + $gte: 6 + expectResult: + deletedCount: 4 + insertedCount: 6 + insertedIds: + $$unsetOrMatches: + '0': 1 + '3': 3 + '4': 4 + '5': 5 + '6': 6 + '7': 7 + matchedCount: 7 + modifiedCount: 7 + upsertedCount: 1 + upsertedIds: + '2': 2 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 1 + limit: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + $set: { x: 1 } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: + _id: 2 + u: + $set: { x: 2 } + upsert: true + multi: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + - + _id: 4 + - + _id: 5 + - + _id: 6 + - + _id: 7 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + 'y': 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: + _id: 2 + u: + 'y': 2 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 3 + limit: 1 + - + q: + _id: 4 + limit: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: { $gte: 2 } + u: + $set: { z: 1 } + multi: true + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: { $gte: 6 } + limit: 0 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': 1 + - + _id: 2 + 'y': 2 + z: 1 + - + _id: 5 + z: 1 diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml new file mode 100644 index 0000000000..a170e044d5 --- /dev/null +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -0,0 +1,274 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: causal-consistency +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + count: 0 +tests: + - + description: 'causal consistency' + clientOptions: + retryWrites: false + operations: + - &updateOne + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + count: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - + object: *session0 + name: startTransaction + - *updateOne + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + $inc: { count: 1 } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $$exists: false + startTransaction: + $$exists: false + autocommit: + $$exists: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + $inc: { count: 1 } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + count: 2 + - + description: 'causal consistency disabled' + clientOptions: + retryWrites: false + sessionOptions: + session0: + causalConsistency: false + operations: + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + count: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $$exists: false + autocommit: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + $inc: { count: 1 } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + count: 1 + - + _id: 2 diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml new file mode 100644 index 0000000000..20a1869eb5 --- /dev/null +++ b/source/transactions/tests/unified/commit.yml @@ -0,0 +1,820 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: commit +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: commit + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + description: 'rerun commit after empty transaction' + operations: + - + object: *session0 + name: startTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'multiple commits in a row' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'write concern error on commit' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: 10 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - TransientTransactionError + - UnknownTransactionCommitResult + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commit without start' + operations: + - + object: *session0 + name: commitTransaction + expectError: + errorContains: 'no transaction started' + expectEvents: + - + client: *client0 + events: [] + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'commit after no-op abort' + operations: + - + object: *session0 + name: startTransaction + - + object: *session0 + name: abortTransaction + - + object: *session0 + name: commitTransaction + expectError: + errorContains: 'Cannot call commitTransaction after calling abortTransaction' + expectEvents: + - + client: *client0 + events: [] + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'commit after abort' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + - + object: *session0 + name: commitTransaction + expectError: + errorContains: 'Cannot call commitTransaction after calling abortTransaction' + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + description: 'multiple commits after empty transaction' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + - + object: *session0 + name: startTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'reset session state commit' + clientOptions: + retryWrites: false + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: commitTransaction + expectError: + errorContains: 'no transaction started' + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $$exists: false + startTransaction: + $$exists: false + autocommit: + $$exists: false + commandName: insert + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + description: 'reset session state abort' + clientOptions: + retryWrites: false + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: abortTransaction + expectError: + errorContains: 'no transaction started' + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $$exists: false + startTransaction: + $$exists: false + autocommit: + $$exists: false + commandName: insert + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml new file mode 100644 index 0000000000..90e45c4a6e --- /dev/null +++ b/source/transactions/tests/unified/count.yml @@ -0,0 +1,117 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: count +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.0.2 + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 +tests: + - + description: count + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: count + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorCodeName: OperationNotSupportedInTransaction + errorLabelsOmit: + - TransientTransactionError + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + count: *collection_name + query: + _id: 1 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: count + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data \ No newline at end of file diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml new file mode 100644 index 0000000000..330db1201e --- /dev/null +++ b/source/transactions/tests/unified/create-collection.yml @@ -0,0 +1,200 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: create-collection +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.4 + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'explicitly create collection using create command' + operations: + - + object: *database0 + name: dropCollection + arguments: + collection: *collection_name + - + object: *session0 + name: startTransaction + - + object: *database0 + name: createCollection + arguments: + session: *session0 + collection: *collection_name + - + object: testRunner + name: assertCollectionNotExists + arguments: + database: *database_name + collection: *collection_name + - + object: *session0 + name: commitTransaction + - + object: testRunner + name: assertCollectionExists + arguments: + database: *database_name + collection: *collection_name + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + drop: *collection_name + writeConcern: + $$exists: false + commandName: drop + databaseName: *database_name + - + commandStartedEvent: + command: + create: *collection_name + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: create + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + description: 'implicitly create collection using insert' + operations: + - + object: *database0 + name: dropCollection + arguments: + collection: *collection_name + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: testRunner + name: assertCollectionNotExists + arguments: + database: *database_name + collection: *collection_name + - + object: *session0 + name: commitTransaction + - + object: testRunner + name: assertCollectionExists + arguments: + database: *database_name + collection: *collection_name + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + drop: *collection_name + writeConcern: + $$exists: false + commandName: drop + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml new file mode 100644 index 0000000000..f5375b6be4 --- /dev/null +++ b/source/transactions/tests/unified/create-index.yml @@ -0,0 +1,223 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: create-index +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.4 + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'create index on a non-existing collection' + operations: + - + object: *database0 + name: dropCollection + arguments: + collection: *collection_name + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: createIndex + arguments: + session: *session0 + name: &index_name t_1 + keys: + x: 1 + - + object: testRunner + name: assertIndexNotExists + arguments: + database: *database_name + collection: *collection_name + index: *index_name + - + object: *session0 + name: commitTransaction + - + object: testRunner + name: assertIndexExists + arguments: + database: *database_name + collection: *collection_name + index: *index_name + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + drop: *collection_name + writeConcern: + $$exists: false + commandName: drop + databaseName: *database_name + - + commandStartedEvent: + command: + createIndexes: *collection_name + indexes: + - + name: *index_name + key: + x: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: createIndexes + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + description: 'create index on a collection created within the same transaction' + operations: + - + object: *database0 + name: dropCollection + arguments: + collection: *collection_name + - + object: *session0 + name: startTransaction + - + object: *database0 + name: createCollection + arguments: + session: *session0 + collection: *collection_name + - + object: *collection0 + name: createIndex + arguments: + session: *session0 + name: *index_name + keys: + x: 1 + - + object: testRunner + name: assertIndexNotExists + arguments: + database: *database_name + collection: *collection_name + index: *index_name + - + object: *session0 + name: commitTransaction + - + object: testRunner + name: assertIndexExists + arguments: + database: *database_name + collection: *collection_name + index: *index_name + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + drop: *collection_name + writeConcern: + $$exists: false + commandName: drop + databaseName: *database_name + - + commandStartedEvent: + command: + create: *collection_name + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: create + databaseName: *database_name + - + commandStartedEvent: + command: + createIndexes: *collection_name + indexes: + - + name: *index_name + key: + x: 1 + lsid: + $$sessionLsid: *session0 + writeConcern: + $$exists: false + commandName: createIndexes + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml new file mode 100644 index 0000000000..ad116171c1 --- /dev/null +++ b/source/transactions/tests/unified/delete.yml @@ -0,0 +1,282 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: delete +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + _id: 5 +tests: + - + description: delete + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectResult: + deletedCount: 1 + - + object: *collection0 + name: deleteMany + arguments: + session: *session0 + filter: + _id: + $lte: 3 + expectResult: + deletedCount: 2 + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 4 + expectResult: + deletedCount: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 1 + limit: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: { $lte: 3 } + limit: 0 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 4 + limit: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 5 + - + description: 'collection writeConcern ignored for delete' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectResult: + deletedCount: 1 + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: deleteMany + arguments: + session: *session0 + filter: + _id: + $lte: 3 + expectResult: + deletedCount: 2 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 1 + limit: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: { $lte: 3 } + limit: 0 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml new file mode 100644 index 0000000000..5dde2f6340 --- /dev/null +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -0,0 +1,166 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: error-labels-blockConnection +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.2' + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors' + clientOptions: + socketTimeoutMS: 100 + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + blockConnection: true + blockTimeMS: 150 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml new file mode 100644 index 0000000000..f99fce83e9 --- /dev/null +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -0,0 +1,293 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: error-labels-errorLabels +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.1 + serverless: forbid + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + errorCode: 11602 + errorLabels: + - RetryableWriteError + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 91 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml new file mode 100644 index 0000000000..4c391dfe32 --- /dev/null +++ b/source/transactions/tests/unified/error-labels.yml @@ -0,0 +1,1525 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: error-labels +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'DuplicateKey errors do not contain transient label' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertMany + arguments: + session: *session0 + documents: + - + _id: 1 + - + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - UnknownTransactionCommitResult + errorContains: E11000 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'NotWritablePrimary errors contain transient label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 10107 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'WriteConflict errors contain transient label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 112 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'NoSuchTransaction errors contain transient label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 251 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'NoSuchTransaction errors on commit contain transient label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 251 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'add TransientTransactionError label to connection errors, but do not add RetryableWriteError label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 4 + data: + failCommands: + - insert + - find + - aggregate + - distinct + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: &transient_label_only + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + - + object: *collection0 + name: find + arguments: + session: *session0 + expectResult: *transient_label_only + - + object: *collection0 + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + session: *session0 + expectResult: *transient_label_only + - + object: *collection0 + name: distinct + arguments: + fieldName: _id + session: *session0 + expectResult: *transient_label_only + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: { } + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: distinct + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + writeConcernError: + code: 91 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsContain: [] + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 64 + errmsg: 'multiple errors reported' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - UnknownTransactionCommitResult + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 64 + codeName: WriteConcernFailed + errmsg: 'waiting for replication timed out' + errInfo: + wtimeout: true + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - UnknownTransactionCommitResult + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 100 + errmsg: 'Not enough data-bearing nodes' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - UnknownTransactionCommitResult + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 79 + errmsg: "No write concern mode named 'blah' found in replica set configuration" + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - RetryableWriteConcern + - TransientTransactionError + - UnknownTransactionCommitResult + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + errorCode: 50 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + maxTimeMS: 60000 + session: *session0 + expectError: + errorLabelsOmit: + - RetryableWriteError + - UnknownTransactionCommitResult + - TransientTransactionError + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: { } + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + autocommit: false + maxTimeMS: 60000 + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'add UnknownTransactionCommitResult label to MaxTimeMSExpired' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 50 + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + maxCommitTimeMS: 60000 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - UnknownTransactionCommitResult + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 50 + errmsg: 'operation exceeded time limit' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + maxCommitTimeMS: 60000 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - UnknownTransactionCommitResult + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/errors-client.yml b/source/transactions/tests/unified/errors-client.yml new file mode 100644 index 0000000000..823a100992 --- /dev/null +++ b/source/transactions/tests/unified/errors-client.yml @@ -0,0 +1,103 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: errors-client +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'Client side error in command starting transaction' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + x: 1 + expectError: + isError: true + - + object: testRunner + name: assertSessionTransactionState + arguments: + session: *session0 + state: starting + - + description: 'Client side error when transaction is in progress' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + x: 1 + expectError: + isError: true + - + object: testRunner + name: assertSessionTransactionState + arguments: + session: *session0 + state: in_progress diff --git a/source/transactions/tests/unified/errors.yml b/source/transactions/tests/unified/errors.yml new file mode 100644 index 0000000000..f743007f7d --- /dev/null +++ b/source/transactions/tests/unified/errors.yml @@ -0,0 +1,194 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: errors +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'start insert start' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: startTransaction + expectError: + errorContains: 'transaction already in progress' + - + object: *session0 + name: commitTransaction + - + description: 'start twice' + operations: + - + object: *session0 + name: startTransaction + - + object: *session0 + name: startTransaction + expectError: + errorContains: 'transaction already in progress' + - + description: 'commit and start twice' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *session0 + name: startTransaction + expectError: + errorContains: 'transaction already in progress' + - + description: 'write conflict commit' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectError: + errorCodeName: WriteConflict + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - + object: *session0 + name: commitTransaction + - + object: *session1 + name: commitTransaction + expectError: + errorCodeName: NoSuchTransaction + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - + description: 'write conflict abort' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectError: + errorCodeName: WriteConflict + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - + object: *session0 + name: commitTransaction + - + object: *session1 + name: abortTransaction diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml new file mode 100644 index 0000000000..24e754a769 --- /dev/null +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -0,0 +1,210 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 +tests: + - + description: findOneAndDelete + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 3 + expectResult: + _id: 3 + - + object: *collection0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 4 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + remove: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 4 + remove: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + description: 'collection writeConcern ignored for findOneAndDelete' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 3 + expectResult: + _id: 3 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + remove: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml new file mode 100644 index 0000000000..3c8e256ca4 --- /dev/null +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -0,0 +1,236 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 +tests: + - + description: findOneAndReplace + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 3 + replacement: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + - + object: *collection0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 4 + replacement: + x: 1 + upsert: true + returnDocument: After + expectResult: + _id: 4 + x: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 4 + update: + x: 1 + new: true + upsert: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + x: 1 + - + _id: 4 + x: 1 + - + description: 'collection writeConcern ignored for findOneAndReplace' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 3 + replacement: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml new file mode 100644 index 0000000000..46d57069a4 --- /dev/null +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -0,0 +1,362 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 +tests: + - + description: findOneAndUpdate + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 3 + update: + $inc: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 4 + update: + $inc: + x: 1 + upsert: true + returnDocument: After + expectResult: + _id: 4 + x: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 3 + update: + $inc: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + x: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 3 + update: + $inc: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + x: 2 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + $inc: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 4 + update: + $inc: + x: 1 + new: true + upsert: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + $inc: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + $inc: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: true + autocommit: false + readConcern: + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + x: 2 + - + _id: 4 + x: 1 + - + description: 'collection writeConcern ignored for findOneAndUpdate' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 3 + update: + $inc: + x: 1 + returnDocument: Before + expectResult: + _id: 3 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 3 + update: + $inc: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml new file mode 100644 index 0000000000..de426087c8 --- /dev/null +++ b/source/transactions/tests/unified/insert.yml @@ -0,0 +1,566 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: insert +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: insert + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: insertMany + arguments: + documents: + - + _id: 2 + - + _id: 3 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 2 + '1': 3 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 4 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 5 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 5 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + - + _id: 3 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 5 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + _id: 5 + - + description: 'insert with session1' + operations: + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: insertMany + arguments: + documents: + - + _id: 2 + - + _id: 3 + session: *session1 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 2 + '1': 3 + - + object: *session1 + name: commitTransaction + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 4 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 4 + - + object: *session1 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session1 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + - + _id: 3 + ordered: true + lsid: + $$sessionLsid: *session1 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session1 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session1 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session1 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + description: 'collection writeConcern without transaction' + clientOptions: + retryWrites: false + operations: + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $$exists: false + startTransaction: + $$exists: false + autocommit: + $$exists: false + writeConcern: + w: majority + commandName: insert + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'collection writeConcern ignored for insert' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: insertMany + arguments: + documents: + - + _id: 2 + - + _id: 3 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 2 + '1': 3 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + - + _id: 3 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 diff --git a/source/transactions/tests/unified/isolation.yml b/source/transactions/tests/unified/isolation.yml new file mode 100644 index 0000000000..af8b721501 --- /dev/null +++ b/source/transactions/tests/unified/isolation.yml @@ -0,0 +1,192 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: isolation +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'one transaction' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectResult: + - + _id: 1 + - + object: *collection0 + name: find + arguments: + session: *session1 + filter: + _id: 1 + expectResult: [] + - + object: *collection0 + name: find + arguments: + filter: + _id: 1 + expectResult: [] + - + object: *session0 + name: commitTransaction + - + object: *collection0 + name: find + arguments: + session: *session1 + filter: + _id: 1 + expectResult: + - + _id: 1 + - + object: *collection0 + name: find + arguments: + filter: + _id: 1 + expectResult: + - + _id: 1 + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'two transactions' + operations: + - + object: *session0 + name: startTransaction + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectResult: + - + _id: 1 + - + object: *collection0 + name: find + arguments: + session: *session1 + filter: + _id: 1 + expectResult: [] + - + object: *collection0 + name: find + arguments: + filter: + _id: 1 + expectResult: [] + - + object: *session0 + name: commitTransaction + - + object: *collection0 + name: find + arguments: + session: *session1 + filter: + _id: 1 + expectResult: [] + - + object: *collection0 + name: find + arguments: + filter: + _id: 1 + expectResult: + - + _id: 1 + - + object: *session1 + name: commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/mongos-pin-auto.yml b/source/transactions/tests/unified/mongos-pin-auto.yml new file mode 100644 index 0000000000..ee2c3e1b7c --- /dev/null +++ b/source/transactions/tests/unified/mongos-pin-auto.yml @@ -0,0 +1,2116 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: mongos-pin-auto +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.1.8 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 1 + - + _id: 2 +tests: + - + description: 'remain pinned after non-transient Interrupted error on insertOne' + useMultipleMongoses: true + operations: + - &startTransaction + object: *session0 + name: startTransaction + - &initialCommand + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 3 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 11601 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsOmit: + - TransientTransactionError + - UnknownTransactionCommitResult + errorCodeName: Interrupted + - &assertSessionPinned + object: testRunner + name: assertSessionPinned + arguments: + session: *session0 + - &commitTransaction + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + description: 'unpin after transient error within a transaction' + useMultipleMongoses: true + operations: + - &startTransaction + object: *session0 + name: startTransaction + - &initialCommand + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 3 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - &assertSessionUnpinned + object: testRunner + name: assertSessionUnpinned + arguments: + session: *session0 + - &abortTransaction + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: abortTransaction + databaseName: admin + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: 'remain pinned after non-transient Interrupted error on insertOne insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 11601 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on insertMany insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 11601 + - + object: *collection0 + name: insertMany + arguments: + session: *session0 + documents: + - + _id: 4 + - + _id: 5 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on updateOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 11601 + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on replaceOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 11601 + - + object: *collection0 + name: replaceOne + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on updateMany update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 11601 + - + object: *collection0 + name: updateMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + update: + $set: + z: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on deleteOne delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 11601 + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on deleteMany delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 11601 + - + object: *collection0 + name: deleteMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 11601 + - + object: *collection0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 11601 + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + returnDocument: Before + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 11601 + - + object: *collection0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + returnDocument: Before + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on bulkWrite insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 11601 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + insertOne: + document: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on bulkWrite update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 11601 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + updateOne: + filter: + _id: 1 + update: + $set: + x: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on bulkWrite delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 11601 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + deleteOne: + filter: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on find find' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - find + errorCode: 11601 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on countDocuments aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + errorCode: 11601 + - + object: *collection0 + name: countDocuments + arguments: + session: *session0 + filter: { } + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on aggregate aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + errorCode: 11601 + - + object: *collection0 + name: aggregate + arguments: + session: *session0 + pipeline: [] + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on distinct distinct' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - distinct + errorCode: 11601 + - + object: *collection0 + name: distinct + arguments: + session: *session0 + fieldName: _id + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'remain pinned after non-transient Interrupted error on runCommand insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 11601 + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + commandName: insert + expectError: + errorLabelsOmit: + - TransientTransactionError + - *assertSessionPinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on insertOne insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on insertOne insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 91 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on insertMany insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *collection0 + name: insertMany + arguments: + session: *session0 + documents: + - + _id: 4 + - + _id: 5 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on insertMany insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 91 + - + object: *collection0 + name: insertMany + arguments: + session: *session0 + documents: + - + _id: 4 + - + _id: 5 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on updateOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + closeConnection: true + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on updateOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 91 + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on replaceOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + closeConnection: true + - + object: *collection0 + name: replaceOne + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on replaceOne update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 91 + - + object: *collection0 + name: replaceOne + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on updateMany update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + closeConnection: true + - + object: *collection0 + name: updateMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + update: + $set: + z: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on updateMany update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 91 + - + object: *collection0 + name: updateMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + update: + $set: + z: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on deleteOne delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + closeConnection: true + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on deleteOne delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 91 + - + object: *collection0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on deleteMany delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + closeConnection: true + - + object: *collection0 + name: deleteMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on deleteMany delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 91 + - + object: *collection0 + name: deleteMany + arguments: + session: *session0 + filter: + _id: + $gte: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on findOneAndDelete findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + closeConnection: true + - + object: *collection0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 91 + - + object: *collection0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on findOneAndUpdate findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + closeConnection: true + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + returnDocument: Before + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 91 + - + object: *collection0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 1 + update: + $inc: + x: 1 + returnDocument: Before + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on findOneAndReplace findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + closeConnection: true + - + object: *collection0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + returnDocument: Before + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - findAndModify + errorCode: 91 + - + object: *collection0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 1 + replacement: + 'y': 1 + returnDocument: Before + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on bulkWrite insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + insertOne: + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on bulkWrite insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 91 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + insertOne: + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on bulkWrite update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + closeConnection: true + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + updateOne: + filter: + _id: 1 + update: + $set: + x: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on bulkWrite update' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - update + errorCode: 91 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + updateOne: + filter: + _id: 1 + update: + $set: + x: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on bulkWrite delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + closeConnection: true + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + deleteOne: + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on bulkWrite delete' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - delete + errorCode: 91 + - + object: *collection0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + deleteOne: + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on find find' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - find + closeConnection: true + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on find find' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - find + errorCode: 91 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on countDocuments aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + closeConnection: true + - + object: *collection0 + name: countDocuments + arguments: + session: *session0 + filter: { } + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on countDocuments aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + errorCode: 91 + - + object: *collection0 + name: countDocuments + arguments: + session: *session0 + filter: { } + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on aggregate aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + closeConnection: true + - + object: *collection0 + name: aggregate + arguments: + session: *session0 + pipeline: [] + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on aggregate aggregate' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - aggregate + errorCode: 91 + - + object: *collection0 + name: aggregate + arguments: + session: *session0 + pipeline: [] + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on distinct distinct' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - distinct + closeConnection: true + - + object: *collection0 + name: distinct + arguments: + session: *session0 + fieldName: _id + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on distinct distinct' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - distinct + errorCode: 91 + - + object: *collection0 + name: distinct + arguments: + session: *session0 + fieldName: _id + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient connection error on runCommand insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + commandName: insert + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome + - + description: 'unpin after transient ShutdownInProgress error on runCommand insert' + useMultipleMongoses: true + operations: + - *startTransaction + - *initialCommand + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + errorCode: 91 + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + commandName: insert + expectError: + errorLabelsContain: + - TransientTransactionError + - *assertSessionUnpinned + - *abortTransaction + outcome: *outcome \ No newline at end of file diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml new file mode 100644 index 0000000000..4fc9f134f0 --- /dev/null +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -0,0 +1,150 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: mongos-recovery-token-errorLabels +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.1 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction retry succeeds on new mongos' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 91 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml new file mode 100644 index 0000000000..61d30c0367 --- /dev/null +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -0,0 +1,359 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: mongos-recovery-token +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.1.8 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction explicit retries include recoveryToken' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction retry fails on new mongos' + useMultipleMongoses: true + clientOptions: + heartbeatFrequencyMS: 30000 + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 7 + data: + failCommands: + - commitTransaction + - isMaster + - hello + closeConnection: true + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + errorCodeName: NoSuchTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction sends recoveryToken' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + closeConnection: true + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml new file mode 100644 index 0000000000..c41a838d1d --- /dev/null +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -0,0 +1,708 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: pin-mongos +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.1.8 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 1 + - + _id: 2 +tests: + - + description: countDocuments + useMultipleMongoses: true + operations: + - &startTransaction + object: *session0 + name: startTransaction + - &countDocuments + object: *collection0 + name: countDocuments + arguments: + filter: + _id: 2 + session: *session0 + expectResult: 1 + - *countDocuments + - *countDocuments + - *countDocuments + - *countDocuments + - *countDocuments + - *countDocuments + - *countDocuments + - &commitTransaction + object: *session0 + name: commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: distinct + useMultipleMongoses: true + operations: + - *startTransaction + - &distinct + object: *collection0 + name: distinct + arguments: + fieldName: _id + session: *session0 + expectResult: + - 1 + - 2 + - *distinct + - *distinct + - *distinct + - *distinct + - *distinct + - *distinct + - *distinct + - *commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: find + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - &find + object: *collection0 + name: find + arguments: + filter: + _id: 2 + session: *session0 + expectResult: + - + _id: 2 + - *find + - *find + - *find + - *find + - *find + - *find + - *find + - *commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: insertOne + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 3 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 4 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 5 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 5 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 6 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 6 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 7 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 7 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 8 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 8 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 9 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 9 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 10 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 10 + - *commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + _id: 5 + - + _id: 6 + - + _id: 7 + - + _id: 8 + - + _id: 9 + - + _id: 10 + - + description: 'mixed read write operations' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 3 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - &countDocuments + object: *collection0 + name: countDocuments + arguments: + filter: + _id: 3 + session: *session0 + expectResult: 1 + - *countDocuments + - *countDocuments + - *countDocuments + - *countDocuments + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 4 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 5 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 5 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 6 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 6 + - + object: *collection0 + name: insertOne + arguments: + document: + _id: 7 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 7 + - *commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + _id: 5 + - + _id: 6 + - + _id: 7 + - + description: 'multiple commits' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertMany + arguments: + documents: + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 3 + '1': 4 + - &assertSessionPinned + object: testRunner + name: assertSessionPinned + arguments: + session: *session0 + - *commitTransaction + - *assertSessionPinned + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *assertSessionPinned + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + description: 'remain pinned after non-transient error on commit' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertMany + arguments: + documents: + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 3 + '1': 4 + - *assertSessionPinned + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 51 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - TransientTransactionError + errorCode: 51 + - *assertSessionPinned + - + object: *session0 + name: commitTransaction + - *assertSessionPinned + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + - + description: 'unpin after transient error within a transaction' + useMultipleMongoses: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 3 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + description: 'unpin after transient error within a transaction and commit' + useMultipleMongoses: true + clientOptions: + heartbeatFrequencyMS: 30000 + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 3 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: + times: 7 + data: + failCommands: + - insert + - isMaster + - hello + closeConnection: true + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 4 + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + errorCodeName: NoSuchTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + recoveryToken: + $$exists: true + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml new file mode 100644 index 0000000000..8c5d79bad3 --- /dev/null +++ b/source/transactions/tests/unified/read-concern.yml @@ -0,0 +1,798 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: read-concern +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 +tests: + - + description: 'only first countDocuments includes readConcern' + operations: + - &startTransaction + object: *session0 + name: startTransaction + arguments: + readConcern: + level: majority + - &countDocuments + object: *collection0 + collectionOptions: + readConcern: + level: majority + name: countDocuments + arguments: + session: *session0 + filter: + _id: + $gte: 2 + expectResult: 3 + - *countDocuments + - &commitTransaction + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $match: + _id: { $gte: 2 } + - + $group: + _id: 1 + 'n': { $sum: 1 } + cursor: { } + lsid: + $$sessionLsid: *session0 + readConcern: + level: majority + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $match: + _id: { $gte: 2 } + - + $group: + _id: 1 + 'n': { $sum: 1 } + cursor: { } + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - &commitTransactionEvent + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: 'only first find includes readConcern' + operations: + - *startTransaction + - &find + object: *collection0 + collectionOptions: + readConcern: + level: majority + name: find + arguments: + session: *session0 + batchSize: 3 + expectResult: *data + - *find + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + level: majority + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - *commitTransactionEvent + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: 'only first aggregate includes readConcern' + operations: + - *startTransaction + - &aggregate + object: *collection0 + collectionOptions: + readConcern: + level: majority + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectResult: *data + - *aggregate + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + level: majority + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'only first distinct includes readConcern' + operations: + - *startTransaction + - &distinct + object: *collection0 + collectionOptions: + readConcern: + level: majority + name: distinct + arguments: + session: *session0 + fieldName: _id + expectResult: + - 1 + - 2 + - 3 + - 4 + - *distinct + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + level: majority + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: distinct + databaseName: *database_name + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: distinct + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'only first runCommand includes readConcern' + operations: + - *startTransaction + - &runCommand + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + find: *collection_name + commandName: find + - *runCommand + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + lsid: + $$sessionLsid: *session0 + readConcern: + level: majority + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: find + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'countDocuments ignores collection readConcern' + operations: + - &startTransactionNoReadConcern + object: *session0 + name: startTransaction + - *countDocuments + - *countDocuments + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $match: + _id: { $gte: 2 } + - + $group: + _id: 1 + 'n': { $sum: 1 } + cursor: { } + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $match: + _id: { $gte: 2 } + - + $group: + _id: 1 + 'n': { $sum: 1 } + cursor: { } + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'find ignores collection readConcern' + operations: + - *startTransactionNoReadConcern + - *find + - *find + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'aggregate ignores collection readConcern' + operations: + - *startTransactionNoReadConcern + - *aggregate + - *aggregate + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'distinct ignores collection readConcern' + operations: + - *startTransactionNoReadConcern + - *distinct + - *distinct + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: distinct + databaseName: *database_name + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: distinct + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome + - + description: 'runCommand ignores database readConcern' + operations: + - *startTransactionNoReadConcern + - + object: *database0 + databaseOptions: + readConcern: + level: majority + name: runCommand + arguments: + session: *session0 + command: + find: *collection_name + commandName: find + - *runCommand + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: find + databaseName: *database_name + - *commitTransactionEvent + outcome: *outcome \ No newline at end of file diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml new file mode 100644 index 0000000000..8606528726 --- /dev/null +++ b/source/transactions/tests/unified/read-pref.yml @@ -0,0 +1,476 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: read-pref +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'default readPreference' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertMany + arguments: + documents: &insertedDocs + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + '2': 3 + '3': 4 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: aggregate + arguments: + session: *session0 + pipeline: + - + $match: + _id: 1 + - + $count: count + expectResult: + - + count: 1 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: find + arguments: + session: *session0 + batchSize: 3 + expectResult: *insertedDocs + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectResult: *insertedDocs + - + object: *session0 + name: commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *insertedDocs + - + description: 'primary readPreference' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Primary + - + object: *collection0 + name: insertMany + arguments: + documents: &insertedDocs + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + '2': 3 + '3': 4 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: aggregate + arguments: + session: *session0 + pipeline: + - + $match: + _id: 1 + - + $count: count + expectResult: + - + count: 1 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: find + arguments: + session: *session0 + batchSize: 3 + expectResult: *insertedDocs + - + object: *collection0 + collectionOptions: + readPreference: + mode: Secondary + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectResult: *insertedDocs + - + object: *session0 + name: commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *insertedDocs + - + description: 'secondary readPreference' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Secondary + - + object: *collection0 + name: insertMany + arguments: + documents: &insertedDocs + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + '2': 3 + '3': 4 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + session: *session0 + pipeline: + - + $match: + _id: 1 + - + $count: count + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: find + arguments: + session: *session0 + batchSize: 3 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: abortTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'primaryPreferred readPreference' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: PrimaryPreferred + - + object: *collection0 + name: insertMany + arguments: + documents: &insertedDocs + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + '2': 3 + '3': 4 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + session: *session0 + pipeline: + - + $match: + _id: 1 + - + $count: count + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: find + arguments: + session: *session0 + batchSize: 3 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: abortTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'nearest readPreference' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Nearest + - + object: *collection0 + name: insertMany + arguments: + documents: &insertedDocs + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + '2': 3 + '3': 4 + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + session: *session0 + pipeline: + - + $match: + _id: 1 + - + $count: count + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: find + arguments: + session: *session0 + batchSize: 3 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *collection0 + collectionOptions: + readPreference: + mode: Primary + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: abortTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'secondary write only' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Secondary + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml new file mode 100644 index 0000000000..99f0e67b36 --- /dev/null +++ b/source/transactions/tests/unified/reads.yml @@ -0,0 +1,352 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: reads +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 1 + - + _id: 2 + - + _id: 3 + - + _id: 4 +tests: + - + description: 'collection readConcern without transaction' + operations: + - + object: *collection0 + collectionOptions: + readConcern: + level: majority + name: find + arguments: + session: *session0 + expectResult: *data + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + readConcern: + level: majority + lsid: + $$sessionLsid: *session0 + txnNumber: + $$exists: false + startTransaction: + $$exists: false + autocommit: + $$exists: false + commandName: find + databaseName: *database_name + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: find + operations: + - &startTransaction + object: *session0 + name: startTransaction + - &find + object: *collection0 + name: find + arguments: + session: *session0 + batchSize: 3 + expectResult: *data + - *find + - &commitTransaction + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + find: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: find + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: *outcome + - + description: aggregate + operations: + - *startTransaction + - &aggregate + object: *collection0 + name: aggregate + arguments: + pipeline: + - + $project: + _id: 1 + batchSize: 3 + session: *session0 + expectResult: *data + - *aggregate + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: + - + $project: + _id: 1 + cursor: + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: aggregate + databaseName: *database_name + - + commandStartedEvent: + command: + getMore: + $$type: long + collection: *collection_name + batchSize: 3 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + commandName: getMore + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: *outcome + - + description: distinct + operations: + - *startTransaction + - + object: *collection0 + name: distinct + arguments: + session: *session0 + fieldName: _id + expectResult: + - 1 + - 2 + - 3 + - 4 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + distinct: *collection_name + key: _id + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: distinct + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + readConcern: + $$exists: false + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: *outcome \ No newline at end of file diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml new file mode 100644 index 0000000000..00496b373a --- /dev/null +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -0,0 +1,1656 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-abort-errorLabels +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.1 + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'abortTransaction only retries once with RetryableWriteError from server' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - abortTransaction + errorCode: 112 + errorLabels: + - RetryableWriteError + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction does not retry without RetryableWriteError label' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 11600 + errorLabels: [] + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after NotWritablePrimary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 10107 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after NotPrimaryOrSecondary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 13436 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after NotPrimaryNoSecondaryOk' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 13435 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after InterruptedDueToReplStateChange' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 11602 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after InterruptedAtShutdown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 11600 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after PrimarySteppedDown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 189 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 91 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after HostNotFound' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 7 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after HostUnreachable' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 6 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after SocketException' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 9001 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after NetworkTimeout' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 89 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after WriteConcernError InterruptedAtShutdown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 11600 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 11602 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after WriteConcernError PrimarySteppedDown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 189 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after WriteConcernError ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 91 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml new file mode 100644 index 0000000000..e03c0c9fa4 --- /dev/null +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -0,0 +1,392 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-abort +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'abortTransaction only performs a single retry' + clientOptions: + retryWrites: false + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - abortTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction does not retry after Interrupted' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + errorCode: 11601 + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction does not retry after WriteConcernError Interrupted' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + writeConcernError: + code: 11601 + errmsg: 'operation was interrupted' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abortTransaction succeeds after connection error' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - abortTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml new file mode 100644 index 0000000000..9844f4ec43 --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -0,0 +1,240 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-commit-errorLabels-forbid_serverless +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.1 + serverless: forbid + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction succeeds after InterruptedAtShutdown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 11600 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 91 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml new file mode 100644 index 0000000000..9abec19ca1 --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -0,0 +1,1516 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-commit-errorLabels +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: 4.3.1 + topologies: + - replicaset + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction does not retry error without RetryableWriteError label' + clientOptions: + retryWrites: false + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 11600 + errorLabels: [] + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'commitTransaction retries once with RetryableWriteError from server' + clientOptions: + retryWrites: false + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 112 + errorLabels: + - RetryableWriteError + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after NotWritablePrimary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 10107 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after NotPrimaryOrSecondary' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 13436 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after NotPrimaryNoSecondaryOk' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 13435 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after InterruptedDueToReplStateChange' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 11602 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after PrimarySteppedDown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 189 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after HostNotFound' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 7 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after HostUnreachable' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 6 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after SocketException' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 9001 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after NetworkTimeout' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 89 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after WriteConcernError InterruptedAtShutdown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 11600 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 11602 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after WriteConcernError PrimarySteppedDown' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 189 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after WriteConcernError ShutdownInProgress' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorLabels: + - RetryableWriteError + writeConcernError: + code: 91 + errmsg: 'Replication is being shut down' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml new file mode 100644 index 0000000000..1211d18787 --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -0,0 +1,395 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-commit-forbid_serverless +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + serverless: forbid + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction fails after two errors' + clientOptions: + retryWrites: false + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction applies majority write concern on retries' + clientOptions: + retryWrites: false + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 2 + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: 2 + j: true + wtimeout: 5000 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: 2 + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'commitTransaction succeeds after connection error' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml new file mode 100644 index 0000000000..fb7922004d --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -0,0 +1,219 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-commit +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'commitTransaction fails after Interrupted' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + errorCode: 11601 + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorCodeName: Interrupted + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - UnknownTransactionCommitResult + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'commitTransaction is not retried after UnsatisfiableWriteConcern error' + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - commitTransaction + writeConcernError: + code: 100 + errmsg: 'Not enough data-bearing nodes' + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + expectError: + errorLabelsOmit: + - RetryableWriteError + - TransientTransactionError + - UnknownTransactionCommitResult + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml new file mode 100644 index 0000000000..313ff2f763 --- /dev/null +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -0,0 +1,324 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: retryable-writes +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'increment txnNumber' + clientOptions: + retryWrites: true + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 3 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 3 + - + object: *session0 + name: abortTransaction + - + object: *collection0 + name: insertMany + arguments: + documents: + - + _id: 4 + - + _id: 5 + session: *session0 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 4 + '1': 5 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 3 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '3' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 4 + - + _id: 5 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '4' + startTransaction: + $$exists: false + autocommit: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 4 + - + _id: 5 + - + description: 'writes are not retried' + clientOptions: + retryWrites: true + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - insert + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsContain: + - TransientTransactionError + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml new file mode 100644 index 0000000000..da5cad0c92 --- /dev/null +++ b/source/transactions/tests/unified/run-command.yml @@ -0,0 +1,270 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: run-command +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'run command with default read preference' + operations: + - + object: *session0 + name: startTransaction + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + commandName: insert + expectResult: + 'n': 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + description: 'run command with secondary read preference in client option and primary read preference in transaction options' + clientOptions: + readPreference: secondary + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Primary + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + commandName: insert + expectResult: + 'n': 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + description: 'run command with explicit primary read preference' + operations: + - + object: *session0 + name: startTransaction + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + insert: *collection_name + documents: + - + _id: 1 + readPreference: + mode: Primary + commandName: insert + expectResult: + 'n': 1 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + description: 'run command fails with explicit secondary read preference' + operations: + - + object: *session0 + name: startTransaction + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + find: *collection_name + readPreference: + mode: Secondary + commandName: find + expectError: + errorContains: 'read preference in a transaction must be primary' + - + description: 'run command fails with secondary read preference from transaction options' + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Secondary + - + object: *database0 + name: runCommand + arguments: + session: *session0 + command: + find: *collection_name + commandName: find + expectError: + errorContains: 'read preference in a transaction must be primary' diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml new file mode 100644 index 0000000000..c9a877bd8a --- /dev/null +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -0,0 +1,176 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: transaction-options-repl +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'readConcern snapshot in startTransaction options' + sessionOptions: + session0: + defaultTransactionOptions: + readConcern: + level: majority + operations: + - + object: *session0 + name: startTransaction + arguments: + readConcern: + level: snapshot + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + arguments: + readConcern: + level: snapshot + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: snapshot + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: snapshot + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml new file mode 100644 index 0000000000..0371698cb9 --- /dev/null +++ b/source/transactions/tests/unified/transaction-options.yml @@ -0,0 +1,1029 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: transaction-options +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: 'no transaction options set' + operations: &commitAbortOperations + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'transaction options inherited from client' + clientOptions: + w: 1 + readConcernLevel: local + operations: *commitAbortOperations + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: local + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + maxTimeMS: + $$exists: false + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: local + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + maxTimeMS: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: *outcome + - + description: 'transaction options inherited from defaultTransactionOptions' + sessionOptions: + session0: + defaultTransactionOptions: + readConcern: + level: majority + writeConcern: + w: 1 + maxCommitTimeMS: 60000 + operations: *commitAbortOperations + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: majority + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: majority + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + commandName: abortTransaction + databaseName: admin + outcome: *outcome + - + description: 'startTransaction options override defaults' + clientOptions: + readConcernLevel: local + w: 1 + sessionOptions: + session0: + defaultTransactionOptions: + readConcern: + level: snapshot + writeConcern: + w: 1 + maxCommitTimeMS: 30000 + operations: + - + object: *session0 + name: startTransaction + arguments: + readConcern: + level: majority + writeConcern: + w: majority + maxCommitTimeMS: 60000 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: startTransaction + arguments: + readConcern: + level: majority + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: majority + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: majority + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + maxTimeMS: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: *outcome + - + description: 'defaultTransactionOptions override client options' + clientOptions: + readConcernLevel: local + w: 1 + sessionOptions: + session0: + defaultTransactionOptions: + readConcern: + level: majority + writeConcern: + w: majority + maxCommitTimeMS: 60000 + operations: *commitAbortOperations + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: majority + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + maxTimeMS: 60000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: majority + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + maxTimeMS: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: majority + maxTimeMS: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: *outcome + - + description: 'readConcern local in defaultTransactionOptions' + clientOptions: + w: 1 + sessionOptions: + session0: + defaultTransactionOptions: + readConcern: + level: local + operations: *commitAbortOperations + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + level: local + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + readConcern: + level: local + afterClusterTime: + $$exists: true + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + w: 1 + commandName: abortTransaction + databaseName: admin + outcome: *outcome + - + description: 'client writeConcern ignored for bulk' + clientOptions: + w: majority + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: 1 + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + insertOne: + document: + _id: 1 + session: *session0 + expectResult: + deletedCount: 0 + insertedCount: 1 + insertedIds: + $$unsetOrMatches: + '0': 1 + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: 1 + commandName: commitTransaction + databaseName: admin + outcome: *outcome + - + description: 'readPreference inherited from client' + clientOptions: + readPreference: secondary + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'readPreference inherited from defaultTransactionOptions' + clientOptions: + readPreference: primary + sessionOptions: + session0: + defaultTransactionOptions: + readPreference: + mode: Secondary + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'startTransaction overrides readPreference' + clientOptions: + readPreference: primary + sessionOptions: + session0: + defaultTransactionOptions: + readPreference: + mode: Primary + operations: + - + object: *session0 + name: startTransaction + arguments: + readPreference: + mode: Secondary + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *collection0 + name: find + arguments: + session: *session0 + filter: + _id: 1 + expectError: + errorContains: 'read preference in a transaction must be primary' + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml new file mode 100644 index 0000000000..fb3c0a3c85 --- /dev/null +++ b/source/transactions/tests/unified/update.yml @@ -0,0 +1,378 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: update +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 +tests: + - + description: update + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 4 + update: + $inc: + x: 1 + upsert: true + expectResult: + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 1 + upsertedId: 4 + - + object: *collection0 + name: replaceOne + arguments: + session: *session0 + filter: + x: 1 + replacement: + 'y': 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - + object: *collection0 + name: updateMany + arguments: + session: *session0 + filter: + _id: + $gte: 3 + update: + $set: + z: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 4 + u: + $inc: { x: 1 } + upsert: true + multi: + $$unsetOrMatches: false + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + x: 1 + u: + 'y': 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: { $gte: 3 } + u: + $set: { z: 1 } + multi: true + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + _id: 2 + - + _id: 3 + z: 1 + - + _id: 4 + 'y': 1 + z: 1 + - + description: 'collections writeConcern ignored for update' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: updateOne + arguments: + session: *session0 + filter: + _id: 4 + update: + $inc: + x: 1 + upsert: true + expectResult: + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 1 + upsertedId: 4 + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: replaceOne + arguments: + session: *session0 + filter: + x: 1 + replacement: + 'y': 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - + object: *collection0 + collectionOptions: + writeConcern: + w: majority + name: updateMany + arguments: + session: *session0 + filter: + _id: + $gte: 3 + update: + $set: + z: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 4 + u: + $inc: { x: 1 } + upsert: true + multi: + $$unsetOrMatches: false + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + x: 1 + u: + 'y': 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: { $gte: 3 } + u: + $set: { z: 1 } + multi: true + upsert: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml new file mode 100644 index 0000000000..b065169464 --- /dev/null +++ b/source/transactions/tests/unified/write-concern.yml @@ -0,0 +1,853 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: write-concern +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: &data + - + _id: 0 +tests: + - + description: 'commit with majority' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - &commitTransaction + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - &insertOneEvent + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + - + _id: 1 + - + description: 'commit with default' + operations: + - &startTransaction + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - &commitWithDefaultWCEvent + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + - + _id: 1 + - + description: 'abort with majority' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: majority + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + w: majority + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: 'abort with default' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: *data + - + description: 'start with unacknowledged write concern' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: 0 + expectError: + errorContains: 'transactions do not support unacknowledged write concern' + - + description: 'start with implicit unacknowledged write concern' + clientOptions: + w: 0 + operations: + - + object: *session0 + name: startTransaction + expectError: + errorContains: 'transactions do not support unacknowledged write concern' + - + description: 'unacknowledged write concern coll insertOne' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - *insertOneEvent + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + - + _id: 1 + - + description: 'unacknowledged write concern coll insertMany' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: insertMany + arguments: + session: *session0 + documents: + - + _id: 1 + - + _id: 2 + expectResult: + $$unsetOrMatches: + insertedIds: + $$unsetOrMatches: + '0': 1 + '1': 2 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + - + _id: 2 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + - + _id: 1 + - + _id: 2 + - + description: 'unacknowledged write concern coll bulkWrite' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: bulkWrite + arguments: + session: *session0 + requests: + - + insertOne: + document: + _id: 1 + expectResult: + deletedCount: 0 + insertedCount: 1 + insertedIds: + $$unsetOrMatches: + '0': 1 + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - *insertOneEvent + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + - + _id: 1 + - + description: 'unacknowledged write concern coll deleteOne' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: deleteOne + arguments: + session: *session0 + filter: + _id: 0 + expectResult: + deletedCount: 1 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 0 + limit: 1 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'unacknowledged write concern coll deleteMany' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: deleteMany + arguments: + session: *session0 + filter: + _id: 0 + expectResult: + deletedCount: 1 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: + _id: 0 + limit: 0 + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: delete + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'unacknowledged write concern coll updateOne' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: updateOne + arguments: + session: *session0 + filter: + _id: 0 + update: + $inc: + x: 1 + upsert: true + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 0 + u: + $inc: { x: 1 } + upsert: true + multi: + $$unsetOrMatches: false + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + x: 1 + - + description: 'unacknowledged write concern coll updateMany' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: updateMany + arguments: + session: *session0 + filter: + _id: 0 + update: + $inc: + x: 1 + upsert: true + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 0 + u: + $inc: { x: 1 } + multi: true + upsert: true + ordered: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: update + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + x: 1 + - + description: 'unacknowledged write concern coll findOneAndDelete' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: findOneAndDelete + arguments: + session: *session0 + filter: + _id: 0 + expectResult: + _id: 0 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 0 + remove: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'unacknowledged write concern coll findOneAndReplace' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: findOneAndReplace + arguments: + session: *session0 + filter: + _id: 0 + replacement: + x: 1 + returnDocument: Before + expectResult: + _id: 0 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 0 + update: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + x: 1 + - + description: 'unacknowledged write concern coll findOneAndUpdate' + operations: + - *startTransaction + - + object: *collection0 + collectionOptions: + writeConcern: + w: 0 + name: findOneAndUpdate + arguments: + session: *session0 + filter: + _id: 0 + update: + $inc: + x: 1 + returnDocument: Before + expectResult: + _id: 0 + - *commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: + _id: 0 + update: + $inc: + x: 1 + new: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false + commandName: findAndModify + databaseName: *database_name + - *commitWithDefaultWCEvent + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 0 + x: 1 From 747f018558d286bbf52745a1bd5c23b05dac7ef6 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 14:36:35 -0500 Subject: [PATCH 03/55] write-concern.yml --- .../tests/legacy/write-concern.yml | 554 ------------------ .../tests/unified/write-concern.yml | 225 ++----- 2 files changed, 57 insertions(+), 722 deletions(-) delete mode 100644 source/transactions/tests/legacy/write-concern.yml diff --git a/source/transactions/tests/legacy/write-concern.yml b/source/transactions/tests/legacy/write-concern.yml deleted file mode 100644 index bafe87d9b6..0000000000 --- a/source/transactions/tests/legacy/write-concern.yml +++ /dev/null @@ -1,554 +0,0 @@ -# Assumes the default for transactions is the same as for all ops, tests -# setting the writeConcern to "majority". -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - _id: 0 - -tests: - - description: commit with majority - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - &commitTransaction - name: commitTransaction - object: session0 - - expectations: - - &insertOneEvent - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - <<: &transactionCommandArgs - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 0 - - _id: 1 - - - description: commit with default - - operations: - - &startTransaction - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - *commitTransaction - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - <<: *transactionCommandArgs - command_name: insert - database_name: *database_name - - &commitWithDefaultWCEvent - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 0 - - _id: 1 - - - description: abort with majority - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - <<: *transactionCommandArgs - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: *data - - - description: abort with default - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - <<: *transactionCommandArgs - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: *data - - - description: start with unacknowledged write concern - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: 0 - result: - # Client-side error. - errorContains: transactions do not support unacknowledged write concern - - - description: start with implicit unacknowledged write concern - - clientOptions: - w: 0 - - operations: - - name: startTransaction - object: session0 - result: - # Client-side error. - errorContains: transactions do not support unacknowledged write concern - - - description: unacknowledged write concern coll insertOne - - operations: - - *startTransaction - - name: insertOne - <<: &collection_w0 - object: collection - collectionOptions: - writeConcern: { w: 0 } - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - *commitTransaction - - expectations: - - *insertOneEvent - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - _id: 0 - - _id: 1 - - - description: unacknowledged write concern coll insertMany - - operations: - - *startTransaction - - name: insertMany - <<: *collection_w0 - arguments: - session: session0 - documents: - - _id: 1 - - _id: 2 - result: - insertedIds: {0: 1, 1: 2} - - *commitTransaction - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - - _id: 2 - ordered: true - <<: *transactionCommandArgs - command_name: insert - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - _id: 0 - - _id: 1 - - _id: 2 - - - description: unacknowledged write concern coll bulkWrite - - operations: - - *startTransaction - - name: bulkWrite - <<: *collection_w0 - arguments: - session: session0 - requests: - - name: insertOne - arguments: - document: {_id: 1} - result: - deletedCount: 0 - insertedCount: 1 - insertedIds: {0: 1} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - - *commitTransaction - - expectations: - - *insertOneEvent - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - _id: 0 - - _id: 1 - - - - description: unacknowledged write concern coll deleteOne - - operations: - - *startTransaction - - name: deleteOne - <<: *collection_w0 - arguments: - session: session0 - filter: - _id: 0 - result: - deletedCount: 1 - - *commitTransaction - - expectations: - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 0} - limit: 1 - ordered: true - <<: *transactionCommandArgs - command_name: delete - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: [] - - - description: unacknowledged write concern coll deleteMany - - operations: - - *startTransaction - - name: deleteMany - <<: *collection_w0 - arguments: - session: session0 - filter: - _id: 0 - result: - deletedCount: 1 - - *commitTransaction - - expectations: - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 0} - limit: 0 - ordered: true - <<: *transactionCommandArgs - command_name: delete - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: [] - - - description: unacknowledged write concern coll updateOne - - operations: - - *startTransaction - - name: updateOne - <<: *collection_w0 - arguments: - session: session0 - filter: {_id: 0} - update: - $inc: {x: 1} - upsert: true - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - - *commitTransaction - - expectations: - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 0} - u: {$inc: {x: 1}} - upsert: true - ordered: true - <<: *transactionCommandArgs - command_name: update - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - {_id: 0, x: 1} - - - description: unacknowledged write concern coll updateMany - - operations: - - *startTransaction - - name: updateMany - <<: *collection_w0 - arguments: - session: session0 - filter: {_id: 0} - update: - $inc: {x: 1} - upsert: true - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - - *commitTransaction - - expectations: - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 0} - u: {$inc: {x: 1}} - multi: true - upsert: true - ordered: true - <<: *transactionCommandArgs - command_name: update - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - {_id: 0, x: 1} - - - description: unacknowledged write concern coll findOneAndDelete - - operations: - - *startTransaction - - name: findOneAndDelete - <<: *collection_w0 - arguments: - session: session0 - filter: {_id: 0} - result: {_id: 0} - - *commitTransaction - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 0} - remove: True - <<: *transactionCommandArgs - command_name: findAndModify - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: [] - - - description: unacknowledged write concern coll findOneAndReplace - - operations: - - *startTransaction - - name: findOneAndReplace - <<: *collection_w0 - arguments: - session: session0 - filter: {_id: 0} - replacement: {x: 1} - returnDocument: Before - result: {_id: 0} - - *commitTransaction - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 0} - update: {x: 1} - new: false - <<: *transactionCommandArgs - command_name: findAndModify - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - {_id: 0, x: 1} - - - description: unacknowledged write concern coll findOneAndUpdate - - operations: - - *startTransaction - - name: findOneAndUpdate - <<: *collection_w0 - arguments: - session: session0 - filter: {_id: 0} - update: - $inc: {x: 1} - returnDocument: Before - result: {_id: 0} - - *commitTransaction - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 0} - update: {$inc: {x: 1}} - new: false - <<: *transactionCommandArgs - command_name: findAndModify - database_name: *database_name - - *commitWithDefaultWCEvent - - outcome: - collection: - data: - - {_id: 0, x: 1} diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index b065169464..f6b48f2e56 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -1,8 +1,10 @@ # This file was created automatically using mongodb-spec-converter. # Please review the generated file, then remove this notice. +# Assumes the default for transactions is the same as for all ops, tests +# setting the writeConcern to "majority". description: write-concern -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -21,12 +23,15 @@ createEntities: database: *database0 collectionName: &collection_name test - - session: - id: &session0 session0 - client: *client0 + collection: + id: &collection_w0 collection_w0 + database: *database0 + collectionName: &collection_name test + collectionOptions: + writeConcern: { w: 0 } - session: - id: &session1 session1 + id: &session0 session0 client: *client0 runOnRequirements: - @@ -81,16 +86,17 @@ tests: - _id: 1 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: &transactionCommandArgs + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + readConcern: + $$exists: false + writeConcern: + $$exists: false commandName: insert databaseName: *database_name - @@ -147,16 +153,7 @@ tests: - _id: 1 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: insert databaseName: *database_name - &commitWithDefaultWCEvent @@ -218,16 +215,7 @@ tests: - _id: 1 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: insert databaseName: *database_name - @@ -282,16 +270,7 @@ tests: - _id: 1 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: insert databaseName: *database_name - @@ -324,26 +303,35 @@ tests: writeConcern: w: 0 expectError: + isClientError: true errorContains: 'transactions do not support unacknowledged write concern' - description: 'start with implicit unacknowledged write concern' - clientOptions: - w: 0 operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: { w: 0 } + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction expectError: + isClientError: true errorContains: 'transactions do not support unacknowledged write concern' - description: 'unacknowledged write concern coll insertOne' operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: insertOne arguments: session: *session0 @@ -374,10 +362,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: insertMany arguments: session: *session0 @@ -407,16 +392,7 @@ tests: - _id: 2 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: insert databaseName: *database_name - *commitWithDefaultWCEvent @@ -436,10 +412,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: bulkWrite arguments: session: *session0 @@ -479,10 +452,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: deleteOne arguments: session: *session0 @@ -505,16 +475,7 @@ tests: _id: 0 limit: 1 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: delete databaseName: *database_name - *commitWithDefaultWCEvent @@ -528,10 +489,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: deleteMany arguments: session: *session0 @@ -554,16 +512,7 @@ tests: _id: 0 limit: 0 ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: delete databaseName: *database_name - *commitWithDefaultWCEvent @@ -577,10 +526,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: updateOne arguments: session: *session0 @@ -613,16 +559,7 @@ tests: multi: $$unsetOrMatches: false ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: update databaseName: *database_name - *commitWithDefaultWCEvent @@ -639,10 +576,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: updateMany arguments: session: *session0 @@ -674,16 +608,7 @@ tests: multi: true upsert: true ordered: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: update databaseName: *database_name - *commitWithDefaultWCEvent @@ -700,10 +625,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: findOneAndDelete arguments: session: *session0 @@ -723,16 +645,7 @@ tests: query: _id: 0 remove: true - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: findAndModify databaseName: *database_name - *commitWithDefaultWCEvent @@ -746,10 +659,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: findOneAndReplace arguments: session: *session0 @@ -774,16 +684,7 @@ tests: update: x: 1 new: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: findAndModify databaseName: *database_name - *commitWithDefaultWCEvent @@ -800,10 +701,7 @@ tests: operations: - *startTransaction - - object: *collection0 - collectionOptions: - writeConcern: - w: 0 + object: *collection_w0 name: findOneAndUpdate arguments: session: *session0 @@ -830,16 +728,7 @@ tests: $inc: x: 1 new: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: true - autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + <<: *transactionCommandArgs commandName: findAndModify databaseName: *database_name - *commitWithDefaultWCEvent From 099a2842f34a05f43058db2ba6eca98fa5d9e246 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 15:47:18 -0500 Subject: [PATCH 04/55] update.yml --- source/transactions/tests/legacy/update.yml | 246 ------------------- source/transactions/tests/unified/update.yml | 32 ++- 2 files changed, 15 insertions(+), 263 deletions(-) delete mode 100644 source/transactions/tests/legacy/update.yml diff --git a/source/transactions/tests/legacy/update.yml b/source/transactions/tests/legacy/update.yml deleted file mode 100644 index b6167ac611..0000000000 --- a/source/transactions/tests/legacy/update.yml +++ /dev/null @@ -1,246 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &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: *collection_name - updates: - - q: {_id: 4} - u: {$inc: {x: 1}} - upsert: true - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {x: 1} - u: {y: 1} - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: {$gte: 3}} - u: {$set: {z: 1}} - multi: true - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - 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: *collection_name - updates: - - q: {_id: 4} - u: {$inc: {x: 1}} - upsert: true - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {x: 1} - u: {y: 1} - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: {$gte: 3}} - u: {$set: {z: 1}} - multi: true - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index fb3c0a3c85..e3e470d47e 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: update -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -218,6 +214,17 @@ tests: - description: 'collections writeConcern ignored for update' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -225,10 +232,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection1 name: updateOne arguments: session: *session0 @@ -244,10 +248,7 @@ tests: upsertedCount: 1 upsertedId: 4 - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection1 name: replaceOne arguments: session: *session0 @@ -260,10 +261,7 @@ tests: modifiedCount: 1 upsertedCount: 0 - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection1 name: updateMany arguments: session: *session0 From 4a9c3e251a863c918e5653a89cce27eae85dcff1 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 16:15:28 -0500 Subject: [PATCH 05/55] transaction-options.yml and transaction-options-repl.yml --- .../tests/legacy/transaction-options-repl.yml | 117 --- .../tests/legacy/transaction-options.yml | 803 ------------------ .../unified/transaction-options-repl.yml | 43 +- .../tests/unified/transaction-options.yml | 565 +++++++++--- 4 files changed, 453 insertions(+), 1075 deletions(-) delete mode 100644 source/transactions/tests/legacy/transaction-options-repl.yml delete mode 100644 source/transactions/tests/legacy/transaction-options.yml diff --git a/source/transactions/tests/legacy/transaction-options-repl.yml b/source/transactions/tests/legacy/transaction-options-repl.yml deleted file mode 100644 index c1191c32b3..0000000000 --- a/source/transactions/tests/legacy/transaction-options-repl.yml +++ /dev/null @@ -1,117 +0,0 @@ -runOn: - - minServerVersion: "4.0" - topology: ["replicaset"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - - description: readConcern snapshot in startTransaction options - - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority # Overridden. - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readConcern: - level: snapshot - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - # Now test abort. - - name: startTransaction - object: session0 - arguments: - options: - readConcern: - level: snapshot - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: snapshot - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: snapshot - afterClusterTime: 42 - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/legacy/transaction-options.yml b/source/transactions/tests/legacy/transaction-options.yml deleted file mode 100644 index e64625c371..0000000000 --- a/source/transactions/tests/legacy/transaction-options.yml +++ /dev/null @@ -1,803 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: no transaction options set - - operations: &commitAbortOperations - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - # Now test abort. - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - maxTimeMS: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - afterClusterTime: 42 - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - maxTimeMS: - command_name: abortTransaction - database_name: admin - - outcome: &outcome - collection: - data: - - _id: 1 - - - description: transaction options inherited from client - - clientOptions: - w: 1 - readConcernLevel: local - - operations: *commitAbortOperations - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: local - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - maxTimeMS: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: local - afterClusterTime: 42 - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - maxTimeMS: - command_name: abortTransaction - database_name: admin - - outcome: *outcome - - - description: transaction options inherited from defaultTransactionOptions - - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority - writeConcern: - w: 1 - maxCommitTimeMS: 60000 - - operations: *commitAbortOperations - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: majority - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: majority - afterClusterTime: 42 - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - command_name: abortTransaction - database_name: admin - - outcome: *outcome - - - description: startTransaction options override defaults - - clientOptions: - readConcernLevel: local - w: 1 - - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: snapshot - writeConcern: - w: 1 - maxCommitTimeMS: 30000 - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readConcern: - level: majority - writeConcern: - w: majority - maxCommitTimeMS: 60000 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - name: startTransaction - object: session0 - arguments: - options: - readConcern: - level: majority - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: majority - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: majority - afterClusterTime: 42 - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - maxTimeMS: - command_name: abortTransaction - database_name: admin - - outcome: *outcome - - - description: defaultTransactionOptions override client options - - clientOptions: - readConcernLevel: local - w: 1 - - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority - writeConcern: - w: majority - maxCommitTimeMS: 60000 - - operations: *commitAbortOperations - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: majority - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: majority - afterClusterTime: 42 - writeConcern: - maxTimeMS: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - maxTimeMS: - command_name: abortTransaction - database_name: admin - - outcome: *outcome - - - description: readConcern local in defaultTransactionOptions - - clientOptions: - w: 1 - - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: local - - operations: *commitAbortOperations - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - level: local - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - level: local - afterClusterTime: 42 - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: 1 - command_name: abortTransaction - database_name: admin - - outcome: *outcome - - - description: client writeConcern ignored for bulk - - clientOptions: - w: majority - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: 1 - - name: bulkWrite - object: collection - arguments: - requests: - - name: insertOne - arguments: - document: {_id: 1} - session: session0 - result: - deletedCount: 0 - insertedCount: 1 - insertedIds: {0: 1} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - # No writeConcern. - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: 1 - command_name: commitTransaction - database_name: admin - - outcome: *outcome - - - description: readPreference inherited from client - - clientOptions: - readPreference: secondary - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: find - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - errorContains: read preference in a transaction must be primary - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: readPreference inherited from defaultTransactionOptions - - clientOptions: - readPreference: primary - - sessionOptions: - session0: - defaultTransactionOptions: - readPreference: - mode: Secondary - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: find - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - errorContains: read preference in a transaction must be primary - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: startTransaction overrides readPreference - - clientOptions: - readPreference: primary - - sessionOptions: - session0: - defaultTransactionOptions: - readPreference: - mode: Primary - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Secondary - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: find - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - errorContains: read preference in a transaction must be primary - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index c9a877bd8a..e576428b6a 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: transaction-options-repl -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -41,14 +37,20 @@ initialData: tests: - description: 'readConcern snapshot in startTransaction options' - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - session: + id: &session1 session1 + client: *client0 + sessionOptions: + defaultTransactionOptions: + readConcern: { level: majority } + - + object: *session1 name: startTransaction arguments: readConcern: @@ -57,7 +59,7 @@ tests: object: *collection0 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -65,10 +67,11 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction + # Now test abort - - object: *session0 + object: *session1 name: startTransaction arguments: readConcern: @@ -77,7 +80,7 @@ tests: object: *collection0 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 2 expectResult: @@ -85,7 +88,7 @@ tests: insertedId: $$unsetOrMatches: 2 - - object: *session0 + object: *session1 name: abortTransaction expectEvents: - @@ -100,7 +103,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -116,7 +119,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -137,7 +140,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -155,7 +158,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index 0371698cb9..d5d66fefc8 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: transaction-options -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -46,7 +42,7 @@ initialData: tests: - description: 'no transaction options set' - operations: &commitAbortOperations + operations: - object: *session0 name: startTransaction @@ -64,6 +60,7 @@ tests: - object: *session0 name: commitTransaction + # Now test abort - object: *session0 name: startTransaction @@ -177,13 +174,68 @@ tests: _id: 1 - description: 'transaction options inherited from client' - clientOptions: - w: 1 - readConcernLevel: local - operations: *commitAbortOperations + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readConcernLevel: local + w: 1 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: commitTransaction + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session1 + name: abortTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -194,7 +246,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -212,7 +264,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -235,7 +287,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -255,7 +307,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: @@ -272,15 +324,54 @@ tests: outcome: *outcome - description: 'transaction options inherited from defaultTransactionOptions' - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority - writeConcern: - w: 1 - maxCommitTimeMS: 60000 - operations: *commitAbortOperations + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - session: + id: &session1 session1 + client: *client0 + sessionOptions: + defaultTransactionOptions: + readConcern: { level: majority } + writeConcern: { w: 1 } + maxCommitTimeMS: 60000 + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: commitTransaction + - + object: *session1 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session1 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session1 + name: abortTransaction expectEvents: - client: *client0 @@ -294,7 +385,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -310,7 +401,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -332,7 +423,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -350,7 +441,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: @@ -365,20 +456,38 @@ tests: outcome: *outcome - description: 'startTransaction options override defaults' - clientOptions: - readConcernLevel: local - w: 1 - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: snapshot - writeConcern: - w: 1 - maxCommitTimeMS: 30000 operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readConcernLevel: local + w: 1 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + sessionOptions: + defaultTransactionOptions: + readConcern: { level: snapshot } + writeConcern: { w: 1 } + maxCommitTimeMS: 30000 + - + object: *session1 name: startTransaction arguments: readConcern: @@ -387,10 +496,10 @@ tests: w: majority maxCommitTimeMS: 60000 - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -398,10 +507,10 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction - - object: *session0 + object: *session1 name: startTransaction arguments: readConcern: @@ -409,10 +518,10 @@ tests: writeConcern: w: majority - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 2 expectResult: @@ -420,11 +529,11 @@ tests: insertedId: $$unsetOrMatches: 2 - - object: *session0 + object: *session1 name: abortTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -435,7 +544,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -453,7 +562,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -475,7 +584,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -495,7 +604,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: @@ -512,21 +621,73 @@ tests: outcome: *outcome - description: 'defaultTransactionOptions override client options' - clientOptions: - readConcernLevel: local - w: 1 - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: majority - writeConcern: - w: majority - maxCommitTimeMS: 60000 - operations: *commitAbortOperations + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readConcernLevel: local + w: 1 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + sessionOptions: + defaultTransactionOptions: + readConcern: { level: majority } + writeConcern: { w: majority } + maxCommitTimeMS: 60000 + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: commitTransaction + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session1 + name: abortTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -537,7 +698,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -555,7 +716,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -577,7 +738,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -597,7 +758,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: @@ -614,17 +775,70 @@ tests: outcome: *outcome - description: 'readConcern local in defaultTransactionOptions' - clientOptions: - w: 1 - sessionOptions: - session0: - defaultTransactionOptions: - readConcern: - level: local - operations: *commitAbortOperations + operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + w: 1 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + sessionOptions: + defaultTransactionOptions: + readConcern: { level: local } + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session1 + name: commitTransaction + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: + _id: 2 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 2 + - + object: *session1 + name: abortTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -635,7 +849,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -651,7 +865,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -672,7 +886,7 @@ tests: _id: 2 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true @@ -690,7 +904,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: @@ -705,17 +919,38 @@ tests: outcome: *outcome - description: 'client writeConcern ignored for bulk' - clientOptions: - w: majority operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + w: majority + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction arguments: writeConcern: w: 1 - - object: *collection0 + object: *collection1 name: bulkWrite arguments: requests: @@ -723,7 +958,7 @@ tests: insertOne: document: _id: 1 - session: *session0 + session: *session1 expectResult: deletedCount: 0 insertedCount: 1 @@ -735,11 +970,11 @@ tests: upsertedCount: 0 upsertedIds: { } - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -752,11 +987,12 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false + # No writeConcern writeConcern: $$exists: false commandName: insert @@ -766,7 +1002,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -779,17 +1015,38 @@ tests: outcome: *outcome - description: 'readPreference inherited from client' - clientOptions: - readPreference: secondary operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readPreference: secondary + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -797,20 +1054,20 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *collection0 + object: *collection1 name: find arguments: - session: *session0 + session: *session1 filter: _id: 1 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -821,7 +1078,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -837,7 +1094,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -858,22 +1115,41 @@ tests: _id: 1 - description: 'readPreference inherited from defaultTransactionOptions' - clientOptions: - readPreference: primary - sessionOptions: - session0: - defaultTransactionOptions: - readPreference: - mode: Secondary operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readPreference: primary + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + sessionOptions: + defaultTransactionOptions: + readPreference: { mode: secondary } + - + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -881,20 +1157,20 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *collection0 + object: *collection1 name: find arguments: - session: *session0 + session: *session1 filter: _id: 1 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -905,7 +1181,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -921,7 +1197,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -942,25 +1218,44 @@ tests: _id: 1 - description: 'startTransaction overrides readPreference' - clientOptions: - readPreference: primary - sessionOptions: - session0: - defaultTransactionOptions: - readPreference: - mode: Primary operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + readPreference: primary + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + sessionOptions: + defaultTransactionOptions: + readPreference: { mode: primary } + - + object: *session1 name: startTransaction arguments: readPreference: - mode: Secondary + mode: secondary - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -968,20 +1263,20 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *collection0 + object: *collection1 name: find arguments: - session: *session0 + session: *session1 filter: _id: 1 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -992,7 +1287,7 @@ tests: _id: 1 ordered: true lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -1008,7 +1303,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From 68d5d68cfaf790891ddf6f9701a867c0e8f42d22 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 16:32:45 -0500 Subject: [PATCH 06/55] run-command.yml --- .../transactions/tests/legacy/run-command.yml | 197 ------------------ .../tests/unified/run-command.yml | 40 ++-- 2 files changed, 26 insertions(+), 211 deletions(-) delete mode 100644 source/transactions/tests/legacy/run-command.yml diff --git a/source/transactions/tests/legacy/run-command.yml b/source/transactions/tests/legacy/run-command.yml deleted file mode 100644 index 62385a0f29..0000000000 --- a/source/transactions/tests/legacy/run-command.yml +++ /dev/null @@ -1,197 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: run command with default read preference - - operations: - - name: startTransaction - object: session0 - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - result: - n: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id : 1 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - - description: run command with secondary read preference in client option and primary read preference in transaction options - - clientOptions: - readPreference: secondary - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Primary - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - result: - n: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id : 1 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - - description: run command with explicit primary read preference - - operations: - - name: startTransaction - object: session0 - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - readPreference: - mode: Primary - result: - n: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id : 1 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - - description: run command fails with explicit secondary read preference - - operations: - - name: startTransaction - object: session0 - - name: runCommand - object: database - command_name: find - arguments: - session: session0 - command: - find: *collection_name - readPreference: - mode: Secondary - result: - errorContains: read preference in a transaction must be primary - - - description: run command fails with secondary read preference from transaction options - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Secondary - - name: runCommand - object: database - command_name: find - arguments: - session: session0 - command: - find: *collection_name - result: - errorContains: read preference in a transaction must be primary - diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index da5cad0c92..91a304b82d 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: run-command -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -106,20 +102,36 @@ tests: databaseName: admin - description: 'run command with secondary read preference in client option and primary read preference in transaction options' - clientOptions: - readPreference: secondary operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: { readPreference: secondary } + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction arguments: readPreference: mode: Primary - - object: *database0 + object: *database1 name: runCommand arguments: - session: *session0 + session: *session1 command: insert: *collection_name documents: @@ -129,11 +141,11 @@ tests: expectResult: 'n': 1 - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -145,7 +157,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -159,7 +171,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From d440a1180c5af6a0cf24411e845fa7ed8fa6b9ab Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:08:32 -0500 Subject: [PATCH 07/55] retryable-writes.yml --- .../tests/legacy/retryable-writes.yml | 216 ------------------ .../tests/unified/retryable-writes.yml | 8 - 2 files changed, 224 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-writes.yml diff --git a/source/transactions/tests/legacy/retryable-writes.yml b/source/transactions/tests/legacy/retryable-writes.yml deleted file mode 100644 index 20eea86a42..0000000000 --- a/source/transactions/tests/legacy/retryable-writes.yml +++ /dev/null @@ -1,216 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: increment txnNumber - - clientOptions: - retryWrites: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - # Retryable write should include the next txnNumber - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - # Next transaction should include the next txnNumber - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 3 - result: - insertedId: 3 - - name: abortTransaction - object: session0 - # Retryable write should include the next txnNumber - - name: insertMany - object: collection - arguments: - documents: - - _id: 4 - - _id: 5 - session: session0 - result: - insertedIds: {0: 4, 1: 5} - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - txnNumber: - $numberLong: "3" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "3" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - - _id: 5 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "4" - startTransaction: - autocommit: - writeConcern: - command_name: insert - database_name: *database_name - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - _id: 4 - - _id: 5 - - - description: writes are not retried - - clientOptions: - retryWrites: true - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - errorLabelsContain: ["TransientTransactionError"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index 313ff2f763..c324214923 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -46,8 +42,6 @@ initialData: tests: - description: 'increment txnNumber' - clientOptions: - retryWrites: true operations: - object: *session0 @@ -246,8 +240,6 @@ tests: _id: 5 - description: 'writes are not retried' - clientOptions: - retryWrites: true operations: - object: testRunner From cefc1e02b7cced3f64e9d2f17619bafd71503221 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:08:49 -0500 Subject: [PATCH 08/55] retryable-commit.yml --- .../tests/legacy/retryable-commit.yml | 137 ------------------ .../tests/unified/retryable-commit.yml | 4 - 2 files changed, 141 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-commit.yml diff --git a/source/transactions/tests/legacy/retryable-commit.yml b/source/transactions/tests/legacy/retryable-commit.yml deleted file mode 100644 index 06f2e6de7c..0000000000 --- a/source/transactions/tests/legacy/retryable-commit.yml +++ /dev/null @@ -1,137 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction fails after Interrupted - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 11601 - closeConnection: false - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorCodeName: Interrupted - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError", "UnknownTransactionCommitResult"] - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: commitTransaction is not retried after UnsatisfiableWriteConcern error - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 100 - errmsg: Not enough data-bearing nodes - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError", "UnknownTransactionCommitResult"] - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index fb7922004d..5e7272a8f4 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' From 0010252303569f1e21d7e6c8c216936c2e6847ac Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:09:05 -0500 Subject: [PATCH 09/55] retryable-commit-forbid_serverless.yml --- .../retryable-commit-forbid_serverless.yml | 270 ------------------ .../retryable-commit-forbid_serverless.yml | 75 +++-- 2 files changed, 45 insertions(+), 300 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-commit-forbid_serverless.yml diff --git a/source/transactions/tests/legacy/retryable-commit-forbid_serverless.yml b/source/transactions/tests/legacy/retryable-commit-forbid_serverless.yml deleted file mode 100644 index 17e1edd45a..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-forbid_serverless.yml +++ /dev/null @@ -1,270 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction fails after two errors - - clientOptions: - retryWrites: false - - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # First call to commit fails after a single retry attempt. - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - # Second call to commit succeeds because the failpoint was disabled. - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction applies majority write concern on retries - - clientOptions: - retryWrites: false - - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: { w: 2, j: true, wtimeout: 5000 } - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # First call to commit fails after a single retry attempt. - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - # Second call to commit succeeds because the failpoint was disabled. - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: 2, j: true, wtimeout: 5000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, j: true, wtimeout: 5000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, j: true, wtimeout: 5000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after connection error - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 1211d18787..540248b251 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: retryable-commit-forbid_serverless -schemaVersion: '1.3' +schemaVersion: '1.4' createEntities: - client: @@ -24,10 +24,29 @@ createEntities: session: id: &session0 session0 client: *client0 + # Define a second set of entities for a retryWrites=false client + - + client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - + database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - + collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name - session: id: &session1 session1 - client: *client0 + client: *client1 runOnRequirements: - minServerVersion: '4.0' @@ -47,14 +66,12 @@ initialData: tests: - description: 'commitTransaction fails after two errors' - clientOptions: - retryWrites: false operations: - object: testRunner name: failPoint arguments: - client: *client0 + client: *client1 failPoint: configureFailPoint: failCommand mode: @@ -64,13 +81,13 @@ tests: - commitTransaction closeConnection: true - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -78,7 +95,7 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction expectError: errorLabelsContain: @@ -87,11 +104,11 @@ tests: errorLabelsOmit: - TransientTransactionError - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -104,7 +121,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -118,7 +135,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -133,7 +150,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -149,7 +166,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -169,14 +186,12 @@ tests: _id: 1 - description: 'commitTransaction applies majority write concern on retries' - clientOptions: - retryWrites: false operations: - object: testRunner name: failPoint arguments: - client: *client0 + client: *client1 failPoint: configureFailPoint: failCommand mode: @@ -186,18 +201,18 @@ tests: - commitTransaction closeConnection: true - - object: *session0 + object: *session1 name: startTransaction arguments: writeConcern: w: 2 - j: true - wtimeout: 5000 + journal: true + wtimeoutMS: 5000 - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -205,7 +220,7 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction expectError: errorLabelsContain: @@ -214,11 +229,11 @@ tests: errorLabelsOmit: - TransientTransactionError - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -231,7 +246,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -245,7 +260,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -262,7 +277,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -279,7 +294,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From fb29fc46c198b77410750af2d46c2931c8540166 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:10:15 -0500 Subject: [PATCH 10/55] retryable-commit-errorLabels.yml --- .../legacy/retryable-commit-errorLabels.yml | 1014 ----------------- .../unified/retryable-commit-errorLabels.yml | 59 +- 2 files changed, 37 insertions(+), 1036 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-commit-errorLabels.yml diff --git a/source/transactions/tests/legacy/retryable-commit-errorLabels.yml b/source/transactions/tests/legacy/retryable-commit-errorLabels.yml deleted file mode 100644 index d3a74d8f35..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-errorLabels.yml +++ /dev/null @@ -1,1014 +0,0 @@ -runOn: - - - minServerVersion: "4.3.1" # failCommand errorLabels option - topology: ["replicaset", "sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction does not retry error without RetryableWriteError label - clientOptions: - retryWrites: false - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 11600 # InterruptedAtShutdown, normally a retryable error code - errorLabels: [] # Override server behavior: do not send RetryableWriteError label with retryable code - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError"] - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - outcome: # Driver does not retry commit because there was no RetryableWriteError label on response - collection: - data: [] - - - description: commitTransaction retries once with RetryableWriteError from server - clientOptions: - retryWrites: false - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 112 # WriteConflict, not a retryable error code - errorLabels: ["RetryableWriteError"] # Override server behavior: send RetryableWriteError label with non-retryable error code - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: # Driver retries commit and it succeeds - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after NotWritablePrimary - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 10107 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after NotPrimaryOrSecondary - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 13436 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after NotPrimaryNoSecondaryOk - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 13435 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after InterruptedDueToReplStateChange - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 11602 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after PrimarySteppedDown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 189 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after HostNotFound - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 7 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after HostUnreachable - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 6 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after SocketException - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 9001 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after NetworkTimeout - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 89 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after WriteConcernError InterruptedAtShutdown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 11600 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 11602 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after WriteConcernError PrimarySteppedDown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 189 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after WriteConcernError ShutdownInProgress - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 91 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index 9abec19ca1..e2eebc4c59 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -24,10 +24,29 @@ createEntities: session: id: &session0 session0 client: *client0 + # Define a second set of entities for a retryWrites=false client + - + client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - + database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - + collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name - session: id: &session1 session1 - client: *client0 + client: *client1 runOnRequirements: - minServerVersion: 4.3.1 @@ -43,14 +62,12 @@ initialData: tests: - description: 'commitTransaction does not retry error without RetryableWriteError label' - clientOptions: - retryWrites: false operations: - object: testRunner name: failPoint arguments: - client: *client0 + client: *client1 failPoint: configureFailPoint: failCommand mode: @@ -61,13 +78,13 @@ tests: errorCode: 11600 errorLabels: [] - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -75,7 +92,7 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction expectError: errorLabelsOmit: @@ -83,7 +100,7 @@ tests: - TransientTransactionError expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -96,7 +113,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -110,7 +127,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -127,14 +144,12 @@ tests: documents: [] - description: 'commitTransaction retries once with RetryableWriteError from server' - clientOptions: - retryWrites: false operations: - object: testRunner name: failPoint arguments: - client: *client0 + client: *client1 failPoint: configureFailPoint: failCommand mode: @@ -146,13 +161,13 @@ tests: errorLabels: - RetryableWriteError - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -160,11 +175,11 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -177,7 +192,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -191,7 +206,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -206,7 +221,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From 025f1fc636602d2000dacb9dedebc695e1550a73 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:10:35 -0500 Subject: [PATCH 11/55] retryable-abort.yml --- .../tests/legacy/retryable-abort.yml | 267 ------------------ .../tests/unified/retryable-abort.yml | 41 ++- 2 files changed, 29 insertions(+), 279 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-abort.yml diff --git a/source/transactions/tests/legacy/retryable-abort.yml b/source/transactions/tests/legacy/retryable-abort.yml deleted file mode 100644 index 0beab8e5a6..0000000000 --- a/source/transactions/tests/legacy/retryable-abort.yml +++ /dev/null @@ -1,267 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: abortTransaction only performs a single retry - - clientOptions: - retryWrites: false - - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["abortTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # Call to abort returns no error even when the retry attempt fails. - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: abortTransaction does not retry after Interrupted - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 11601 - closeConnection: false - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: abortTransaction does not retry after WriteConcernError Interrupted - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - writeConcernError: - code: 11601 - errmsg: operation was interrupted - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after connection error - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index e03c0c9fa4..4f92db1520 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -24,10 +24,29 @@ createEntities: session: id: &session0 session0 client: *client0 + # Define a second set of entities for a retryWrites=false client + - + client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - + database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - + collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name - session: id: &session1 session1 - client: *client0 + client: *client1 runOnRequirements: - minServerVersion: '4.0' @@ -46,14 +65,12 @@ initialData: tests: - description: 'abortTransaction only performs a single retry' - clientOptions: - retryWrites: false operations: - object: testRunner name: failPoint arguments: - client: *client0 + client: *client1 failPoint: configureFailPoint: failCommand mode: @@ -63,13 +80,13 @@ tests: - abortTransaction closeConnection: true - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -77,11 +94,11 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: abortTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -94,7 +111,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -108,7 +125,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -123,7 +140,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From a556a1048058d532e8f873bf74788e346e2fce14 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:57:20 -0500 Subject: [PATCH 12/55] retryable-abort-errorLabels.yml --- .../legacy/retryable-abort-errorLabels.yml | 1112 ----------------- .../unified/retryable-abort-errorLabels.yml | 10 +- 2 files changed, 7 insertions(+), 1115 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-abort-errorLabels.yml diff --git a/source/transactions/tests/legacy/retryable-abort-errorLabels.yml b/source/transactions/tests/legacy/retryable-abort-errorLabels.yml deleted file mode 100644 index 83f9a78c49..0000000000 --- a/source/transactions/tests/legacy/retryable-abort-errorLabels.yml +++ /dev/null @@ -1,1112 +0,0 @@ -runOn: - - - minServerVersion: "4.3.1" # failCommand errorLabels option - topology: ["replicaset", "sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] -tests: - - description: abortTransaction only retries once with RetryableWriteError from server - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["abortTransaction"] - errorCode: 112 # WriteConflict, not a retryable error code - errorLabels: ["RetryableWriteError"] # Override server behavior: send RetryableWriteError label with non-retryable error code - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: # Driver retries abort once - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction does not retry without RetryableWriteError label - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 11600 # InterruptedAtShutdown, normally a retryable error code - errorLabels: [] # Override server behavior: do not send RetryableWriteError label with retryable code - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: # Driver does not retry abort - collection: - data: [] - - - description: abortTransaction succeeds after NotWritablePrimary - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 10107 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after NotPrimaryOrSecondary - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 13436 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after NotPrimaryNoSecondaryOk - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 13435 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after InterruptedDueToReplStateChange - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 11602 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after InterruptedAtShutdown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 11600 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after PrimarySteppedDown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 189 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after ShutdownInProgress - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 91 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after HostNotFound - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 7 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after HostUnreachable - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 6 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after SocketException - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 9001 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after NetworkTimeout - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorCode: 89 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after WriteConcernError InterruptedAtShutdown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 11600 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 11602 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after WriteConcernError PrimarySteppedDown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 189 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] - - - description: abortTransaction succeeds after WriteConcernError ShutdownInProgress - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 91 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: abortTransaction - database_name: admin - outcome: - collection: - data: [] diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 00496b373a..eed127245d 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -30,7 +30,7 @@ createEntities: client: *client0 runOnRequirements: - - minServerVersion: 4.3.1 + minServerVersion: 4.3.1 # failCommand errorLabels option topologies: - replicaset - sharded @@ -56,7 +56,8 @@ tests: data: failCommands: - abortTransaction - errorCode: 112 + errorCode: 112 # WriteConflict, not a retryable error code + # Override server behavior: send RetryableWriteError label with non-retryable error code errorLabels: - RetryableWriteError - @@ -115,6 +116,7 @@ tests: $$exists: false commandName: abortTransaction databaseName: admin + # Driver retries abort once - commandStartedEvent: command: @@ -150,7 +152,8 @@ tests: data: failCommands: - abortTransaction - errorCode: 11600 + errorCode: 11600 # InterruptedAtShutdown, normally a retryable error code + # Override server behavior: do not send RetryableWriteError label with retryable code errorLabels: [] - object: *session0 @@ -208,6 +211,7 @@ tests: $$exists: false commandName: abortTransaction databaseName: admin + # Driver does not retry abort outcome: - collectionName: *collection_name From 0e35337bdb7a7f579f05d3b1d50c67b8fb60e58f Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 12:59:48 -0500 Subject: [PATCH 13/55] reads.yml --- source/transactions/tests/legacy/reads.yml | 261 -------------------- source/transactions/tests/unified/reads.yml | 33 ++- 2 files changed, 20 insertions(+), 274 deletions(-) delete mode 100644 source/transactions/tests/legacy/reads.yml diff --git a/source/transactions/tests/legacy/reads.yml b/source/transactions/tests/legacy/reads.yml deleted file mode 100644 index 69c59a3fa0..0000000000 --- a/source/transactions/tests/legacy/reads.yml +++ /dev/null @@ -1,261 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - -tests: - - description: collection readConcern without transaction - - operations: - - name: find - object: collection - collectionOptions: - readConcern: - level: majority - arguments: - session: session0 - result: *data - - expectations: - - command_started_event: - command: - find: *collection_name - readConcern: - level: majority - lsid: session0 - txnNumber: - startTransaction: - autocommit: - command_name: find - database_name: *database_name - - outcome: &outcome - collection: - data: - *data - - - description: find - - operations: - - &startTransaction - name: startTransaction - object: session0 - - &find - name: find - object: collection - arguments: - session: session0 - batchSize: 3 - result: *data - - *find - - &commitTransaction - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - find: *collection_name - batchSize: 3 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - find: *collection_name - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: *outcome - - - description: aggregate - - operations: - - *startTransaction - - &aggregate - name: aggregate - object: collection - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: *data - - *aggregate - - *commitTransaction - - expectations: - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: *outcome - - - description: distinct - - operations: - - *startTransaction - - name: distinct - object: collection - arguments: - session: session0 - fieldName: _id - result: [1, 2, 3, 4] - - *commitTransaction - - expectations: - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: distinct - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - readConcern: - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: *outcome diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 99f0e67b36..6cea7dd65d 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: reads -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -24,10 +24,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -56,12 +52,21 @@ tests: description: 'collection readConcern without transaction' operations: - - object: *collection0 - collectionOptions: - readConcern: - level: majority + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: majority } + - + object: *collection1 name: find arguments: + filter: {} session: *session0 expectResult: *data expectEvents: @@ -99,8 +104,9 @@ tests: object: *collection0 name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectResult: *data - *find - &commitTransaction @@ -129,7 +135,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -159,7 +165,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -303,8 +309,9 @@ tests: object: *collection0 name: distinct arguments: - session: *session0 fieldName: _id + filter: {} + session: *session0 expectResult: - 1 - 2 From ce6162770a1bed16d1064875c3bcaf763eca7c95 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:00:08 -0500 Subject: [PATCH 14/55] read-pref.yml --- .../transactions/tests/legacy/read-pref.yml | 348 ------------------ .../transactions/tests/unified/read-pref.yml | 105 ++---- 2 files changed, 36 insertions(+), 417 deletions(-) delete mode 100644 source/transactions/tests/legacy/read-pref.yml diff --git a/source/transactions/tests/legacy/read-pref.yml b/source/transactions/tests/legacy/read-pref.yml deleted file mode 100644 index 8c5d8ba6a9..0000000000 --- a/source/transactions/tests/legacy/read-pref.yml +++ /dev/null @@ -1,348 +0,0 @@ -# This test doesn't check contents of command-started events. -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: default readPreference - - operations: - - name: startTransaction - object: session0 - - name: insertMany - object: collection - arguments: - documents: &insertedDocs - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 1, 1: 2, 2: 3, 3: 4} - - name: aggregate - object: collection - collectionOptions: - # The driver overrides the collection's read pref with the - # transaction's so count runs with Primary and succeeds. - readPreference: - mode: Secondary - arguments: - session: session0 - pipeline: - - $match: - _id: 1 - - $count: count - result: - - count: 1 - - name: find - object: collection - collectionOptions: - readPreference: - mode: Secondary - arguments: - session: session0 - batchSize: 3 - result: *insertedDocs - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Secondary - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: *insertedDocs - - name: commitTransaction - object: session0 - - outcome: - collection: - data: *insertedDocs - - - description: primary readPreference - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Primary - - name: insertMany - object: collection - arguments: - documents: &insertedDocs - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 1, 1: 2, 2: 3, 3: 4} - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Secondary - arguments: - session: session0 - pipeline: - - $match: - _id: 1 - - $count: count - result: - - count: 1 - - name: find - object: collection - collectionOptions: - readPreference: - mode: Secondary - arguments: - session: session0 - batchSize: 3 - result: *insertedDocs - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Secondary - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: *insertedDocs - - name: commitTransaction - object: session0 - - outcome: - collection: - data: *insertedDocs - - - description: secondary readPreference - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Secondary - - name: insertMany - object: collection - arguments: - documents: &insertedDocs - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 1, 1: 2, 2: 3, 3: 4} - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - pipeline: - - $match: - _id: 1 - - $count: count - result: - errorContains: read preference in a transaction must be primary - - name: find - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - batchSize: 3 - result: - errorContains: read preference in a transaction must be primary - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: - errorContains: read preference in a transaction must be primary - - name: abortTransaction - object: session0 - - outcome: - collection: - data: [] - - - description: primaryPreferred readPreference - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: PrimaryPreferred - - name: insertMany - object: collection - arguments: - documents: &insertedDocs - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 1, 1: 2, 2: 3, 3: 4} - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - pipeline: - - $match: - _id: 1 - - $count: count - result: - errorContains: read preference in a transaction must be primary - - name: find - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - batchSize: 3 - result: - errorContains: read preference in a transaction must be primary - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: - errorContains: read preference in a transaction must be primary - - name: abortTransaction - object: session0 - - outcome: - collection: - data: [] - - - description: nearest readPreference - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Nearest - - name: insertMany - object: collection - arguments: - documents: &insertedDocs - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 1, 1: 2, 2: 3, 3: 4} - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - pipeline: - - $match: - _id: 1 - - $count: count - result: - errorContains: read preference in a transaction must be primary - - name: find - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - session: session0 - batchSize: 3 - result: - errorContains: read preference in a transaction must be primary - - name: aggregate - object: collection - collectionOptions: - readPreference: - mode: Primary - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: - errorContains: read preference in a transaction must be primary - - name: abortTransaction - object: session0 - - outcome: - collection: - data: [] - - - description: secondary write only - - operations: - - name: startTransaction - object: session0 - arguments: - options: - readPreference: - mode: Secondary - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml index 8606528726..fa130648c2 100644 --- a/source/transactions/tests/unified/read-pref.yml +++ b/source/transactions/tests/unified/read-pref.yml @@ -1,6 +1,7 @@ # This file was created automatically using mongodb-spec-converter. # Please review the generated file, then remove this notice. +# This test doesn't check contents of command-started events. description: read-pref schemaVersion: '1.3' createEntities: @@ -21,12 +22,18 @@ createEntities: database: *database0 collectionName: &collection_name test - - session: - id: &session0 session0 - client: *client0 + collection: + id: &collection_rp_primary collection_rp_primary + database: *database0 + collectionName: *collection_name + - + collection: + id: &collection_rp_secondary collection_rp_secondary + database: *database0 + collectionName: *collection_name - session: - id: &session1 session1 + id: &session0 session0 client: *client0 runOnRequirements: - @@ -73,10 +80,7 @@ tests: '2': 3 '3': 4 - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: aggregate arguments: session: *session0 @@ -90,20 +94,15 @@ tests: - count: 1 - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectResult: *insertedDocs - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: aggregate arguments: pipeline: @@ -153,10 +152,7 @@ tests: '2': 3 '3': 4 - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: aggregate arguments: session: *session0 @@ -170,20 +166,15 @@ tests: - count: 1 - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectResult: *insertedDocs - - object: *collection0 - collectionOptions: - readPreference: - mode: Secondary + object: *collection_rp_secondary name: aggregate arguments: pipeline: @@ -233,10 +224,7 @@ tests: '2': 3 '3': 4 - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: session: *session0 @@ -249,21 +237,16 @@ tests: expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: pipeline: @@ -314,10 +297,7 @@ tests: '2': 3 '3': 4 - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: session: *session0 @@ -330,21 +310,16 @@ tests: expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: pipeline: @@ -395,10 +370,7 @@ tests: '2': 3 '3': 4 - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: session: *session0 @@ -411,21 +383,16 @@ tests: expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectError: errorContains: 'read preference in a transaction must be primary' - - object: *collection0 - collectionOptions: - readPreference: - mode: Primary + object: *collection_rp_primary name: aggregate arguments: pipeline: From 9dd043a96d4279539bed167cdfd04cecf18283e5 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:00:26 -0500 Subject: [PATCH 15/55] read-concern.yml --- .../tests/legacy/read-concern.yml | 623 ------------------ .../tests/unified/read-concern.yml | 64 +- 2 files changed, 28 insertions(+), 659 deletions(-) delete mode 100644 source/transactions/tests/legacy/read-concern.yml diff --git a/source/transactions/tests/legacy/read-concern.yml b/source/transactions/tests/legacy/read-concern.yml deleted file mode 100644 index 128a02ceb9..0000000000 --- a/source/transactions/tests/legacy/read-concern.yml +++ /dev/null @@ -1,623 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - -tests: - - description: only first countDocuments includes readConcern - - operations: - - &startTransaction - name: startTransaction - object: session0 - arguments: - options: - readConcern: - level: majority - - &countDocuments - name: countDocuments - object: collection - collectionOptions: - readConcern: - level: majority - arguments: - session: session0 - filter: {_id: {$gte: 2}} - result: 3 - - *countDocuments - - &commitTransaction - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $match: {_id: {$gte: 2}} - - $group: {_id: 1, n: {$sum: 1}} - cursor: {} - lsid: session0 - readConcern: - level: majority - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $match: {_id: {$gte: 2}} - - $group: {_id: 1, n: {$sum: 1}} - cursor: {} - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - &commitTransactionEvent - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - readConcern: - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: &outcome - collection: - data: - *data - - - description: only first find includes readConcern - - operations: - - *startTransaction - - &find - name: find - object: collection - collectionOptions: - readConcern: - level: majority - arguments: - session: session0 - batchSize: 3 - result: *data - - *find - - *commitTransaction - - expectations: - - command_started_event: - command: - find: *collection_name - batchSize: 3 - lsid: session0 - readConcern: - level: majority - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - find: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - *commitTransactionEvent - - outcome: &outcome - collection: - data: - *data - - - description: only first aggregate includes readConcern - - operations: - - *startTransaction - - &aggregate - name: aggregate - object: collection - collectionOptions: - readConcern: - level: majority - arguments: - pipeline: - - $project: - _id: 1 - batchSize: 3 - session: session0 - result: *data - - *aggregate - - *commitTransaction - - expectations: - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - lsid: session0 - readConcern: - level: majority - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: only first distinct includes readConcern - - operations: - - *startTransaction - - &distinct - name: distinct - object: collection - collectionOptions: - readConcern: - level: majority - arguments: - session: session0 - fieldName: _id - result: [1, 2, 3, 4] - - *distinct - - *commitTransaction - - expectations: - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: - level: majority - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: distinct - database_name: *database_name - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: distinct - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: only first runCommand includes readConcern - - operations: - - *startTransaction - - &runCommand - name: runCommand - object: database - command_name: find - arguments: - session: session0 - command: - find: *collection_name - - *runCommand - - *commitTransaction - - expectations: - - command_started_event: - command: - find: *collection_name - lsid: session0 - readConcern: - level: majority - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: find - database_name: *database_name - - command_started_event: - command: - find: *collection_name - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: find - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: countDocuments ignores collection readConcern - - operations: - - &startTransactionNoReadConcern - name: startTransaction - object: session0 - - *countDocuments - - *countDocuments - - *commitTransaction - - expectations: - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $match: {_id: {$gte: 2}} - - $group: {_id: 1, n: {$sum: 1}} - cursor: {} - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $match: {_id: {$gte: 2}} - - $group: {_id: 1, n: {$sum: 1}} - cursor: {} - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: find ignores collection readConcern - - operations: - - *startTransactionNoReadConcern - - *find - - *find - - *commitTransaction - - expectations: - - command_started_event: - command: - find: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - find: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: aggregate ignores collection readConcern - - operations: - - *startTransactionNoReadConcern - - *aggregate - - *aggregate - - *commitTransaction - - expectations: - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - # 42 is a fake placeholder value for the cursorId. - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - getMore: - $numberLong: '42' - collection: *collection_name - batchSize: 3 - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: getMore - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: distinct ignores collection readConcern - - operations: - - *startTransactionNoReadConcern - - *distinct - - *distinct - - *commitTransaction - - expectations: - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: distinct - database_name: *database_name - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: distinct - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome - - - description: runCommand ignores database readConcern - - operations: - - *startTransactionNoReadConcern - - name: runCommand - object: database - databaseOptions: - readConcern: - level: majority - command_name: find - arguments: - session: session0 - command: - find: *collection_name - - *runCommand - - *commitTransaction - - expectations: - - command_started_event: - command: - find: *collection_name - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: find - database_name: *database_name - - command_started_event: - command: - find: *collection_name - lsid: session0 - readConcern: # No readConcern - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: find - database_name: *database_name - - *commitTransactionEvent - - outcome: *outcome diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index 8c5d79bad3..1b2f98f0d8 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -15,19 +15,24 @@ createEntities: id: &database0 database0 client: *client0 databaseName: &database_name transaction-tests + - + database: + id: &database_rc_majority database_rc_majority + client: *client0 + databaseName: &database_name transaction-tests + databaseOptions: + readConcern: { level: majority } - collection: - id: &collection0 collection0 + id: &collection_rc_majority collection_rc_majority database: *database0 collectionName: &collection_name test + collectionOptions: + readConcern: { level: majority } - session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: '4.0' @@ -62,16 +67,13 @@ tests: readConcern: level: majority - &countDocuments - object: *collection0 - collectionOptions: - readConcern: - level: majority + object: *collection_rc_majority name: countDocuments arguments: - session: *session0 filter: _id: $gte: 2 + session: *session0 expectResult: 3 - *countDocuments - &commitTransaction @@ -155,14 +157,12 @@ tests: operations: - *startTransaction - &find - object: *collection0 - collectionOptions: - readConcern: - level: majority + object: *collection_rc_majority name: find arguments: - session: *session0 batchSize: 3 + filter: {} + session: *session0 expectResult: *data - *find - *commitTransaction @@ -189,7 +189,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -223,7 +223,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -248,10 +248,7 @@ tests: operations: - *startTransaction - &aggregate - object: *collection0 - collectionOptions: - readConcern: - level: majority + object: *collection_rc_majority name: aggregate arguments: pipeline: @@ -291,7 +288,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -330,7 +327,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -351,14 +348,12 @@ tests: operations: - *startTransaction - &distinct - object: *collection0 - collectionOptions: - readConcern: - level: majority + object: *collection_rc_majority name: distinct arguments: - session: *session0 fieldName: _id + filter: {} + session: *session0 expectResult: - 1 - 2 @@ -552,7 +547,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -586,7 +581,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -637,7 +632,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -676,7 +671,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: @@ -745,10 +740,7 @@ tests: operations: - *startTransactionNoReadConcern - - object: *database0 - databaseOptions: - readConcern: - level: majority + object: *database_rc_majority name: runCommand arguments: session: *session0 From 043322f6369e4ce5cbde50b77dc0f969d3e31797 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:06:29 -0500 Subject: [PATCH 16/55] pin-mongos.yml --- .../transactions/tests/legacy/pin-mongos.yml | 559 ------------------ .../transactions/tests/unified/pin-mongos.yml | 123 ++-- 2 files changed, 90 insertions(+), 592 deletions(-) delete mode 100644 source/transactions/tests/legacy/pin-mongos.yml diff --git a/source/transactions/tests/legacy/pin-mongos.yml b/source/transactions/tests/legacy/pin-mongos.yml deleted file mode 100644 index 08051dfd4e..0000000000 --- a/source/transactions/tests/legacy/pin-mongos.yml +++ /dev/null @@ -1,559 +0,0 @@ -# Test that all the operations go to the same mongos. -# -# In tests that don't include command-started events the assertion is implicit: -# that all the read operations succeed. If the driver does not properly pin to -# a single mongos then one of the operations in a transaction will eventually -# be sent to a different mongos, which is unaware of the transaction, and the -# mongos will return a command error. An example of such an error is: -# { -# 'ok': 0.0, -# 'errmsg': 'cannot continue txnId -1 for session 28938f50-9d29-4ca5-8de5-ddaf261267c4 - 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= with txnId 1', -# 'code': 251, -# 'codeName': 'NoSuchTransaction', -# 'errorLabels': ['TransientTransactionError'] -# } -runOn: - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - -tests: - - description: countDocuments - useMultipleMongoses: true - operations: - - &startTransaction - name: startTransaction - object: session0 - - &countDocuments - name: countDocuments - object: collection - arguments: - filter: - _id: 2 - session: session0 - result: 1 - - *countDocuments - - *countDocuments - - *countDocuments - - *countDocuments - - *countDocuments - - *countDocuments - - *countDocuments - - &commitTransaction - name: commitTransaction - object: session0 - - outcome: - collection: - data: *data - - - description: distinct - useMultipleMongoses: true - operations: - - *startTransaction - - &distinct - name: distinct - object: collection - arguments: - fieldName: _id - session: session0 - result: [1, 2] - - *distinct - - *distinct - - *distinct - - *distinct - - *distinct - - *distinct - - *distinct - - *commitTransaction - - outcome: - collection: - data: *data - - - description: find - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - &find - name: find - object: collection - arguments: - filter: - _id: 2 - session: session0 - result: - - {_id: 2} - - *find - - *find - - *find - - *find - - *find - - *find - - *find - - *commitTransaction - - outcome: - collection: - data: *data - - - description: insertOne - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - document: - _id: 3 - session: session0 - result: - insertedId: 3 - - name: insertOne - object: collection - arguments: - document: - _id: 4 - session: session0 - result: - insertedId: 4 - - name: insertOne - object: collection - arguments: - document: - _id: 5 - session: session0 - result: - insertedId: 5 - - name: insertOne - object: collection - arguments: - document: - _id: 6 - session: session0 - result: - insertedId: 6 - - name: insertOne - object: collection - arguments: - document: - _id: 7 - session: session0 - result: - insertedId: 7 - - name: insertOne - object: collection - arguments: - document: - _id: 8 - session: session0 - result: - insertedId: 8 - - name: insertOne - object: collection - arguments: - document: - _id: 9 - session: session0 - result: - insertedId: 9 - - name: insertOne - object: collection - arguments: - document: - _id: 10 - session: session0 - result: - insertedId: 10 - - *commitTransaction - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - - {_id: 5} - - {_id: 6} - - {_id: 7} - - {_id: 8} - - {_id: 9} - - {_id: 10} - - - description: mixed read write operations - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - document: - _id: 3 - session: session0 - result: - insertedId: 3 - - &countDocuments - name: countDocuments - object: collection - arguments: - filter: - _id: 3 - session: session0 - result: 1 - - *countDocuments - - *countDocuments - - *countDocuments - - *countDocuments - - name: insertOne - object: collection - arguments: - document: - _id: 4 - session: session0 - result: - insertedId: 4 - - name: insertOne - object: collection - arguments: - document: - _id: 5 - session: session0 - result: - insertedId: 5 - - name: insertOne - object: collection - arguments: - document: - _id: 6 - session: session0 - result: - insertedId: 6 - - name: insertOne - object: collection - arguments: - document: - _id: 7 - session: session0 - result: - insertedId: 7 - - *commitTransaction - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - - {_id: 5} - - {_id: 6} - - {_id: 7} - - - description: multiple commits - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertMany - object: collection - arguments: - documents: - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 3, 1: 4} - # Session is pinned and remains pinned after successful commits. - - &assertSessionPinned - name: assertSessionPinned - object: testRunner - arguments: - session: session0 - - *commitTransaction - - *assertSessionPinned - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *commitTransaction - - *assertSessionPinned - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - - - description: remain pinned after non-transient error on commit - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertMany - object: collection - arguments: - documents: - - _id: 3 - - _id: 4 - session: session0 - result: - insertedIds: {0: 3, 1: 4} - # Session is pinned. - - *assertSessionPinned - # Fail the commit with a non-transient error. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 51 # ManualInterventionRequired - - name: commitTransaction - object: session0 - result: - errorLabelsOmit: ["TransientTransactionError"] - errorCode: 51 - - *assertSessionPinned - # The next commit should succeed. - - name: commitTransaction - object: session0 - - *assertSessionPinned - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - - - description: unpin after transient error within a transaction - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 3 - result: - insertedId: 3 - # Enable the fail point only on the Mongos that session0 is pinned to. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - closeConnection: true - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - # Session unpins from the first mongos after the insert error and - # abortTransaction succeeds immediately on any mongos. - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - # Applications should not run commitTransaction after transient errors but - # the transactions API allows it and this test confirms unpinning behavior. - # In a sharded cluster, a transient error within a transaction unpins the - # session. This way a subsequent abort can "succeed" immediately instead of - # blocking for serverSelectionTimeoutMS in the case the mongos went down. - # However since the abortTransaction helper ignores errors, this test uses - # commitTransaction to prove the session was unpinned. - - description: unpin after transient error within a transaction and commit - useMultipleMongoses: true - clientOptions: - # Increase heartbeatFrequencyMS to avoid the race condition where an in - # flight heartbeat refreshes the first mongoes' SDAM state in between - # the insert connection error and the single commit attempt. - heartbeatFrequencyMS: 30000 - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 3 - result: - insertedId: 3 - # Enable the fail point only on the Mongos that session0 is pinned to. - # Fail hello/legacy hello to prevent the heartbeat requested directly after the - # insert error from racing with server selection for the commit. - # Note: times: 7 is slightly artbitrary but it accounts for one failed - # insert and some SDAM heartbeats. A test runner will have multiple - # clients connected to this server so this fail point configuration - # is also racy. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 7 } - data: - failCommands: ["insert", "isMaster", "hello"] - closeConnection: true - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - # Session unpins from the first mongos after the insert error and - # commitTransaction selects the second mongos which is unaware of the - # transaction and therefore fails with NoSuchTransaction error. If this - # commit succeeds it indicates a bug, either: - # - the driver mistakenly remained pinned even after the insert error, or - # - the test client was initialized with a single mongos seed - # - # Note that the commit attempt should not select the original mongos - # because that server's SDAM state is reset by the connection error, - # heartbeatFrequencyMS is high, and subsequent heartbeats - # should fail. - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - errorCodeName: NoSuchTransaction - - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index c41a838d1d..2615531d6b 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -1,13 +1,27 @@ # This file was created automatically using mongodb-spec-converter. # Please review the generated file, then remove this notice. +# Test that all the operations go to the same mongos. +# +# In tests that don't include command-started events the assertion is implicit: +# that all the read operations succeed. If the driver does not properly pin to +# a single mongos then one of the operations in a transaction will eventually +# be sent to a different mongos, which is unaware of the transaction, and the +# mongos will return a command error. An example of such an error is: +# { +# 'ok': 0.0, +# 'errmsg': 'cannot continue txnId -1 for session 28938f50-9d29-4ca5-8de5-ddaf261267c4 - 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= with txnId 1', +# 'code': 251, +# 'codeName': 'NoSuchTransaction', +# 'errorLabels': ['TransientTransactionError'] +# } description: pin-mongos -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: id: &client0 client0 - useMultipleMongoses: false + useMultipleMongoses: true observeEvents: - commandStartedEvent - @@ -24,13 +38,11 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 runOnRequirements: - minServerVersion: 4.1.8 + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) serverless: forbid topologies: - sharded @@ -47,7 +59,6 @@ initialData: tests: - description: countDocuments - useMultipleMongoses: true operations: - &startTransaction object: *session0 @@ -77,7 +88,6 @@ tests: documents: *data - description: distinct - useMultipleMongoses: true operations: - *startTransaction - &distinct @@ -85,10 +95,9 @@ tests: name: distinct arguments: fieldName: _id + filter: {} session: *session0 - expectResult: - - 1 - - 2 + expectResult: [ 1, 2 ] - *distinct - *distinct - *distinct @@ -104,7 +113,6 @@ tests: documents: *data - description: find - useMultipleMongoses: true operations: - object: *session0 @@ -134,7 +142,6 @@ tests: documents: *data - description: insertOne - useMultipleMongoses: true operations: - object: *session0 @@ -255,7 +262,6 @@ tests: _id: 10 - description: 'mixed read write operations' - useMultipleMongoses: true operations: - object: *session0 @@ -349,7 +355,6 @@ tests: _id: 7 - description: 'multiple commits' - useMultipleMongoses: true operations: - object: *session0 @@ -370,6 +375,7 @@ tests: $$unsetOrMatches: '0': 3 '1': 4 + # Session is pinned and remains pinned after successful commits - &assertSessionPinned object: testRunner name: assertSessionPinned @@ -402,7 +408,6 @@ tests: _id: 4 - description: 'remain pinned after non-transient error on commit' - useMultipleMongoses: true operations: - object: *session0 @@ -424,6 +429,7 @@ tests: '0': 3 '1': 4 - *assertSessionPinned + # Fail the commit with a non-transient error - object: testRunner name: targetedFailPoint @@ -436,7 +442,7 @@ tests: data: failCommands: - commitTransaction - errorCode: 51 + errorCode: 51 # ManualInterventionRequired - object: *session0 name: commitTransaction @@ -445,6 +451,7 @@ tests: - TransientTransactionError errorCode: 51 - *assertSessionPinned + # The next commit should succeed - object: *session0 name: commitTransaction @@ -464,7 +471,6 @@ tests: _id: 4 - description: 'unpin after transient error within a transaction' - useMultipleMongoses: true operations: - object: *session0 @@ -480,6 +486,7 @@ tests: $$unsetOrMatches: insertedId: $$unsetOrMatches: 3 + # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner name: targetedFailPoint @@ -505,6 +512,8 @@ tests: - TransientTransactionError errorLabelsOmit: - UnknownTransactionCommitResult + # Session unpins from the first mongos after the insert error and + # abortTransaction succeeds immediately on any mongos. - object: *session0 name: abortTransaction @@ -579,31 +588,68 @@ tests: _id: 1 - _id: 2 + # Applications should not run commitTransaction after transient errors but + # the transactions API allows it and this test confirms unpinning behavior. + # In a sharded cluster, a transient error within a transaction unpins the + # session. This way a subsequent abort can "succeed" immediately instead of + # blocking for serverSelectionTimeoutMS in the case the mongos went down. + # However since the abortTransaction helper ignores errors, this test uses + # commitTransaction to prove the session was unpinned. - description: 'unpin after transient error within a transaction and commit' - useMultipleMongoses: true - clientOptions: - heartbeatFrequencyMS: 30000 operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: true + uriOptions: + # Increase heartbeatFrequencyMS to avoid the race condition where an in + # flight heartbeat refreshes the first mongoes' SDAM state in between + # the insert connection error and the single commit attempt. + heartbeatFrequencyMS: 30000 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 3 expectResult: $$unsetOrMatches: insertedId: $$unsetOrMatches: 3 + # Enable the fail point only on the Mongos that session0 is pinned to. + # Fail hello/legacy hello to prevent the heartbeat requested directly after the + # insert error from racing with server selection for the commit. + # Note: times: 7 is slightly artbitrary but it accounts for one failed + # insert and some SDAM heartbeats. A test runner will have multiple + # clients connected to this server so this fail point configuration + # is also racy. - object: testRunner name: targetedFailPoint arguments: - session: *session0 + session: *session1 failPoint: configureFailPoint: failCommand mode: @@ -615,10 +661,10 @@ tests: - hello closeConnection: true - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 4 expectError: @@ -626,8 +672,19 @@ tests: - TransientTransactionError errorLabelsOmit: - UnknownTransactionCommitResult - - - object: *session0 + # Session unpins from the first mongos after the insert error and + # commitTransaction selects the second mongos which is unaware of the + # transaction and therefore fails with NoSuchTransaction error. If this + # commit succeeds it indicates a bug, either: + # - the driver mistakenly remained pinned even after the insert error, or + # - the test client was initialized with a single mongos seed + # + # Note that the commit attempt should not select the original mongos + # because that server's SDAM state is reset by the connection error, + # heartbeatFrequencyMS is high, and subsequent heartbeats + # should fail. + - + object: *session1 name: commitTransaction expectError: errorLabelsContain: @@ -637,7 +694,7 @@ tests: errorCodeName: NoSuchTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -650,7 +707,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -670,7 +727,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -685,7 +742,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: From 9635b1918d8a4874d4da1494e2d959fc696bc7c1 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:14:37 -0500 Subject: [PATCH 17/55] mongos-recovery-token.yml --- .../tests/legacy/mongos-recovery-token.yml | 264 ------------------ .../tests/unified/mongos-recovery-token.yml | 77 +++-- 2 files changed, 61 insertions(+), 280 deletions(-) delete mode 100644 source/transactions/tests/legacy/mongos-recovery-token.yml diff --git a/source/transactions/tests/legacy/mongos-recovery-token.yml b/source/transactions/tests/legacy/mongos-recovery-token.yml deleted file mode 100644 index 6727161fa8..0000000000 --- a/source/transactions/tests/legacy/mongos-recovery-token.yml +++ /dev/null @@ -1,264 +0,0 @@ -runOn: - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't use recovery tokens - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction explicit retries include recoveryToken - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction retry fails on new mongos - useMultipleMongoses: true - clientOptions: - # Increase heartbeatFrequencyMS to avoid the race condition where an in - # flight heartbeat refreshes the first mongoes' SDAM state in between - # the initial commitTransaction and the retry attempt. - heartbeatFrequencyMS: 30000 - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # Enable the fail point only on the Mongos that session0 is pinned to. - # Fail hello/legacy hello to prevent the heartbeat requested directly after the - # retryable commit error from racing with server selection for the retry. - # Note: times: 7 is slightly artbitrary but it accounts for one failed - # commit and some SDAM heartbeats. A test runner will have multiple - # clients connected to this server so this fail point configuration - # is also racy. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 7 } - data: - failCommands: ["commitTransaction", "isMaster", "hello"] - closeConnection: true - # The first commitTransaction sees a retryable connection error due to - # the fail point and also fails on the server. The retry attempt on a - # new mongos will wait for the transaction to timeout and will fail - # because the transaction was aborted. Note that the retry attempt should - # not select the original mongos because that server's SDAM state is - # reset by the connection error, heartbeatFrequencyMS is high, and - # subsequent heartbeats should fail. - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - errorCodeName: NoSuchTransaction - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: abortTransaction sends recoveryToken - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # Enable the fail point only on the Mongos that session0 is pinned to. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["abortTransaction"] - closeConnection: true - # The first abortTransaction sees a retryable connection error due to - # the fail point. The retry attempt on a new mongos will send the - # recoveryToken. Note that the retry attempt will also fail because the - # server does not yet support aborting from a new mongos, however this - # operation should "succeed" since abortTransaction ignores errors. - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 61d30c0367..ba621a5402 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -2,12 +2,12 @@ # Please review the generated file, then remove this notice. description: mongos-recovery-token -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: id: &client0 client0 - useMultipleMongoses: false + useMultipleMongoses: true observeEvents: - commandStartedEvent - @@ -31,6 +31,7 @@ createEntities: runOnRequirements: - minServerVersion: 4.1.8 + # serverless proxy doesn't use recovery tokens serverless: forbid topologies: - sharded @@ -43,7 +44,6 @@ initialData: tests: - description: 'commitTransaction explicit retries include recoveryToken' - useMultipleMongoses: true operations: - object: *session0 @@ -120,6 +120,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -138,6 +139,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -154,29 +156,59 @@ tests: _id: 1 - description: 'commitTransaction retry fails on new mongos' - useMultipleMongoses: true - clientOptions: - heartbeatFrequencyMS: 30000 operations: - - object: *session0 + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: true + uriOptions: + # Increase heartbeatFrequencyMS to avoid the race condition where an in + # flight heartbeat refreshes the first mongoes' SDAM state in between + # the initial commitTransaction and the retry attempt. + heartbeatFrequencyMS: 30000 + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - session: + id: &session1 session1 + client: *client1 + - + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: $$unsetOrMatches: insertedId: $$unsetOrMatches: 1 + # Enable the fail point only on the Mongos that session0 is pinned to. + # Fail hello/legacy hello to prevent the heartbeat requested directly after the + # retryable commit error from racing with server selection for the retry. + # Note: times: 7 is slightly artbitrary but it accounts for one failed + # commit and some SDAM heartbeats. A test runner will have multiple + # clients connected to this server so this fail point configuration + # is also racy. - object: testRunner name: targetedFailPoint arguments: - session: *session0 + session: *session1 failPoint: configureFailPoint: failCommand mode: @@ -187,8 +219,15 @@ tests: - isMaster - hello closeConnection: true + # The first commitTransaction sees a retryable connection error due to + # the fail point and also fails on the server. The retry attempt on a + # new mongos will wait for the transaction to timeout and will fail + # because the transaction was aborted. Note that the retry attempt should + # not select the original mongos because that server's SDAM state is + # reset by the connection error, heartbeatFrequencyMS is high, and + # subsequent heartbeats should fail. - - object: *session0 + object: *session1 name: commitTransaction expectError: errorLabelsContain: @@ -198,7 +237,7 @@ tests: errorCodeName: NoSuchTransaction expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -211,7 +250,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -225,7 +264,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -242,12 +281,13 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -262,7 +302,6 @@ tests: documents: [] - description: 'abortTransaction sends recoveryToken' - useMultipleMongoses: true operations: - object: *session0 @@ -278,6 +317,7 @@ tests: $$unsetOrMatches: insertedId: $$unsetOrMatches: 1 + # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner name: targetedFailPoint @@ -291,6 +331,11 @@ tests: failCommands: - abortTransaction closeConnection: true + # The first abortTransaction sees a retryable connection error due to + # the fail point. The retry attempt on a new mongos will send the + # recoveryToken. Note that the retry attempt will also fail because the + # server does not yet support aborting from a new mongos, however this + # operation should "succeed" since abortTransaction ignores errors. - object: *session0 name: abortTransaction From be1814c6cc6e7a4e92f8873a3907bd822958cbd9 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:17:14 -0500 Subject: [PATCH 18/55] mongos-recovery-token-errorLabels.yml --- .../mongos-recovery-token-errorLabels.yml | 96 ------------------- .../mongos-recovery-token-errorLabels.yml | 14 ++- 2 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 source/transactions/tests/legacy/mongos-recovery-token-errorLabels.yml diff --git a/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.yml deleted file mode 100644 index 800562c3a7..0000000000 --- a/source/transactions/tests/legacy/mongos-recovery-token-errorLabels.yml +++ /dev/null @@ -1,96 +0,0 @@ -runOn: - - - minServerVersion: "4.3.1" # failCommand errorLabels option - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't use recovery tokens - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction retry succeeds on new mongos - useMultipleMongoses: true - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # Enable the fail point only on the Mongos that session0 is pinned to. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 91 - errmsg: Replication is being shut down - # The client sees a retryable writeConcernError on the first - # commitTransaction due to the fail point but it actually succeeds on the - # server (SERVER-39346). The retry will succeed both on a new mongos and - # on the original. - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index 4fc9f134f0..9711b51e51 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -2,12 +2,12 @@ # Please review the generated file, then remove this notice. description: mongos-recovery-token-errorLabels -schemaVersion: '1.3' +schemaVersion: '1.4' createEntities: - client: id: &client0 client0 - useMultipleMongoses: false + useMultipleMongoses: true observeEvents: - commandStartedEvent - @@ -30,7 +30,8 @@ createEntities: client: *client0 runOnRequirements: - - minServerVersion: 4.3.1 + minServerVersion: 4.3.1 # failCommand errorLabels option + # serverless proxy doesn't use recovery tokens serverless: forbid topologies: - sharded @@ -43,7 +44,6 @@ initialData: tests: - description: 'commitTransaction retry succeeds on new mongos' - useMultipleMongoses: true operations: - object: *session0 @@ -62,6 +62,7 @@ tests: $$unsetOrMatches: insertedId: $$unsetOrMatches: 1 + # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner name: targetedFailPoint @@ -79,6 +80,10 @@ tests: writeConcernError: code: 91 errmsg: 'Replication is being shut down' + # The client sees a retryable writeConcernError on the first + # commitTransaction due to the fail point but it actually succeeds on the + # server (SERVER-39346). The retry will succeed both on a new mongos and + # on the original. - object: *session0 name: commitTransaction @@ -134,6 +139,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From 31ecc332e948c7064c8a7bbf8fc0aefaa4d235fd Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:56:40 -0500 Subject: [PATCH 19/55] retryable-commit-errorLabels.yml --- .../unified/retryable-commit-errorLabels.yml | 24 +++++++++++++++---- .../retryable-commit-forbid_serverless.yml | 14 +++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index e2eebc4c59..b5dd76e829 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -49,7 +49,7 @@ createEntities: client: *client1 runOnRequirements: - - minServerVersion: 4.3.1 + minServerVersion: 4.3.1 # failCommand errorLabels option topologies: - replicaset - sharded @@ -75,8 +75,8 @@ tests: data: failCommands: - commitTransaction - errorCode: 11600 - errorLabels: [] + errorCode: 11600 # InterruptedAtShutdown, normally a retryable error code + errorLabels: [] # Override server behavior: do not send RetryableWriteError label with retryable code - object: *session1 name: startTransaction @@ -137,6 +137,7 @@ tests: $$exists: false commandName: commitTransaction databaseName: admin + # Driver does not retry commit because there was no RetryableWriteError label on response outcome: - collectionName: *collection_name @@ -157,7 +158,8 @@ tests: data: failCommands: - commitTransaction - errorCode: 112 + errorCode: 112 # WriteConflict, not a retryable error code + # Override server behavior: send RetryableWriteError label with non-retryable error code errorLabels: - RetryableWriteError - @@ -232,6 +234,7 @@ tests: wtimeout: 10000 commandName: commitTransaction databaseName: admin + # Driver retries commit and it succeeds outcome: - collectionName: *collection_name @@ -325,6 +328,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -423,6 +427,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -521,6 +526,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -619,6 +625,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -717,6 +724,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -815,6 +823,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -913,6 +922,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1011,6 +1021,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1109,6 +1120,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1211,6 +1223,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1313,6 +1326,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1415,6 +1429,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1517,6 +1532,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 540248b251..59d9b108f2 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -54,6 +54,13 @@ runOnRequirements: - replicaset - minServerVersion: 4.1.8 + # This file contains tests originally found in retryable-commit.yml that + # are incompatible with serverless: + # + # * Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + # * Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). serverless: forbid topologies: - sharded @@ -94,6 +101,7 @@ tests: $$unsetOrMatches: insertedId: $$unsetOrMatches: 1 + # First call to commit fails after a single retry attempt. - object: *session1 name: commitTransaction @@ -103,6 +111,7 @@ tests: - UnknownTransactionCommitResult errorLabelsOmit: - TransientTransactionError + # Second call to commit succeeds because the failpoint was disabled. - object: *session1 name: commitTransaction @@ -156,6 +165,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -219,6 +229,7 @@ tests: $$unsetOrMatches: insertedId: $$unsetOrMatches: 1 + # First call to commit fails after a single retry attempt. - object: *session1 name: commitTransaction @@ -228,6 +239,7 @@ tests: - UnknownTransactionCommitResult errorLabelsOmit: - TransientTransactionError + # Second call to commit succeeds because the failpoint was disabled. - object: *session1 name: commitTransaction @@ -283,6 +295,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority j: true @@ -396,6 +409,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From 962689155dac9757f83668f2ada5f40e5d6a88ce Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Feb 2024 13:57:10 -0500 Subject: [PATCH 20/55] retryable-commit-errorLabels-forbid_serverless.yml --- ...e-commit-errorLabels-forbid_serverless.yml | 150 ------------------ ...e-commit-errorLabels-forbid_serverless.yml | 13 +- 2 files changed, 11 insertions(+), 152 deletions(-) delete mode 100644 source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.yml diff --git a/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.yml deleted file mode 100644 index c3290800b7..0000000000 --- a/source/transactions/tests/legacy/retryable-commit-errorLabels-forbid_serverless.yml +++ /dev/null @@ -1,150 +0,0 @@ -runOn: - - - minServerVersion: "4.3.1" # failCommand errorLabels option - topology: ["replicaset", "sharded", "load-balanced"] - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: commitTransaction succeeds after InterruptedAtShutdown - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 11600 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: commitTransaction succeeds after ShutdownInProgress - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 91 - errorLabels: ["RetryableWriteError"] - closeConnection: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 9844f4ec43..875c2bac22 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: retryable-commit-errorLabels-forbid_serverless -schemaVersion: '1.3' +schemaVersion: '1.4' createEntities: - client: @@ -30,7 +30,14 @@ createEntities: client: *client0 runOnRequirements: - - minServerVersion: 4.3.1 + minServerVersion: 4.3.1 # failCommand errorLabels option + # This file contains tests originally found in retryable-commit.yml that + # are incompatible with serverless: + # + # * Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + # * Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). serverless: forbid topologies: - replicaset @@ -128,6 +135,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -226,6 +234,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From afd01799e91d08d4abb2d37985eda9d74a837321 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 11:39:06 -0500 Subject: [PATCH 21/55] isolation.yml --- .../transactions/tests/legacy/isolation.yml | 133 ------------------ .../transactions/tests/unified/isolation.yml | 3 + 2 files changed, 3 insertions(+), 133 deletions(-) delete mode 100644 source/transactions/tests/legacy/isolation.yml diff --git a/source/transactions/tests/legacy/isolation.yml b/source/transactions/tests/legacy/isolation.yml deleted file mode 100644 index d2e733085a..0000000000 --- a/source/transactions/tests/legacy/isolation.yml +++ /dev/null @@ -1,133 +0,0 @@ -# Test snapshot isolation. -# This test doesn't check contents of command-started events. -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: one transaction - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: find - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - - {_id: 1} - - name: find - object: collection - arguments: - session: session1 - filter: - _id: 1 - result: [] - - name: find - object: collection - arguments: - filter: - _id: 1 - result: [] - - name: commitTransaction - object: session0 - - name: find - object: collection - arguments: - session: session1 - filter: - _id: 1 - result: - - {_id: 1} - - name: find - object: collection - arguments: - filter: - _id: 1 - result: - - {_id: 1} - - outcome: - collection: - data: - - _id: 1 - - - description: two transactions - - operations: - - name: startTransaction - object: session0 - - name: startTransaction - object: session1 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: find - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - - {_id: 1} - - name: find - object: collection - arguments: - session: session1 - filter: - _id: 1 - result: [] - - name: find - object: collection - arguments: - filter: - _id: 1 - result: [] - - name: commitTransaction - object: session0 - # Snapshot isolation in session1, not read-committed. - - name: find - object: collection - arguments: - session: session1 - filter: - _id: 1 - result: [] - - name: find - object: collection - arguments: - filter: - _id: 1 - result: - - {_id: 1} - - name: commitTransaction - object: session1 - - outcome: - collection: - data: - - {_id: 1} diff --git a/source/transactions/tests/unified/isolation.yml b/source/transactions/tests/unified/isolation.yml index af8b721501..4b72d1d8cb 100644 --- a/source/transactions/tests/unified/isolation.yml +++ b/source/transactions/tests/unified/isolation.yml @@ -1,6 +1,8 @@ # This file was created automatically using mongodb-spec-converter. # Please review the generated file, then remove this notice. +# Test snapshot isolation. +# This test doesn't check contents of command-started events. description: isolation schemaVersion: '1.3' createEntities: @@ -163,6 +165,7 @@ tests: - object: *session0 name: commitTransaction + # Snapshot isolation in session1, not read-committed. - object: *collection0 name: find From c3ded5ce92c98638a9ee6d69be3ecd91fa23d3ae Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 11:45:23 -0500 Subject: [PATCH 22/55] insert.yml --- source/transactions/tests/legacy/insert.yml | 390 ------------------- source/transactions/tests/unified/insert.yml | 64 ++- 2 files changed, 46 insertions(+), 408 deletions(-) delete mode 100644 source/transactions/tests/legacy/insert.yml diff --git a/source/transactions/tests/legacy/insert.yml b/source/transactions/tests/legacy/insert.yml deleted file mode 100644 index 45a5f8633c..0000000000 --- a/source/transactions/tests/legacy/insert.yml +++ /dev/null @@ -1,390 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: insert - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: insertMany - object: collection - arguments: - documents: - - _id: 2 - - _id: 3 - session: session0 - result: - insertedIds: {0: 2, 1: 3} - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - insertedId: 4 - - name: commitTransaction - object: session0 - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 5 - result: - insertedId: 5 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - - _id: 3 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 5 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - - _id: 5 - - # This test proves that the driver uses "session1" correctly in operations - # and APM expectations. - - description: insert with session1 - - operations: - - name: startTransaction - object: session1 - - name: insertOne - object: collection - arguments: - session: session1 - document: - _id: 1 - result: - insertedId: 1 - - name: insertMany - object: collection - arguments: - documents: - - _id: 2 - - _id: 3 - session: session1 - result: - insertedIds: {0: 2, 1: 3} - - name: commitTransaction - object: session1 - - name: startTransaction - object: session1 - - name: insertOne - object: collection - arguments: - session: session1 - document: - _id: 4 - result: - insertedId: 4 - - name: abortTransaction - object: session1 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session1 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - - _id: 3 - ordered: true - lsid: session1 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session1 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session1 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session1 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - _id: 3 - - # This test proves that the driver parses the collectionOptions writeConcern. - - description: collection writeConcern without transaction - clientOptions: - retryWrites: false - operations: - - name: insertOne - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - startTransaction: - autocommit: - writeConcern: - w: majority - command_name: insert - database_name: *database_name - - outcome: - collection: - data: - - _id: 1 - - - description: collection writeConcern ignored for insert - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: insertMany - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - documents: - - _id: 2 - - _id: 3 - session: session0 - result: - insertedIds: {0: 2, 1: 3} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - - _id: 3 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - _id: 3 diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index de426087c8..cdeabde564 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: insert -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -236,6 +236,8 @@ tests: _id: 4 - _id: 5 + # This test proves that the driver uses "session1" correctly in operations + # and APM expectations - description: 'insert with session1' operations: @@ -396,19 +398,40 @@ tests: _id: 2 - _id: 3 + # This test proves that the driver parses the collectionOptions writeConcern - description: 'collection writeConcern without transaction' - clientOptions: - retryWrites: false operations: - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: testRunner + name: createEntities + arguments: + entities: + - client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database1 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } + - session: + id: &session2 session2 + client: *client1 + - + object: *collection_wc_majority name: insertOne arguments: - session: *session0 + session: *session2 document: _id: 1 expectResult: @@ -417,7 +440,7 @@ tests: $$unsetOrMatches: 1 expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -430,7 +453,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session2 txnNumber: $$exists: false startTransaction: @@ -451,6 +474,17 @@ tests: - description: 'collection writeConcern ignored for insert' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -458,10 +492,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: insertOne arguments: session: *session0 @@ -472,10 +503,7 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: insertMany arguments: documents: From bcfb58f5e781bc8f2d247df5777bac7d39ed6648 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:27:33 -0500 Subject: [PATCH 23/55] findOneAndUpdate.yml --- .../tests/legacy/findOneAndUpdate.yml | 236 ------------------ .../tests/unified/findOneAndUpdate.yml | 20 +- 2 files changed, 15 insertions(+), 241 deletions(-) delete mode 100644 source/transactions/tests/legacy/findOneAndUpdate.yml diff --git a/source/transactions/tests/legacy/findOneAndUpdate.yml b/source/transactions/tests/legacy/findOneAndUpdate.yml deleted file mode 100644 index d6efaa34d2..0000000000 --- a/source/transactions/tests/legacy/findOneAndUpdate.yml +++ /dev/null @@ -1,236 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: - - _id: 1 - - _id: 2 - - _id: 3 - -tests: - - description: findOneAndUpdate - - operations: - - name: startTransaction - object: session0 - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 3} - update: - $inc: {x: 1} - returnDocument: Before - result: {_id: 3} - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 4} - update: - $inc: {x: 1} - upsert: true - returnDocument: After - result: {_id: 4, x: 1} - - name: commitTransaction - object: session0 - - name: startTransaction - object: session0 - # Test a second time to ensure txnNumber is incremented. - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 3} - update: - $inc: {x: 1} - returnDocument: Before - result: {_id: 3, x: 1} - - name: commitTransaction - object: session0 - # Test a third time to ensure abort works. - - name: startTransaction - object: session0 - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 3} - update: - $inc: {x: 1} - returnDocument: Before - result: {_id: 3, x: 2} - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: {$inc: {x: 1}} - new: false - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 4} - update: {$inc: {x: 1}} - new: true - upsert: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: {$inc: {x: 1}} - new: false - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - readConcern: - afterClusterTime: 42 - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: {$inc: {x: 1}} - new: false - lsid: session0 - txnNumber: - $numberLong: "3" - startTransaction: true - autocommit: false - readConcern: - afterClusterTime: 42 - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "3" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3, x: 2} - - {_id: 4, x: 1} - - - description: collection writeConcern ignored for findOneAndUpdate - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: findOneAndUpdate - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - filter: {_id: 3} - update: - $inc: {x: 1} - returnDocument: Before - result: {_id: 3} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: - $inc: {x: 1} - new: false - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 46d57069a4..7c5306b2fe 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: findOneAndUpdate -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -90,6 +90,7 @@ tests: - object: *session0 name: startTransaction + # Test a second time to ensure txnNumber is incremented - object: *collection0 name: findOneAndUpdate @@ -107,6 +108,7 @@ tests: - object: *session0 name: commitTransaction + # Test a third time to ensure abort works - object: *session0 name: startTransaction @@ -292,6 +294,17 @@ tests: - description: 'collection writeConcern ignored for findOneAndUpdate' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -299,10 +312,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: findOneAndUpdate arguments: session: *session0 From a39163cf83f7610100e331925a43d81d64343ce3 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:29:05 -0500 Subject: [PATCH 24/55] findOneAndReplace.yml --- .../tests/legacy/findOneAndReplace.yml | 148 ------------------ .../tests/unified/findOneAndReplace.yml | 18 ++- 2 files changed, 13 insertions(+), 153 deletions(-) delete mode 100644 source/transactions/tests/legacy/findOneAndReplace.yml diff --git a/source/transactions/tests/legacy/findOneAndReplace.yml b/source/transactions/tests/legacy/findOneAndReplace.yml deleted file mode 100644 index a997105727..0000000000 --- a/source/transactions/tests/legacy/findOneAndReplace.yml +++ /dev/null @@ -1,148 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: - - _id: 1 - - _id: 2 - - _id: 3 - -tests: - - description: findOneAndReplace - - operations: - - name: startTransaction - object: session0 - - name: findOneAndReplace - object: collection - arguments: - session: session0 - filter: {_id: 3} - replacement: {x: 1} - returnDocument: Before - result: {_id: 3} - - name: findOneAndReplace - object: collection - arguments: - session: session0 - filter: {_id: 4} - replacement: {x: 1} - upsert: true - returnDocument: After - result: {_id: 4, x: 1} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: {x: 1} - new: false - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 4} - update: {x: 1} - new: true - upsert: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3, x: 1} - - {_id: 4, x: 1} - - - description: collection writeConcern ignored for findOneAndReplace - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: findOneAndReplace - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - filter: {_id: 3} - replacement: {x: 1} - returnDocument: Before - result: {_id: 3} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - update: {x: 1} - new: false - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 3c8e256ca4..1ae50c0913 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: findOneAndReplace -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -168,6 +168,17 @@ tests: - description: 'collection writeConcern ignored for findOneAndReplace' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -175,10 +186,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: findOneAndReplace arguments: session: *session0 From 2534af817c6a75ea1dc2b764528762bfc5017652 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:29:27 -0500 Subject: [PATCH 25/55] findOneAndDelete.yml --- .../tests/legacy/findOneAndDelete.yml | 134 ------------------ .../tests/unified/findOneAndDelete.yml | 18 ++- 2 files changed, 13 insertions(+), 139 deletions(-) delete mode 100644 source/transactions/tests/legacy/findOneAndDelete.yml diff --git a/source/transactions/tests/legacy/findOneAndDelete.yml b/source/transactions/tests/legacy/findOneAndDelete.yml deleted file mode 100644 index 144e51e993..0000000000 --- a/source/transactions/tests/legacy/findOneAndDelete.yml +++ /dev/null @@ -1,134 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: - - _id: 1 - - _id: 2 - - _id: 3 - -tests: - - description: findOneAndDelete - - operations: - - name: startTransaction - object: session0 - - name: findOneAndDelete - object: collection - arguments: - session: session0 - filter: {_id: 3} - result: {_id: 3} - - name: findOneAndDelete - object: collection - arguments: - session: session0 - filter: {_id: 4} - result: - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - remove: True - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 4} - remove: True - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - {_id: 1} - - {_id: 2} - - - description: collection writeConcern ignored for findOneAndDelete - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: findOneAndDelete - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - filter: {_id: 3} - result: {_id: 3} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - findAndModify: *collection_name - query: {_id: 3} - remove: True - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - readConcern: - writeConcern: - command_name: findAndModify - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - readConcern: - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index 24e754a769..17a66a6ebf 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: findOneAndDelete -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -147,6 +147,17 @@ tests: - description: 'collection writeConcern ignored for findOneAndDelete' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -154,10 +165,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: findOneAndDelete arguments: session: *session0 From d9539620ed69bcf8cccd4eef474a480f3a62a3c1 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:30:59 -0500 Subject: [PATCH 26/55] errors.yml --- source/transactions/tests/legacy/errors.yml | 133 ------------------- source/transactions/tests/unified/errors.yml | 5 + 2 files changed, 5 insertions(+), 133 deletions(-) delete mode 100644 source/transactions/tests/legacy/errors.yml diff --git a/source/transactions/tests/legacy/errors.yml b/source/transactions/tests/legacy/errors.yml deleted file mode 100644 index f061886c19..0000000000 --- a/source/transactions/tests/legacy/errors.yml +++ /dev/null @@ -1,133 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] -tests: - - description: start insert start - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: startTransaction - object: session0 - result: - # Client-side error. - errorContains: transaction already in progress - # Just to clean up. - - name: commitTransaction - object: session0 - - - description: start twice - - operations: - - name: startTransaction - object: session0 - - name: startTransaction - object: session0 - result: - # Client-side error. - errorContains: transaction already in progress - - - description: commit and start twice - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - name: startTransaction - object: session0 - - name: startTransaction - object: session0 - result: - # Client-side error. - errorContains: transaction already in progress - - - description: write conflict commit - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: startTransaction - object: session1 - - name: insertOne - object: collection - arguments: - session: session1 - document: - _id: 1 - result: - errorCodeName: WriteConflict - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session1 - result: - errorCodeName: NoSuchTransaction - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - - - description: write conflict abort - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: startTransaction - object: session1 - - name: insertOne - object: collection - arguments: - session: session1 - document: - _id: 1 - result: - errorCodeName: WriteConflict - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - - name: commitTransaction - object: session0 - # Driver ignores "NoSuchTransaction" error. - - name: abortTransaction - object: session1 diff --git a/source/transactions/tests/unified/errors.yml b/source/transactions/tests/unified/errors.yml index f743007f7d..e0d1feb9e1 100644 --- a/source/transactions/tests/unified/errors.yml +++ b/source/transactions/tests/unified/errors.yml @@ -65,7 +65,9 @@ tests: object: *session0 name: startTransaction expectError: + isClientError: true errorContains: 'transaction already in progress' + # Just to clean up - object: *session0 name: commitTransaction @@ -79,6 +81,7 @@ tests: object: *session0 name: startTransaction expectError: + isClientError: true errorContains: 'transaction already in progress' - description: 'commit and start twice' @@ -107,6 +110,7 @@ tests: object: *session0 name: startTransaction expectError: + isClientError: true errorContains: 'transaction already in progress' - description: 'write conflict commit' @@ -189,6 +193,7 @@ tests: - object: *session0 name: commitTransaction + # Driver ignores "NoSuchTransaction" error - object: *session1 name: abortTransaction From faf37c9358959de502df2c9ea0788dd72181e253 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:31:56 -0500 Subject: [PATCH 27/55] errors-client.yml --- .../tests/legacy/errors-client.yml | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 source/transactions/tests/legacy/errors-client.yml diff --git a/source/transactions/tests/legacy/errors-client.yml b/source/transactions/tests/legacy/errors-client.yml deleted file mode 100644 index 40a0234d41..0000000000 --- a/source/transactions/tests/legacy/errors-client.yml +++ /dev/null @@ -1,55 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] -tests: - - description: Client side error in command starting transaction - - operations: - - name: startTransaction - object: session0 - - name: updateOne - object: collection - arguments: - session: session0 - filter: { _id: 1 } - update: { x: 1 } - error: true - - name: assertSessionTransactionState - object: testRunner - arguments: - session: session0 - state: starting - - - description: Client side error when transaction is in progress - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: { _id: 1 } - result: - insertedId: 1 - - name: updateOne - object: collection - arguments: - session: session0 - filter: { _id: 1 } - update: { x: 1 } - error: true - - name: assertSessionTransactionState - object: testRunner - arguments: - session: session0 - state: in_progress From 117ac97fac3d4c1291cd76e0affae8735a838b77 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:39:21 -0500 Subject: [PATCH 28/55] error-labels.yml --- .../tests/legacy/error-labels.yml | 1095 ----------------- .../tests/unified/error-labels.yml | 48 +- 2 files changed, 32 insertions(+), 1111 deletions(-) delete mode 100644 source/transactions/tests/legacy/error-labels.yml diff --git a/source/transactions/tests/legacy/error-labels.yml b/source/transactions/tests/legacy/error-labels.yml deleted file mode 100644 index 12219d085b..0000000000 --- a/source/transactions/tests/legacy/error-labels.yml +++ /dev/null @@ -1,1095 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: DuplicateKey errors do not contain transient label - - operations: - - name: startTransaction - object: session0 - - name: insertMany - object: collection - arguments: - session: session0 - documents: - - _id: 1 - - _id: 1 - result: - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - # DuplicateKey error code included in the bulk write error message - # returned by the server - errorContains: E11000 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: NotWritablePrimary errors contain transient label - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - errorCode: 10107 # NotWritablePrimary - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - # Note, the server will return the errorLabel in this case. - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: WriteConflict errors contain transient label - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - errorCode: 112 # WriteConflict - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - # Note, the server will return the errorLabel in this case. - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: NoSuchTransaction errors contain transient label - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - errorCode: 251 # NoSuchTransaction - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - # Note, the server will return the errorLabel in this case. - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: NoSuchTransaction errors on commit contain transient label - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 251 # NoSuchTransaction - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - # Note, the server will return the errorLabel in this case. - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult"] - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: add TransientTransactionError label to connection errors, but do not add RetryableWriteError label - - failPoint: - configureFailPoint: failCommand - mode: { times: 4 } - data: - failCommands: ["insert", "find", "aggregate", "distinct"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: &transient_label_only - errorLabelsContain: ["TransientTransactionError"] - # While a connection error would normally be retryable, these are not because - # they occur within a transaction; ensure the driver does not add the - # RetryableWriteError label to these errors. - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult"] - - name: find - object: collection - arguments: - session: session0 - result: *transient_label_only - - name: aggregate - object: collection - arguments: - pipeline: - - $project: - _id: 1 - session: session0 - result: *transient_label_only - - name: distinct - object: collection - arguments: - fieldName: _id - session: session0 - result: *transient_label_only - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - find: *collection_name - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: find - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: {} - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - distinct: *collection_name - key: _id - lsid: session0 - readConcern: - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: distinct - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors - - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - closeConnection: true - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - writeConcernError: - code: 91 - errmsg: Replication is being shut down - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - errorLabelsContain: [] - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError", "UnknownTransactionCommitResult"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 64 # WriteConcernFailed without wtimeout - errmsg: multiple errors reported - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["UnknownTransactionCommitResult"] - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 64 - codeName: WriteConcernFailed - errmsg: waiting for replication timed out - errInfo: {wtimeout: True} - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["UnknownTransactionCommitResult"] - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 100 # UnsatisfiableWriteConcern - errmsg: Not enough data-bearing nodes - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError", "UnknownTransactionCommitResult"] - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 79 # UnknownReplWriteConcern - errmsg: No write concern mode named 'blah' found in replica set configuration - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsOmit: ["RetryableWriteConcern", "TransientTransactionError", "UnknownTransactionCommitResult"] - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - errorCode: 50 # MaxTimeMSExpired - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: aggregate - object: collection - arguments: - pipeline: - - $project: - _id: 1 - maxTimeMS: 60000 - session: session0 - result: - errorLabelsOmit: ["RetryableWriteError", "UnknownTransactionCommitResult", "TransientTransactionError"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - aggregate: *collection_name - pipeline: - - $project: - _id: 1 - cursor: {} - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - autocommit: false - maxTimeMS: 60000 - command_name: aggregate - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: add UnknownTransactionCommitResult label to MaxTimeMSExpired - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - errorCode: 50 # MaxTimeMSExpired - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - maxCommitTimeMS: 60000 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["UnknownTransactionCommitResult"] - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired - - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - writeConcernError: - code: 50 # MaxTimeMSExpired - errmsg: operation exceeded time limit - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - maxCommitTimeMS: 60000 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["UnknownTransactionCommitResult"] - errorLabelsOmit: ["RetryableWriteError", "TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - maxTimeMS: 60000 - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 4c391dfe32..c251d5fde8 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: error-labels -schemaVersion: '1.3' +schemaVersion: '1.4' createEntities: - client: @@ -35,6 +35,8 @@ runOnRequirements: - replicaset - minServerVersion: 4.1.8 + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) serverless: forbid topologies: - sharded @@ -65,6 +67,8 @@ tests: errorLabelsOmit: - TransientTransactionError - UnknownTransactionCommitResult + # DuplicateKey error code included in the bulk write error message + # returned by the server errorContains: E11000 - object: *session0 @@ -130,7 +134,7 @@ tests: data: failCommands: - insert - errorCode: 10107 + errorCode: 10107 # NotWritablePrimary - object: *session0 name: startTransaction @@ -142,6 +146,7 @@ tests: document: _id: 1 expectError: + # Note, the server will return the errorLabel in this case errorLabelsContain: - TransientTransactionError errorLabelsOmit: @@ -209,7 +214,7 @@ tests: data: failCommands: - insert - errorCode: 112 + errorCode: 112 # WriteConflict - object: *session0 name: startTransaction @@ -221,6 +226,7 @@ tests: document: _id: 1 expectError: + # Note, the server will return the errorLabel in this case errorLabelsContain: - TransientTransactionError errorLabelsOmit: @@ -288,7 +294,7 @@ tests: data: failCommands: - insert - errorCode: 251 + errorCode: 251 # NoSuchTransaction - object: *session0 name: startTransaction @@ -300,6 +306,7 @@ tests: document: _id: 1 expectError: + # Note, the server will return the errorLabel in this case errorLabelsContain: - TransientTransactionError errorLabelsOmit: @@ -367,7 +374,7 @@ tests: data: failCommands: - commitTransaction - errorCode: 251 + errorCode: 251 # NoSuchTransaction - object: *session0 name: startTransaction @@ -386,6 +393,7 @@ tests: object: *session0 name: commitTransaction expectError: + # Note, the server will return the errorLabel in this case errorLabelsContain: - TransientTransactionError errorLabelsOmit: @@ -464,9 +472,11 @@ tests: session: *session0 document: _id: 1 - expectResult: &transient_label_only + expectError: &transient_label_only errorLabelsContain: - TransientTransactionError + # While a connection error would normally be retryable, these are not because they occur within a transaction. + # Ensure the driver does not add the RetryableWriteError label to these errors. errorLabelsOmit: - RetryableWriteError - UnknownTransactionCommitResult @@ -474,8 +484,9 @@ tests: object: *collection0 name: find arguments: + filter: {} session: *session0 - expectResult: *transient_label_only + expectError: *transient_label_only - object: *collection0 name: aggregate @@ -485,14 +496,15 @@ tests: $project: _id: 1 session: *session0 - expectResult: *transient_label_only + expectError: *transient_label_only - object: *collection0 name: distinct arguments: fieldName: _id + filter: {} session: *session0 - expectResult: *transient_label_only + expectError: *transient_label_only - object: *session0 name: abortTransaction @@ -683,6 +695,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -743,7 +756,6 @@ tests: document: _id: 1 expectError: - errorLabelsContain: [] errorLabelsOmit: - RetryableWriteError - TransientTransactionError @@ -807,7 +819,7 @@ tests: failCommands: - commitTransaction writeConcernError: - code: 64 + code: 64 # WriteConcernFailed without wtimeout errmsg: 'multiple errors reported' - object: *session0 @@ -888,6 +900,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1000,6 +1013,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1028,7 +1042,7 @@ tests: failCommands: - commitTransaction writeConcernError: - code: 100 + code: 100 # UnsatisfiableWriteConcern errmsg: 'Not enough data-bearing nodes' - object: *session0 @@ -1117,7 +1131,7 @@ tests: failCommands: - commitTransaction writeConcernError: - code: 79 + code: 79 # UnknownReplWriteConcern errmsg: "No write concern mode named 'blah' found in replica set configuration" - object: *session0 @@ -1205,7 +1219,7 @@ tests: data: failCommands: - aggregate - errorCode: 50 + errorCode: 50 # MaxTimeMSExpired - object: *session0 name: startTransaction @@ -1316,7 +1330,7 @@ tests: data: failCommands: - commitTransaction - errorCode: 50 + errorCode: 50 # MaxTimeMSExpired - object: *session0 name: startTransaction @@ -1398,6 +1412,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -1427,7 +1442,7 @@ tests: failCommands: - commitTransaction writeConcernError: - code: 50 + code: 50 # MaxTimeMSExpired errmsg: 'operation exceeded time limit' - object: *session0 @@ -1510,6 +1525,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From 3c08af5bd69d1e4e9b6be1115ed9bc82abc5444c Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:43:35 -0500 Subject: [PATCH 29/55] error-labels-errorLabels.yml --- .../tests/legacy/error-labels-errorLabels.yml | 183 ------------------ .../unified/error-labels-errorLabels.yml | 11 +- 2 files changed, 8 insertions(+), 186 deletions(-) delete mode 100644 source/transactions/tests/legacy/error-labels-errorLabels.yml diff --git a/source/transactions/tests/legacy/error-labels-errorLabels.yml b/source/transactions/tests/legacy/error-labels-errorLabels.yml deleted file mode 100644 index adbdccaded..0000000000 --- a/source/transactions/tests/legacy/error-labels-errorLabels.yml +++ /dev/null @@ -1,183 +0,0 @@ -runOn: - - - minServerVersion: "4.3.1" # failCommand errorLabels option - topology: ["replicaset", "sharded", "load-balanced"] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - errorCode: 11602 # InterruptedDueToReplStateChange - errorLabels: ["RetryableWriteError"] - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 - - - description: add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - errorLabels: ["RetryableWriteError"] - writeConcernError: - code: 91 - errmsg: Replication is being shut down - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - - name: commitTransaction - object: session0 - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index f99fce83e9..3da86b5465 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: error-labels-errorLabels -schemaVersion: '1.3' +schemaVersion: '1.4' createEntities: - client: @@ -30,7 +30,9 @@ createEntities: client: *client0 runOnRequirements: - - minServerVersion: 4.3.1 + minServerVersion: 4.3.1 # failCommand errorLabels option + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) serverless: forbid topologies: - replicaset @@ -57,7 +59,7 @@ tests: data: failCommands: - commitTransaction - errorCode: 11602 + errorCode: 11602 # InterruptedDueToReplStateChange errorLabels: - RetryableWriteError - @@ -136,6 +138,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -263,6 +266,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -279,6 +283,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From d0451d671f2f2d6cd49a0cd671e4672ecce5c2fa Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 12:48:24 -0500 Subject: [PATCH 30/55] error-labels-blockConnection.yml --- .../legacy/error-labels-blockConnection.yml | 113 ------------------ .../unified/error-labels-blockConnection.yml | 18 ++- 2 files changed, 16 insertions(+), 115 deletions(-) delete mode 100644 source/transactions/tests/legacy/error-labels-blockConnection.yml diff --git a/source/transactions/tests/legacy/error-labels-blockConnection.yml b/source/transactions/tests/legacy/error-labels-blockConnection.yml deleted file mode 100644 index 6b36749e76..0000000000 --- a/source/transactions/tests/legacy/error-labels-blockConnection.yml +++ /dev/null @@ -1,113 +0,0 @@ -# This file contains a single test that should be in error-labels.yml. The test -# was moved from error-labels.yml during the spec work for client-side -# operations timeout because it uses the blockConnection parameter in -# failCommand, which is only available in server versions 4.2+. It should be -# merged back into error-labels.yml when that test file is ported to the -# unified test format as the format allows for per-test runOn requirements. - -runOn: - - - minServerVersion: "4.2" - topology: ["replicaset", "sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - # This test previously used failCommand with closeConnection=true to force a - # network error, but this does not work after CSOT is implemented because - # network errors are retried indefinitely. It has been changed to use - # socketTimeoutMS with blockConnection to force a network error because - # drivers only retry socketTimeoutMS-related errors once rather than - # indefinitely. - - description: add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors - - clientOptions: - socketTimeoutMS: 100 - - failPoint: - # Drivers stop retrying after two socket timeouts that occur due to the use of socketTimeoutMS. - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["commitTransaction"] - blockConnection: true - blockTimeMS: 150 - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"] - errorLabelsOmit: ["TransientTransactionError"] - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index 5dde2f6340..64cf955944 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -1,6 +1,12 @@ # This file was created automatically using mongodb-spec-converter. # Please review the generated file, then remove this notice. +# This file contains a single test that should be in error-labels.yml. The test +# was moved from error-labels.yml during the spec work for client-side +# operations timeout because it uses the blockConnection parameter in +# failCommand, which is only available in server versions 4.2+. It should be +# merged back into error-labels.yml when that test file is ported to the +# unified test format as the format allows for per-test runOn requirements. description: error-labels-blockConnection schemaVersion: '1.3' createEntities: @@ -8,6 +14,8 @@ createEntities: client: id: &client0 client0 useMultipleMongoses: false + uriOptions: + socketTimeoutMS: 100 observeEvents: - commandStartedEvent - @@ -41,10 +49,14 @@ initialData: databaseName: *database_name documents: [] tests: + # This test previously used failCommand with closeConnection=true to force a + # network error, but this does not work after CSOT is implemented because + # network errors are retried indefinitely. It has been changed to use + # socketTimeoutMS with blockConnection to force a network error because + # drivers only retry socketTimeoutMS-related errors once rather than + # indefinitely. - description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors' - clientOptions: - socketTimeoutMS: 100 operations: - object: testRunner @@ -52,6 +64,7 @@ tests: arguments: client: *client0 failPoint: + # Drivers stop retrying after two socket timeouts that occur due to the use of socketTimeoutMS configureFailPoint: failCommand mode: times: 2 @@ -136,6 +149,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 From 83878aeec729a89ace2850e5c70b7290eb187b42 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:00:39 -0500 Subject: [PATCH 31/55] delete.yml --- source/transactions/tests/legacy/delete.yml | 192 ------------------- source/transactions/tests/unified/delete.yml | 23 ++- 2 files changed, 14 insertions(+), 201 deletions(-) delete mode 100644 source/transactions/tests/legacy/delete.yml diff --git a/source/transactions/tests/legacy/delete.yml b/source/transactions/tests/legacy/delete.yml deleted file mode 100644 index b8ef99fef8..0000000000 --- a/source/transactions/tests/legacy/delete.yml +++ /dev/null @@ -1,192 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: - - _id: 1 - - _id: 2 - - _id: 3 - - _id: 4 - - _id: 5 - -tests: - - description: delete - - operations: - - name: startTransaction - object: session0 - - name: deleteOne - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - deletedCount: 1 - - name: deleteMany - object: collection - arguments: - session: session0 - filter: - _id: {$lte: 3} - result: - deletedCount: 2 - - name: deleteOne - object: collection - arguments: - session: session0 - filter: - _id: 4 - result: - deletedCount: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 1} - limit: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: {$lte: 3}} - limit: 0 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 4} - limit: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 5 - - - description: collection writeConcern ignored for delete - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: majority - - name: deleteOne - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - filter: - _id: 1 - result: - deletedCount: 1 - - name: deleteMany - object: collection - collectionOptions: - writeConcern: - w: majority - arguments: - session: session0 - filter: - _id: {$lte: 3} - result: - deletedCount: 2 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 1} - limit: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: {$lte: 3}} - limit: 0 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - w: majority - command_name: commitTransaction - database_name: admin diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index ad116171c1..5986009987 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -2,7 +2,7 @@ # Please review the generated file, then remove this notice. description: delete -schemaVersion: '1.3' +schemaVersion: '1.9' createEntities: - client: @@ -184,6 +184,17 @@ tests: - description: 'collection writeConcern ignored for delete' operations: + - + object: testRunner + name: createEntities + arguments: + entities: + - collection: + id: &collection_wc_majority collection_wc_majority + database: *database0 + collectionName: *collection_name + collectionOptions: + writeConcern: { w: majority } - object: *session0 name: startTransaction @@ -191,10 +202,7 @@ tests: writeConcern: w: majority - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: deleteOne arguments: session: *session0 @@ -203,10 +211,7 @@ tests: expectResult: deletedCount: 1 - - object: *collection0 - collectionOptions: - writeConcern: - w: majority + object: *collection_wc_majority name: deleteMany arguments: session: *session0 From aaa54a80187801ffa74e187fd3ed910e0d0a4e88 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:34:34 -0500 Subject: [PATCH 32/55] create-index.yml --- .../tests/legacy/create-index.yml | 152 ------------------ .../tests/unified/create-index.yml | 24 +-- 2 files changed, 12 insertions(+), 164 deletions(-) delete mode 100644 source/transactions/tests/legacy/create-index.yml diff --git a/source/transactions/tests/legacy/create-index.yml b/source/transactions/tests/legacy/create-index.yml deleted file mode 100644 index 0f964af2fd..0000000000 --- a/source/transactions/tests/legacy/create-index.yml +++ /dev/null @@ -1,152 +0,0 @@ -runOn: - - - minServerVersion: "4.3.4" - topology: ["replicaset", "sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: create index on a non-existing collection - - operations: - - name: dropCollection - object: database - arguments: - collection: *collection_name - - name: startTransaction - object: session0 - - name: createIndex - object: collection - arguments: - session: session0 - name: &index_name "t_1" - keys: - x: 1 - - name: assertIndexNotExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - index: *index_name - - name: commitTransaction - object: session0 - - name: assertIndexExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - index: *index_name - - expectations: - - command_started_event: - command: - drop: *collection_name - writeConcern: - command_name: drop - database_name: *database_name - - command_started_event: - command: - createIndexes: *collection_name - indexes: - - name: *index_name - key: - x: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: createIndexes - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - - description: create index on a collection created within the same transaction - - operations: - - name: dropCollection - object: database - arguments: - collection: *collection_name - - name: startTransaction - object: session0 - - name: createCollection - object: database - arguments: - session: session0 - collection: *collection_name - - name: createIndex - object: collection - arguments: - session: session0 - name: *index_name - keys: - x: 1 - - name: assertIndexNotExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - index: *index_name - - name: commitTransaction - object: session0 - - name: assertIndexExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - index: *index_name - - expectations: - - command_started_event: - command: - drop: *collection_name - writeConcern: - command_name: drop - database_name: *database_name - - command_started_event: - command: - create: *collection_name - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: create - database_name: *database_name - - command_started_event: - command: - createIndexes: *collection_name - indexes: - - name: *index_name - key: - x: 1 - lsid: session0 - writeConcern: - command_name: createIndexes - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index f5375b6be4..c47b1be3da 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -64,9 +64,9 @@ tests: object: testRunner name: assertIndexNotExists arguments: - database: *database_name - collection: *collection_name - index: *index_name + databaseName: *database_name + collectionName: *collection_name + indexName: *index_name - object: *session0 name: commitTransaction @@ -74,9 +74,9 @@ tests: object: testRunner name: assertIndexExists arguments: - database: *database_name - collection: *collection_name - index: *index_name + databaseName: *database_name + collectionName: *collection_name + indexName: *index_name expectEvents: - client: *client0 @@ -152,9 +152,9 @@ tests: object: testRunner name: assertIndexNotExists arguments: - database: *database_name - collection: *collection_name - index: *index_name + databaseName: *database_name + collectionName: *collection_name + indexName: *index_name - object: *session0 name: commitTransaction @@ -162,9 +162,9 @@ tests: object: testRunner name: assertIndexExists arguments: - database: *database_name - collection: *collection_name - index: *index_name + databaseName: *database_name + collectionName: *collection_name + indexName: *index_name expectEvents: - client: *client0 From 45248f77fee4bdfda1a3b797353aca4d9d469efc Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:34:40 -0500 Subject: [PATCH 33/55] create-collection.yml --- .../tests/legacy/create-collection.yml | 131 ------------------ .../tests/unified/create-collection.yml | 16 +-- 2 files changed, 8 insertions(+), 139 deletions(-) delete mode 100644 source/transactions/tests/legacy/create-collection.yml diff --git a/source/transactions/tests/legacy/create-collection.yml b/source/transactions/tests/legacy/create-collection.yml deleted file mode 100644 index 2786f2ae2a..0000000000 --- a/source/transactions/tests/legacy/create-collection.yml +++ /dev/null @@ -1,131 +0,0 @@ -runOn: - - - minServerVersion: "4.3.4" - topology: ["replicaset", "sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: explicitly create collection using create command - - operations: - - name: dropCollection - object: database - arguments: - collection: *collection_name - - name: startTransaction - object: session0 - - name: createCollection - object: database - arguments: - session: session0 - collection: *collection_name - - name: assertCollectionNotExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - - name: commitTransaction - object: session0 - - name: assertCollectionExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - - expectations: - - command_started_event: - command: - drop: *collection_name - writeConcern: - command_name: drop - database_name: *database_name - - command_started_event: - command: - create: *collection_name - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: create - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - - description: implicitly create collection using insert - - operations: - - name: dropCollection - object: database - arguments: - collection: *collection_name - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: assertCollectionNotExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - - name: commitTransaction - object: session0 - - name: assertCollectionExists - object: testRunner - arguments: - database: *database_name - collection: *collection_name - - expectations: - - command_started_event: - command: - drop: *collection_name - writeConcern: - command_name: drop - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 330db1201e..9fa188ced5 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -62,8 +62,8 @@ tests: object: testRunner name: assertCollectionNotExists arguments: - database: *database_name - collection: *collection_name + databaseName: *database_name + collectionName: *collection_name - object: *session0 name: commitTransaction @@ -71,8 +71,8 @@ tests: object: testRunner name: assertCollectionExists arguments: - database: *database_name - collection: *collection_name + databaseName: *database_name + collectionName: *collection_name expectEvents: - client: *client0 @@ -140,8 +140,8 @@ tests: object: testRunner name: assertCollectionNotExists arguments: - database: *database_name - collection: *collection_name + databaseName: *database_name + collectionName: *collection_name - object: *session0 name: commitTransaction @@ -149,8 +149,8 @@ tests: object: testRunner name: assertCollectionExists arguments: - database: *database_name - collection: *collection_name + databaseName: *database_name + collectionName: *collection_name expectEvents: - client: *client0 From 28a02b7610d26b2a70253bed5d849cc1a7f34974 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:35:07 -0500 Subject: [PATCH 34/55] count.yml --- source/transactions/tests/legacy/count.yml | 67 --------------------- source/transactions/tests/unified/count.yml | 1 + 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 source/transactions/tests/legacy/count.yml diff --git a/source/transactions/tests/legacy/count.yml b/source/transactions/tests/legacy/count.yml deleted file mode 100644 index 49924be585..0000000000 --- a/source/transactions/tests/legacy/count.yml +++ /dev/null @@ -1,67 +0,0 @@ -runOn: - # SERVER-35388 introduced OperationNotSupportedInTransaction in 4.0.2 - - - minServerVersion: "4.0.2" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - - {_id: 3} - - {_id: 4} - -tests: - - description: count - - operations: - - name: startTransaction - object: session0 - - name: count - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - errorCodeName: OperationNotSupportedInTransaction - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - count: *collection_name - query: - _id: 1 - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: count - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: - *data diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 90e45c4a6e..4ad100c7df 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -29,6 +29,7 @@ createEntities: id: &session1 session1 client: *client0 runOnRequirements: + # SERVER-35388 introduced OperationNotSupportedInTransaction in 4.0.2 - minServerVersion: 4.0.2 topologies: From faeaf6416a99b2722ed783f0376c4b538ffb8c47 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:42:07 -0500 Subject: [PATCH 35/55] commit.yml --- source/transactions/tests/legacy/commit.yml | 603 ------------------- source/transactions/tests/unified/commit.yml | 88 ++- 2 files changed, 61 insertions(+), 630 deletions(-) delete mode 100644 source/transactions/tests/legacy/commit.yml diff --git a/source/transactions/tests/legacy/commit.yml b/source/transactions/tests/legacy/commit.yml deleted file mode 100644 index e7d600d514..0000000000 --- a/source/transactions/tests/legacy/commit.yml +++ /dev/null @@ -1,603 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] -tests: - - description: commit - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - # Again, to verify that txnNumber is incremented. - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - - description: rerun commit after empty transaction - - operations: - - name: startTransaction - object: session0 - - name: commitTransaction - object: session0 - # Rerun the commit (which does not increment the txnNumber). - - name: commitTransaction - object: session0 - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: multiple commits in a row - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: { w: majority, wtimeout: 10000 } - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: write concern error on commit - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: 10 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - result: - # { - # 'ok': 1.0, - # 'writeConcernError': { - # 'code': 100, - # 'codeName': 'UnsatisfiableWriteConcern', - # 'errmsg': 'Not enough data-bearing nodes' - # } - # } - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - - outcome: - collection: - data: - - _id: 1 - - - description: commit without start - - operations: - - name: commitTransaction - object: session0 - result: - errorContains: no transaction started - - expectations: [] - - outcome: - collection: - data: [] - - - description: commit after no-op abort - - operations: - - name: startTransaction - object: session0 - - name: abortTransaction - object: session0 - - name: commitTransaction - object: session0 - result: - errorContains: Cannot call commitTransaction after calling abortTransaction - - expectations: [] - - outcome: - collection: - data: [] - - - description: commit after abort - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - name: commitTransaction - object: session0 - result: - errorContains: Cannot call commitTransaction after calling abortTransaction - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - - description: multiple commits after empty transaction - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - # Increments txnNumber. - - name: startTransaction - object: session0 - # These commits aren't sent to server, transaction is empty. - - name: commitTransaction - object: session0 - - name: commitTransaction - object: session0 - # Verify that previous, empty transaction incremented txnNumber. - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - # txnNumber 2 was skipped. - txnNumber: - $numberLong: "3" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "3" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: reset session state commit - clientOptions: - retryWrites: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - # Running any operation after an ended transaction resets the session - # state to "no transaction". - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - # Calling commit again should error instead of re-running the commit. - - name: commitTransaction - object: session0 - result: - errorContains: no transaction started - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - readConcern: - lsid: session0 - txnNumber: - startTransaction: - autocommit: - command_name: insert - database_name: *database_name - - outcome: - collection: - data: - - _id: 1 - - _id: 2 - - - description: reset session state abort - clientOptions: - retryWrites: false - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - # Running any operation after an ended transaction resets the session - # state to "no transaction". - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - # Calling abort should error with "no transaction started" instead of - # "cannot call abortTransaction twice". - - name: abortTransaction - object: session0 - result: - errorContains: no transaction started - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - readConcern: - lsid: session0 - txnNumber: - startTransaction: - autocommit: - command_name: insert - database_name: *database_name - - outcome: - collection: - data: - - _id: 2 diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index 20a1869eb5..302ea54565 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -24,10 +24,29 @@ createEntities: session: id: &session0 session0 client: *client0 + # Define a second set of entities for a retryWrites=false client + - + client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - + database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - + collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name - session: id: &session1 session1 - client: *client0 + client: *client1 runOnRequirements: - minServerVersion: '4.0' @@ -64,6 +83,7 @@ tests: - object: *session0 name: commitTransaction + # Again, to verify that txnNumber is incremented - object: *session0 name: startTransaction @@ -174,6 +194,7 @@ tests: - object: *session0 name: commitTransaction + # Rerun the commit (which does not increment the txnNumber) - object: *session0 name: commitTransaction @@ -316,6 +337,7 @@ tests: startTransaction: $$exists: false autocommit: false + # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 @@ -368,6 +390,14 @@ tests: object: *session0 name: commitTransaction expectError: + # { + # 'ok': 1.0, + # 'writeConcernError': { + # 'code': 100, + # 'codeName': 'UnsatisfiableWriteConcern', + # 'errmsg': 'Not enough data-bearing nodes' + # } + # } errorLabelsOmit: - TransientTransactionError - UnknownTransactionCommitResult @@ -502,15 +532,18 @@ tests: - object: *session0 name: abortTransaction + # Increments txnNumber - object: *session0 name: startTransaction + # These commits aren't sent to server, transaction is empty - object: *session0 name: commitTransaction - object: *session0 name: commitTransaction + # Verify that previous, empty transaction incremented txnNumber - object: *session0 name: startTransaction @@ -580,6 +613,7 @@ tests: $$exists: true lsid: $$sessionLsid: *session0 + # txnNumber 2 was skipped txnNumber: $numberLong: '3' startTransaction: true @@ -610,17 +644,15 @@ tests: documents: [] - description: 'reset session state commit' - clientOptions: - retryWrites: false operations: - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -628,27 +660,29 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: commitTransaction + # Running any operation after an ended transaction resets the session state to "no transaction" - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 2 expectResult: $$unsetOrMatches: insertedId: $$unsetOrMatches: 2 + # Calling commit again should error instead of re-running the commit - - object: *session0 + object: *session1 name: commitTransaction expectError: errorContains: 'no transaction started' expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -661,7 +695,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -675,7 +709,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -696,7 +730,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $$exists: false startTransaction: @@ -716,17 +750,15 @@ tests: _id: 2 - description: 'reset session state abort' - clientOptions: - retryWrites: false operations: - - object: *session0 + object: *session1 name: startTransaction - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 1 expectResult: @@ -734,27 +766,29 @@ tests: insertedId: $$unsetOrMatches: 1 - - object: *session0 + object: *session1 name: abortTransaction + # Running any operation after an ended transaction resets the session state to "no transaction" - - object: *collection0 + object: *collection1 name: insertOne arguments: - session: *session0 + session: *session1 document: _id: 2 expectResult: $$unsetOrMatches: insertedId: $$unsetOrMatches: 2 + # Calling abort should error with "no transaction started" instead of "cannot call abortTransaction twice" - - object: *session0 + object: *session1 name: abortTransaction expectError: errorContains: 'no transaction started' expectEvents: - - client: *client0 + client: *client1 events: - commandStartedEvent: @@ -767,7 +801,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true @@ -781,7 +815,7 @@ tests: command: abortTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: @@ -802,7 +836,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session1 txnNumber: $$exists: false startTransaction: From 9b65ca400f90c9108e5d2049e64ec6917b436f98 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:47:13 -0500 Subject: [PATCH 36/55] causal-consistency.yml --- .../tests/legacy/causal-consistency.yml | 175 ------------------ .../tests/unified/causal-consistency.yml | 32 ++-- 2 files changed, 17 insertions(+), 190 deletions(-) delete mode 100644 source/transactions/tests/legacy/causal-consistency.yml diff --git a/source/transactions/tests/legacy/causal-consistency.yml b/source/transactions/tests/legacy/causal-consistency.yml deleted file mode 100644 index 0a655b3a4c..0000000000 --- a/source/transactions/tests/legacy/causal-consistency.yml +++ /dev/null @@ -1,175 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: - - _id: 1 - count: 0 - -tests: - - description: causal consistency - clientOptions: - retryWrites: false - operations: - # Update a document without a transaction. - - &updateOne - name: updateOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: - $inc: {count: 1} - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - # Updating the same document inside a transaction. - # Casual consistency ensures that the transaction snapshot is causally - # after the first updateOne. - - name: startTransaction - object: session0 - - *updateOne - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 1} - u: {$inc: {count: 1}} - ordered: true - lsid: session0 - readConcern: - txnNumber: - startTransaction: - autocommit: - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 1} - u: {$inc: {count: 1}} - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - count: 2 - - - description: causal consistency disabled - clientOptions: - retryWrites: false - sessionOptions: - session0: - causalConsistency: false - - operations: - # Insert a document without a transaction. - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 2 - result: - insertedId: 2 - - name: startTransaction - object: session0 - - name: updateOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: - $inc: {count: 1} - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 2 - ordered: true - readConcern: - lsid: session0 - txnNumber: - autocommit: - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 1} - u: {$inc: {count: 1}} - ordered: true - # No afterClusterTime - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - count: 1 - - _id: 2 diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index a170e044d5..c33d91e56b 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -8,6 +8,8 @@ createEntities: client: id: &client0 client0 useMultipleMongoses: false + uriOptions: + retryWrites: false observeEvents: - commandStartedEvent - @@ -26,8 +28,10 @@ createEntities: client: *client0 - session: - id: &session1 session1 + id: &session_no_cc session_no_cc client: *client0 + sessionOptions: + causalConsistency: false runOnRequirements: - minServerVersion: '4.0' @@ -49,9 +53,8 @@ initialData: tests: - description: 'causal consistency' - clientOptions: - retryWrites: false operations: + # Update a document without a transaction - &updateOne object: *collection0 name: updateOne @@ -66,6 +69,8 @@ tests: matchedCount: 1 modifiedCount: 1 upsertedCount: 0 + # Updating the same document inside a transaction. + # Casual consistency ensures that the transaction snapshot is causally after the first updateOne. - object: *session0 name: startTransaction @@ -159,17 +164,13 @@ tests: count: 2 - description: 'causal consistency disabled' - clientOptions: - retryWrites: false - sessionOptions: - session0: - causalConsistency: false operations: + # Insert a document without a transaction - object: *collection0 name: insertOne arguments: - session: *session0 + session: *session_no_cc document: _id: 2 expectResult: @@ -177,13 +178,13 @@ tests: insertedId: $$unsetOrMatches: 2 - - object: *session0 + object: *session_no_cc name: startTransaction - object: *collection0 name: updateOne arguments: - session: *session0 + session: *session_no_cc filter: _id: 1 update: @@ -194,7 +195,7 @@ tests: modifiedCount: 1 upsertedCount: 0 - - object: *session0 + object: *session_no_cc name: commitTransaction expectEvents: - @@ -211,7 +212,7 @@ tests: readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session_no_cc txnNumber: $$exists: false autocommit: @@ -235,10 +236,11 @@ tests: upsert: $$unsetOrMatches: false ordered: true + # No afterClusterTime readConcern: $$exists: false lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session_no_cc txnNumber: $numberLong: '1' startTransaction: true @@ -252,7 +254,7 @@ tests: command: commitTransaction: 1 lsid: - $$sessionLsid: *session0 + $$sessionLsid: *session_no_cc txnNumber: $numberLong: '1' startTransaction: From a46724db4535347b1636527c8b55d61b411669fc Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 13:50:35 -0500 Subject: [PATCH 37/55] bulk.yml --- source/transactions/tests/legacy/bulk.yml | 268 --------------------- source/transactions/tests/unified/bulk.yml | 6 + 2 files changed, 6 insertions(+), 268 deletions(-) delete mode 100644 source/transactions/tests/legacy/bulk.yml diff --git a/source/transactions/tests/legacy/bulk.yml b/source/transactions/tests/legacy/bulk.yml deleted file mode 100644 index 9b467f2aab..0000000000 --- a/source/transactions/tests/legacy/bulk.yml +++ /dev/null @@ -1,268 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: bulk - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: deleteOne - object: collection - arguments: - session: session0 - filter: - _id: 1 - result: - deletedCount: 1 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: insertOne - arguments: - document: {_id: 1} - - name: updateOne - arguments: - filter: {_id: 1} - update: {$set: {x: 1}} - - name: updateOne - arguments: - filter: {_id: 2} - update: {$set: {x: 2}} - upsert: true # Produces upsertedIds: {2: 2} in the result. - - name: insertOne - arguments: - document: {_id: 3} - - name: insertOne - arguments: - document: {_id: 4} - - name: insertOne - arguments: - document: {_id: 5} - - name: insertOne - arguments: - document: {_id: 6} - - name: insertOne - arguments: - document: {_id: 7} - # Keep replaces segregated from updates, so that drivers that aren't able to coalesce - # adjacent updates and replaces into a single update command will still pass this test - - name: replaceOne - arguments: - filter: {_id: 1} - replacement: {y: 1} - - name: replaceOne - arguments: - filter: {_id: 2} - replacement: {y: 2} - - name: deleteOne - arguments: - filter: {_id: 3} - - name: deleteOne - arguments: - filter: {_id: 4} - - name: updateMany - arguments: - filter: {_id: {$gte: 2}} - update: {$set: {z: 1}} - # Keep deleteMany segregated from deleteOne, so that drivers that aren't able to coalesce - # adjacent mixed deletes into a single delete command will still pass this test - - name: deleteMany - arguments: - filter: {_id: {$gte: 6}} - result: - deletedCount: 4 - insertedCount: 6 - insertedIds: {0: 1, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7} - matchedCount: 7 - modifiedCount: 7 - upsertedCount: 1 - upsertedIds: {2: 2} - - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 1} - limit: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - # Commands in the bulkWrite. - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 1} - u: {$set: {x: 1}} - - q: {_id: 2} - u: {$set: {x: 2}} - upsert: true - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - - _id: 4 - - _id: 5 - - _id: 6 - - _id: 7 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: 1} - u: {y: 1} - - q: {_id: 2} - u: {y: 2} - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: 3} - limit: 1 - - q: {_id: 4} - limit: 1 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - update: *collection_name - updates: - - q: {_id: {$gte: 2}} - u: {$set: {z: 1}} - multi: true - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: update - database_name: *database_name - - command_started_event: - command: - delete: *collection_name - deletes: - - q: {_id: {$gte: 6}} - limit: 0 - ordered: true - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: delete - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - {_id: 1, y: 1} - - {_id: 2, y: 2, z: 1} - - {_id: 5, z: 1} diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index 935048e484..feb0a76f27 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -94,6 +94,7 @@ tests: update: $set: x: 2 + # Produces upsertedIds: {2: 2} in the result upsert: true - insertOne: @@ -115,6 +116,8 @@ tests: insertOne: document: _id: 7 + # Keep replaces segregated from updates, so that drivers that aren't able to coalesce + # adjacent updates and replaces into a single update command will still pass this test - replaceOne: filter: @@ -143,6 +146,8 @@ tests: update: $set: z: 1 + # Keep deleteMany segregated from deleteOne, so that drivers that aren't able to coalesce + # adjacent mixed deletes into a single delete command will still pass this test - deleteMany: filter: @@ -212,6 +217,7 @@ tests: $$exists: false commandName: delete databaseName: *database_name + # Commands in the bulkWrite - commandStartedEvent: command: From 1d1672e5b3c3781132ed8927f3948f0d1c4d60ae Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Feb 2024 13:57:00 -0500 Subject: [PATCH 38/55] abort.yml --- source/transactions/tests/legacy/abort.yml | 413 -------------- source/transactions/tests/unified/abort.yml | 575 ++++++++++++++++++++ 2 files changed, 575 insertions(+), 413 deletions(-) delete mode 100644 source/transactions/tests/legacy/abort.yml create mode 100644 source/transactions/tests/unified/abort.yml diff --git a/source/transactions/tests/legacy/abort.yml b/source/transactions/tests/legacy/abort.yml deleted file mode 100644 index d06bfb74d4..0000000000 --- a/source/transactions/tests/legacy/abort.yml +++ /dev/null @@ -1,413 +0,0 @@ -runOn: - - - minServerVersion: "4.0" - topology: ["replicaset"] - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: [] - -tests: - - description: abort - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - "$numberLong": "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - afterClusterTime: 42 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "2" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: implicit abort - - operations: - # Start a transaction but don't commit - the driver calls abortTransaction - # from ClientSession.endSession(). - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: two aborts - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - - name: abortTransaction - object: session0 - result: - errorContains: cannot call abortTransaction twice - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - outcome: - collection: - data: [] - - - description: abort without start - - operations: - - name: abortTransaction - object: session0 - result: - errorContains: no transaction started - - expectations: [] - - outcome: - collection: - data: [] - - - description: abort directly after no-op commit - - operations: - - name: startTransaction - object: session0 - - name: commitTransaction - object: session0 - - name: abortTransaction # Error calling abort after no-op commit. - object: session0 - result: - errorContains: Cannot call abortTransaction after calling commitTransaction - - expectations: [] - - outcome: - collection: - data: [] - - - description: abort directly after commit - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: commitTransaction - object: session0 - - name: abortTransaction # Error calling abort after commit. - object: session0 - result: - errorContains: Cannot call abortTransaction after calling commitTransaction - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: commitTransaction - database_name: admin - - outcome: - collection: - data: - - _id: 1 - - - description: abort ignores TransactionAborted - - operations: - - name: startTransaction - object: session0 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - # Abort the server transaction with a duplicate key error. - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - # DuplicateKey error code included in the bulk write error message - # returned by the server - errorContains: E11000 - # Make sure the server aborted the transaction. - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - errorCodeName: NoSuchTransaction - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - # abortTransaction must ignore the TransactionAborted and succeed. - - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 1 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: abortTransaction - database_name: admin - - - outcome: - collection: - data: [] - - - description: abort does not apply writeConcern - - operations: - - name: startTransaction - object: session0 - arguments: - options: - writeConcern: - w: 10 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 1 - result: - insertedId: 1 - - name: abortTransaction - object: session0 - # No write concern error. - - outcome: - collection: - data: [] diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml new file mode 100644 index 0000000000..a2a0253337 --- /dev/null +++ b/source/transactions/tests/unified/abort.yml @@ -0,0 +1,575 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: abort +schemaVersion: '1.3' +createEntities: + - + client: + id: &client0 client0 + useMultipleMongoses: false + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - + collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - + session: + id: &session0 session0 + client: *client0 + - + session: + id: &session1 session1 + client: *client0 +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] +tests: + - + description: abort + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + afterClusterTime: + $$exists: true + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '2' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'implicit abort' + operations: + # Start a transaction but don't commit - the driver calls abortTransaction from ClientSession.endSession() + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + # The original legacy test relied on the test runner to call endSession after all operations. Since the unified + # test runner has no such behavior, we manually call endSession as the last operation. + - + object: *session0 + name: endSession + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'two aborts' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + - + object: *session0 + name: abortTransaction + expectError: + errorContains: 'cannot call abortTransaction twice' + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abort without start' + operations: + - + object: *session0 + name: abortTransaction + expectError: + errorContains: 'no transaction started' + expectEvents: + - + client: *client0 + events: [] + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abort directly after no-op commit' + operations: + - + object: *session0 + name: startTransaction + - + object: *session0 + name: commitTransaction + # Error calling abort after no-op commit + - + object: *session0 + name: abortTransaction + expectError: + errorContains: 'Cannot call abortTransaction after calling commitTransaction' + expectEvents: + - + client: *client0 + events: [] + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abort directly after commit' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: commitTransaction + - + object: *session0 + name: abortTransaction + expectError: + errorContains: 'Cannot call abortTransaction after calling commitTransaction' + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + - + description: 'abort ignores TransactionAborted' + operations: + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + # Abort the server transaction with a duplicate key error + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorLabelsOmit: + - TransientTransactionError + - UnknownTransactionCommitResult + # DuplicateKey error code included in the bulk write error message returned by the server + errorContains: E11000 + # Make sure the server aborted the transaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectError: + errorCodeName: NoSuchTransaction + errorLabelsContain: + - TransientTransactionError + errorLabelsOmit: + - UnknownTransactionCommitResult + # abortTransaction must ignore the TransactionAborted and succeed + - + object: *session0 + name: abortTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: true + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - + _id: 1 + ordered: true + readConcern: + $$exists: false + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + abortTransaction: 1 + lsid: + $$sessionLsid: *session0 + txnNumber: + $numberLong: '1' + startTransaction: + $$exists: false + autocommit: false + writeConcern: + $$exists: false + commandName: abortTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] + - + description: 'abort does not apply writeConcern' + operations: + - + object: *session0 + name: startTransaction + arguments: + writeConcern: + w: 10 + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + expectResult: + $$unsetOrMatches: + insertedId: + $$unsetOrMatches: 1 + - + object: *session0 + name: abortTransaction + # No write concern error + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: [] From ecda1084a7d692fb1151d31533b5137315ee9070 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 5 Feb 2024 14:34:08 -0500 Subject: [PATCH 39/55] mongos-pin-auto-tests.py and mongos-pin-auto.yml --- .../tests/legacy/mongos-pin-auto-tests.py | 340 ---- .../tests/legacy/mongos-pin-auto.yml | 1674 ----------------- .../tests/unified/mongos-pin-auto-tests.py | 335 ++++ .../tests/unified/mongos-pin-auto.yml | 1610 ++++++---------- 4 files changed, 889 insertions(+), 3070 deletions(-) delete mode 100644 source/transactions/tests/legacy/mongos-pin-auto-tests.py delete mode 100644 source/transactions/tests/legacy/mongos-pin-auto.yml create mode 100644 source/transactions/tests/unified/mongos-pin-auto-tests.py diff --git a/source/transactions/tests/legacy/mongos-pin-auto-tests.py b/source/transactions/tests/legacy/mongos-pin-auto-tests.py deleted file mode 100644 index df5905d8b2..0000000000 --- a/source/transactions/tests/legacy/mongos-pin-auto-tests.py +++ /dev/null @@ -1,340 +0,0 @@ -import itertools -import sys - -# Require Python 3.7+ for ordered dictionaries so that the order of the -# generated tests remain the same. -# Usage: -# python3.7 mongos-pin-auto-tests.py > mongos-pin-auto.yml -if sys.version_info[:2] < (3, 7): - print('ERROR: This script requires Python >= 3.7, not:') - print(sys.version) - print('Usage: python3.7 mongos-pin-auto-tests.py > mongos-pin-auto.yml') - exit(1) - -HEADER = '''# Autogenerated tests that transient errors in a transaction unpin the session. -# See mongos-pin-auto-tests.py -runOn: - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - -tests: - - description: remain pinned after non-transient Interrupted error on insertOne - useMultipleMongoses: true - operations: - - &startTransaction - name: startTransaction - object: session0 - - &initialCommand - name: insertOne - object: collection - arguments: - session: session0 - document: {_id: 3} - result: - insertedId: 3 - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - errorCodeName: Interrupted - - &assertSessionPinned - name: assertSessionPinned - object: testRunner - arguments: - session: session0 - - &commitTransaction - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - outcome: &outcome - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - - description: unpin after transient error within a transaction - useMultipleMongoses: true - operations: - - &startTransaction - name: startTransaction - object: session0 - - &initialCommand - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 3 - result: - insertedId: 3 - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - closeConnection: true - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - # Session unpins from the first mongos after the insert error and - # abortTransaction succeeds immediately on any mongos. - - &assertSessionUnpinned - name: assertSessionUnpinned - object: testRunner - arguments: - session: session0 - - &abortTransaction - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: abortTransaction - database_name: admin - - outcome: &outcome - collection: - data: *data - - # The rest of the tests in this file test every operation type against - # multiple types of transient errors (connection and error code).''' - -TEMPLATE = ''' - - description: {test_name} {error_name} error on {op_name} {command_name} - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {{times: 1}} - data: - failCommands: ["{command_name}"] - {error_data} - - name: {op_name} - object: {object_name} - arguments: - session: session0 - {op_args} - result: - {error_labels}: ["TransientTransactionError"] - - *{assertion} - - *abortTransaction - outcome: *outcome -''' - - -# Maps from op_name to (command_name, object_name, op_args) -OPS = { - # Write ops: - 'insertOne': ('insert', 'collection', r'document: {_id: 4}'), - 'insertMany': ('insert', 'collection', r'documents: [{_id: 4}, {_id: 5}]'), - 'updateOne': ('update', 'collection', r'''filter: {_id: 1} - update: {$inc: {x: 1}}'''), - 'replaceOne': ('update', 'collection', r'''filter: {_id: 1} - replacement: {y: 1}'''), - 'updateMany': ('update', 'collection', r'''filter: {_id: {$gte: 1}} - update: {$set: {z: 1}}'''), - 'deleteOne': ('delete', 'collection', r'filter: {_id: 1}'), - 'deleteMany': ('delete', 'collection', r'filter: {_id: {$gte: 1}}'), - 'findOneAndDelete': ('findAndModify', 'collection', r'filter: {_id: 1}'), - 'findOneAndUpdate': ('findAndModify', 'collection', r'''filter: {_id: 1} - update: {$inc: {x: 1}} - returnDocument: Before'''), - 'findOneAndReplace': ('findAndModify', 'collection', r'''filter: {_id: 1} - replacement: {y: 1} - returnDocument: Before'''), - # Bulk write insert/update/delete: - 'bulkWrite insert': ('insert', 'collection', r'''requests: - - name: insertOne - arguments: - document: {_id: 1}'''), - 'bulkWrite update': ('update', 'collection', r'''requests: - - name: updateOne - arguments: - filter: {_id: 1} - update: {$set: {x: 1}}'''), - 'bulkWrite delete': ('delete', 'collection', r'''requests: - - name: deleteOne - arguments: - filter: {_id: 1}'''), - # Read ops: - 'find': ('find', 'collection', r'filter: {_id: 1}'), - 'countDocuments': ('aggregate', 'collection', r'filter: {}'), - 'aggregate': ('aggregate', 'collection', r'pipeline: []'), - 'distinct': ('distinct', 'collection', r'fieldName: _id'), - # runCommand: - 'runCommand': ( - 'insert', - r'''database - command_name: insert''', # runCommand requires command_name. - r'''command: - insert: *collection_name - documents: - - _id : 1'''), -} - -# Maps from error_name to error_data. -NON_TRANSIENT_ERRORS = { - 'Interrupted': 'errorCode: 11601', -} - -# Maps from error_name to error_data. -TRANSIENT_ERRORS = { - 'connection': 'closeConnection: true', - 'ShutdownInProgress': 'errorCode: 91', -} - - -def create_pin_test(op_name, error_name): - test_name = 'remain pinned after non-transient' - assertion = 'assertSessionPinned' - error_labels = 'errorLabelsOmit' - command_name, object_name, op_args = OPS[op_name] - error_data = NON_TRANSIENT_ERRORS[error_name] - if op_name.startswith('bulkWrite'): - op_name = 'bulkWrite' - return TEMPLATE.format(**locals()) - - -def create_unpin_test(op_name, error_name): - test_name = 'unpin after transient' - assertion = 'assertSessionUnpinned' - error_labels = 'errorLabelsContain' - command_name, object_name, op_args = OPS[op_name] - error_data = TRANSIENT_ERRORS[error_name] - if op_name.startswith('bulkWrite'): - op_name = 'bulkWrite' - return TEMPLATE.format(**locals()) - -tests = [] -for op_name, error_name in itertools.product(OPS, NON_TRANSIENT_ERRORS): - tests.append(create_pin_test(op_name, error_name)) -for op_name, error_name in itertools.product(OPS, TRANSIENT_ERRORS): - tests.append(create_unpin_test(op_name, error_name)) - -print(HEADER) -print(''.join(tests)) diff --git a/source/transactions/tests/legacy/mongos-pin-auto.yml b/source/transactions/tests/legacy/mongos-pin-auto.yml deleted file mode 100644 index f5a5fe1571..0000000000 --- a/source/transactions/tests/legacy/mongos-pin-auto.yml +++ /dev/null @@ -1,1674 +0,0 @@ -# Autogenerated tests that transient errors in a transaction unpin the session. -# See mongos-pin-auto-tests.py -runOn: - - - minServerVersion: "4.1.8" - topology: ["sharded", "load-balanced"] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -database_name: &database_name "transaction-tests" -collection_name: &collection_name "test" - -data: &data - - {_id: 1} - - {_id: 2} - -tests: - - description: remain pinned after non-transient Interrupted error on insertOne - useMultipleMongoses: true - operations: - - &startTransaction - name: startTransaction - object: session0 - - &initialCommand - name: insertOne - object: collection - arguments: - session: session0 - document: {_id: 3} - result: - insertedId: 3 - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - errorCodeName: Interrupted - - &assertSessionPinned - name: assertSessionPinned - object: testRunner - arguments: - session: session0 - - &commitTransaction - name: commitTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - commitTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: commitTransaction - database_name: admin - - outcome: &outcome - collection: - data: - - {_id: 1} - - {_id: 2} - - {_id: 3} - - - description: unpin after transient error within a transaction - useMultipleMongoses: true - operations: - - &startTransaction - name: startTransaction - object: session0 - - &initialCommand - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 3 - result: - insertedId: 3 - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - closeConnection: true - - name: insertOne - object: collection - arguments: - session: session0 - document: - _id: 4 - result: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - # Session unpins from the first mongos after the insert error and - # abortTransaction succeeds immediately on any mongos. - - &assertSessionUnpinned - name: assertSessionUnpinned - object: testRunner - arguments: - session: session0 - - &abortTransaction - name: abortTransaction - object: session0 - - expectations: - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 3 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: true - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - insert: *collection_name - documents: - - _id: 4 - ordered: true - readConcern: - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - command_name: insert - database_name: *database_name - - command_started_event: - command: - abortTransaction: 1 - lsid: session0 - txnNumber: - $numberLong: "1" - startTransaction: - autocommit: false - writeConcern: - recoveryToken: 42 - command_name: abortTransaction - database_name: admin - - outcome: &outcome - collection: - data: *data - - # The rest of the tests in this file test every operation type against - # multiple types of transient errors (connection and error code). - - - description: remain pinned after non-transient Interrupted error on insertOne insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertOne - object: collection - arguments: - session: session0 - document: {_id: 4} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on insertMany insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertMany - object: collection - arguments: - session: session0 - documents: [{_id: 4}, {_id: 5}] - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on updateOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: updateOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on replaceOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: replaceOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on updateMany update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: updateMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - update: {$set: {z: 1}} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on deleteOne delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: deleteOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on deleteMany delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: deleteMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndDelete - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - returnDocument: Before - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndReplace - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - returnDocument: Before - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: insertOne - arguments: - document: {_id: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: updateOne - arguments: - filter: {_id: 1} - update: {$set: {x: 1}} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: deleteOne - arguments: - filter: {_id: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on find find - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - errorCode: 11601 - - name: find - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on countDocuments aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 11601 - - name: countDocuments - object: collection - arguments: - session: session0 - filter: {} - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on aggregate aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 11601 - - name: aggregate - object: collection - arguments: - session: session0 - pipeline: [] - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on distinct distinct - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - errorCode: 11601 - - name: distinct - object: collection - arguments: - session: session0 - fieldName: _id - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on runCommand insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - result: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on insertOne insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: insertOne - object: collection - arguments: - session: session0 - document: {_id: 4} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on insertOne insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: insertOne - object: collection - arguments: - session: session0 - document: {_id: 4} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on insertMany insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: insertMany - object: collection - arguments: - session: session0 - documents: [{_id: 4}, {_id: 5}] - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on insertMany insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: insertMany - object: collection - arguments: - session: session0 - documents: [{_id: 4}, {_id: 5}] - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on updateOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: updateOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on updateOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: updateOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on replaceOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: replaceOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on replaceOne update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: replaceOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on updateMany update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: updateMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - update: {$set: {z: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on updateMany update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: updateMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - update: {$set: {z: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on deleteOne delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: deleteOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on deleteOne delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: deleteOne - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on deleteMany delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: deleteMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on deleteMany delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: deleteMany - object: collection - arguments: - session: session0 - filter: {_id: {$gte: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndDelete findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndDelete - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndDelete - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndUpdate findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - returnDocument: Before - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndUpdate - object: collection - arguments: - session: session0 - filter: {_id: 1} - update: {$inc: {x: 1}} - returnDocument: Before - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndReplace findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndReplace - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - returnDocument: Before - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndReplace - object: collection - arguments: - session: session0 - filter: {_id: 1} - replacement: {y: 1} - returnDocument: Before - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: insertOne - arguments: - document: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: insertOne - arguments: - document: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: updateOne - arguments: - filter: {_id: 1} - update: {$set: {x: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite update - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: updateOne - arguments: - filter: {_id: 1} - update: {$set: {x: 1}} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: deleteOne - arguments: - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite delete - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: bulkWrite - object: collection - arguments: - session: session0 - requests: - - name: deleteOne - arguments: - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on find find - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - closeConnection: true - - name: find - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on find find - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - errorCode: 91 - - name: find - object: collection - arguments: - session: session0 - filter: {_id: 1} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on countDocuments aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - closeConnection: true - - name: countDocuments - object: collection - arguments: - session: session0 - filter: {} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on countDocuments aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 91 - - name: countDocuments - object: collection - arguments: - session: session0 - filter: {} - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on aggregate aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - closeConnection: true - - name: aggregate - object: collection - arguments: - session: session0 - pipeline: [] - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on aggregate aggregate - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 91 - - name: aggregate - object: collection - arguments: - session: session0 - pipeline: [] - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on distinct distinct - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - closeConnection: true - - name: distinct - object: collection - arguments: - session: session0 - fieldName: _id - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on distinct distinct - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - errorCode: 91 - - name: distinct - object: collection - arguments: - session: session0 - fieldName: _id - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on runCommand insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on runCommand insert - useMultipleMongoses: true - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: runCommand - object: database - command_name: insert - arguments: - session: session0 - command: - insert: *collection_name - documents: - - _id : 1 - result: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - diff --git a/source/transactions/tests/unified/mongos-pin-auto-tests.py b/source/transactions/tests/unified/mongos-pin-auto-tests.py new file mode 100644 index 0000000000..0cf31f9e19 --- /dev/null +++ b/source/transactions/tests/unified/mongos-pin-auto-tests.py @@ -0,0 +1,335 @@ +import itertools +import sys + +# Require Python 3.7+ for ordered dictionaries so that the order of the +# generated tests remain the same. +# Usage: +# python3.7 mongos-pin-auto-tests.py > mongos-pin-auto.yml +if sys.version_info[:2] < (3, 7): + print('ERROR: This script requires Python >= 3.7, not:') + print(sys.version) + print('Usage: python3.7 mongos-pin-auto-tests.py > mongos-pin-auto.yml') + exit(1) + +HEADER = '''# Autogenerated tests that transient errors in a transaction unpin the session. +# See mongos-pin-auto-tests.py + +description: mongos-pin-auto + +schemaVersion: '1.4' + +runOnRequirements: + - minServerVersion: "4.1.8" + topologies: [ sharded, load-balanced ] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database_name transaction-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection_name test + - session: + id: &session0 session0 + client: *client0 + +initialData: + - collectionName: *collection_name + databaseName: *database_name + documents: &data + - { _id: 1 } + - { _id: 2 } + +tests: + - description: remain pinned after non-transient Interrupted error on insertOne + operations: + - &startTransaction + object: session0 + name: startTransaction + - &initialCommand + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 3 } + expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } } + - object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ "insert" ] + errorCode: 11601 + - object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 4 } + expectError: + errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] + errorCodeName: Interrupted + - &assertSessionPinned + object: testRunner + name: assertSessionPinned + arguments: + session: *session0 + - &commitTransaction + object: *session0 + name: commitTransaction + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 3 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 4 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } + commandName: commitTransaction + databaseName: admin + outcome: + - collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + + - description: 'unpin after transient error within a transaction' + operations: + - *startTransaction + - *initialCommand + - object: testRunner + name: targetedFailPoint + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ "insert" ] + closeConnection: true + - object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 4 } + expectError: + errorLabelsContain: ["TransientTransactionError"] + errorLabelsOmit: ["UnknownTransactionCommitResult"] + - &assertSessionUnpinned + object: testRunner + name: assertSessionUnpinned + arguments: + session: *session0 + - &abortTransaction + object: *session0 + name: abortTransaction + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 3 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 4 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - commandStartedEvent: + command: + abortTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } + commandName: abortTransaction + databaseName: admin + outcome: &outcome + - collectionName: *collection_name + databaseName: *database_name + documents: *data + + # The rest of the tests in this file test every operation type against + # multiple types of transient errors (connection and error code).''' + +TEMPLATE = ''' + - description: {test_name} {error_name} error on {op_name} {command_name} + operations: + - *startTransaction + - *initialCommand + - name: targetedFailPoint + object: testRunner + arguments: + session: *session0 + failPoint: + configureFailPoint: failCommand + mode: {{times: 1}} + data: + failCommands: ["{command_name}"] + {error_data} + - name: {op_name} + object: {object_name} + arguments: + session: *session0 + {op_args} + expectError: + {error_labels}: ["TransientTransactionError"] + - *{assertion} + - *abortTransaction + outcome: *outcome +''' + + +# Maps from op_name to (command_name, object_name, op_args) +OPS = { + # Write ops: + 'insertOne': ('insert', '*collection0', r'document: { _id: 4 }'), + 'insertMany': ('insert', '*collection0', r'documents: [ { _id: 4 }, { _id: 5 } ]'), + 'updateOne': ('update', '*collection0', r'''filter: { _id: 1 } + update: { $inc: { x: 1 } }'''), + 'replaceOne': ('update', '*collection0', r'''filter: { _id: 1 } + replacement: { y: 1 }'''), + 'updateMany': ('update', '*collection0', r'''filter: { _id: { $gte: 1 } } + update: {$set: { z: 1 } }'''), + 'deleteOne': ('delete', '*collection0', r'filter: { _id: 1 }'), + 'deleteMany': ('delete', '*collection0', r'filter: { _id: { $gte: 1 } }'), + 'findOneAndDelete': ('findAndModify', '*collection0', r'filter: { _id: 1 }'), + 'findOneAndUpdate': ('findAndModify', '*collection0', r'''filter: { _id: 1 } + update: { $inc: { x: 1 } } + returnDocument: Before'''), + 'findOneAndReplace': ('findAndModify', '*collection0', r'''filter: { _id: 1 } + replacement: { y: 1 } + returnDocument: Before'''), + # Bulk write insert/update/delete: + 'bulkWrite insert': ('insert', '*collection0', r'''requests: + - insertOne: + document: { _id: 1 }'''), + 'bulkWrite update': ('update', '*collection0', r'''requests: + - updateOne: + filter: { _id: 1 } + update: { $set: { x: 1 } }'''), + 'bulkWrite delete': ('delete', '*collection0', r'''requests: + - deleteOne: + filter: { _id: 1 }'''), + # Read ops: + 'find': ('find', '*collection0', r'filter: { _id: 1 }'), + 'countDocuments': ('aggregate', '*collection0', r'filter: {}'), + 'aggregate': ('aggregate', '*collection0', r'pipeline: []'), + 'distinct': ('distinct', '*collection0', r'''fieldName: _id + filter: {}'''), + # runCommand: + 'runCommand': ('insert', '*database0', r'''commandName: insert + command: + insert: *collection_name + documents: + - { _id : 1 }'''), +} + +# Maps from error_name to error_data. +NON_TRANSIENT_ERRORS = { + 'Interrupted': 'errorCode: 11601', +} + +# Maps from error_name to error_data. +TRANSIENT_ERRORS = { + 'connection': 'closeConnection: true', + 'ShutdownInProgress': 'errorCode: 91', +} + + +def create_pin_test(op_name, error_name): + test_name = 'remain pinned after non-transient' + assertion = 'assertSessionPinned' + error_labels = 'errorLabelsOmit' + command_name, object_name, op_args = OPS[op_name] + error_data = NON_TRANSIENT_ERRORS[error_name] + if op_name.startswith('bulkWrite'): + op_name = 'bulkWrite' + return TEMPLATE.format(**locals()) + + +def create_unpin_test(op_name, error_name): + test_name = 'unpin after transient' + assertion = 'assertSessionUnpinned' + error_labels = 'errorLabelsContain' + command_name, object_name, op_args = OPS[op_name] + error_data = TRANSIENT_ERRORS[error_name] + if op_name.startswith('bulkWrite'): + op_name = 'bulkWrite' + return TEMPLATE.format(**locals()) + + +tests = [] +for op_name, error_name in itertools.product(OPS, NON_TRANSIENT_ERRORS): + tests.append(create_pin_test(op_name, error_name)) +for op_name, error_name in itertools.product(OPS, TRANSIENT_ERRORS): + tests.append(create_unpin_test(op_name, error_name)) + +print(HEADER) +print(''.join(tests)) diff --git a/source/transactions/tests/unified/mongos-pin-auto.yml b/source/transactions/tests/unified/mongos-pin-auto.yml index ee2c3e1b7c..0f5979aafb 100644 --- a/source/transactions/tests/unified/mongos-pin-auto.yml +++ b/source/transactions/tests/unified/mongos-pin-auto.yml @@ -1,92 +1,71 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. +# Autogenerated tests that transient errors in a transaction unpin the session. +# See mongos-pin-auto-tests.py description: mongos-pin-auto -schemaVersion: '1.3' + +schemaVersion: '1.4' + +runOnRequirements: + - minServerVersion: "4.1.8" + topologies: [ sharded, load-balanced ] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" + createEntities: - - - client: + - client: id: &client0 client0 - useMultipleMongoses: false - observeEvents: - - commandStartedEvent - - - database: + useMultipleMongoses: true + observeEvents: [ commandStartedEvent ] + - database: id: &database0 database0 client: *client0 databaseName: &database_name transaction-tests - - - collection: + - collection: id: &collection0 collection0 database: *database0 collectionName: &collection_name test - - - session: + - session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 -runOnRequirements: - - - minServerVersion: 4.1.8 - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - - - collectionName: *collection_name + - collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } + tests: - - - description: 'remain pinned after non-transient Interrupted error on insertOne' - useMultipleMongoses: true + - description: remain pinned after non-transient Interrupted error on insertOne operations: - &startTransaction - object: *session0 + object: session0 name: startTransaction - &initialCommand object: *collection0 name: insertOne arguments: session: *session0 - document: - _id: 3 - expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 - - - object: testRunner + document: { _id: 3 } + expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } } + - object: testRunner name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: - failCommands: - - insert + failCommands: [ "insert" ] errorCode: 11601 - - - object: *collection0 + - object: *collection0 name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: - errorLabelsOmit: - - TransientTransactionError - - UnknownTransactionCommitResult + errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] errorCodeName: Interrupted - &assertSessionPinned object: testRunner @@ -97,121 +76,77 @@ tests: object: *session0 name: commitTransaction expectEvents: - - - client: *client0 + - client: *client0 events: - - - commandStartedEvent: + - commandStartedEvent: command: insert: *collection_name documents: - - - _id: 3 + - { _id: 3 } ordered: true - readConcern: - $$exists: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - - - commandStartedEvent: + - commandStartedEvent: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true - readConcern: - $$exists: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: - $$exists: false + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - - - commandStartedEvent: + - commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: - $$exists: false + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin - outcome: &outcome - - - collectionName: *collection_name + outcome: + - collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - description: 'unpin after transient error within a transaction' - useMultipleMongoses: true + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + + - description: 'unpin after transient error within a transaction' operations: - - &startTransaction - object: *session0 - name: startTransaction - - &initialCommand - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: - _id: 3 - expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 - - - object: testRunner + - *startTransaction + - *initialCommand + - object: testRunner name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: - failCommands: - - insert + failCommands: [ "insert" ] closeConnection: true - - - object: *collection0 + - object: *collection0 name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: - errorLabelsContain: - - TransientTransactionError - errorLabelsOmit: - - UnknownTransactionCommitResult + errorLabelsContain: ["TransientTransactionError"] + errorLabelsOmit: ["UnknownTransactionCommitResult"] - &assertSessionUnpinned object: testRunner name: assertSessionUnpinned @@ -221,1896 +156,1459 @@ tests: object: *session0 name: abortTransaction expectEvents: - - - client: *client0 + - client: *client0 events: - - - commandStartedEvent: + - commandStartedEvent: command: insert: *collection_name documents: - - - _id: 3 + - { _id: 3 } ordered: true - readConcern: - $$exists: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - - - commandStartedEvent: + - commandStartedEvent: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true - readConcern: - $$exists: false - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: - $$exists: false + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - - - commandStartedEvent: + - commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 - txnNumber: - $numberLong: '1' - startTransaction: - $$exists: false + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: abortTransaction databaseName: admin outcome: &outcome - - - collectionName: *collection_name + - collectionName: *collection_name databaseName: *database_name documents: *data - - - description: 'remain pinned after non-transient Interrupted error on insertOne insert' - useMultipleMongoses: true + + # The rest of the tests in this file test every operation type against + # multiple types of transient errors (connection and error code). + + - description: remain pinned after non-transient Interrupted error on insertOne insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 11601 - - + - name: insertOne object: *collection0 - name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on insertMany insert' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on insertMany insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 11601 - - + - name: insertMany object: *collection0 - name: insertMany arguments: session: *session0 - documents: - - - _id: 4 - - - _id: 5 + documents: [ { _id: 4 }, { _id: 5 } ] expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on updateOne update' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on updateOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 11601 - - + - name: updateOne object: *collection0 - name: updateOne arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on replaceOne update' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on replaceOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 11601 - - + - name: replaceOne object: *collection0 - name: replaceOne arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on updateMany update' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on updateMany update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 11601 - - + - name: updateMany object: *collection0 - name: updateMany arguments: session: *session0 - filter: - _id: - $gte: 1 - update: - $set: - z: 1 + filter: { _id: { $gte: 1 } } + update: {$set: { z: 1 } } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on deleteOne delete' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on deleteOne delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 11601 - - + - name: deleteOne object: *collection0 - name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on deleteMany delete' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on deleteMany delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 11601 - - + - name: deleteMany object: *collection0 - name: deleteMany arguments: session: *session0 - filter: - _id: - $gte: 1 + filter: { _id: { $gte: 1 } } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 11601 - - + - name: findOneAndDelete object: *collection0 - name: findOneAndDelete arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 11601 - - + - name: findOneAndUpdate object: *collection0 - name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } returnDocument: Before expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 11601 - - + - name: findOneAndReplace object: *collection0 - name: findOneAndReplace arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } returnDocument: Before expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on bulkWrite insert' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on bulkWrite insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 11601 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - insertOne: - document: - _id: 1 + - insertOne: + document: { _id: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on bulkWrite update' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on bulkWrite update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 11601 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - updateOne: - filter: - _id: 1 - update: - $set: - x: 1 + - updateOne: + filter: { _id: 1 } + update: { $set: { x: 1 } } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on bulkWrite delete' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on bulkWrite delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 11601 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - deleteOne: - filter: - _id: 1 + - deleteOne: + filter: { _id: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on find find' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on find find operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - find + failCommands: ["find"] errorCode: 11601 - - + - name: find object: *collection0 - name: find arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on countDocuments aggregate' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on countDocuments aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] errorCode: 11601 - - + - name: countDocuments object: *collection0 - name: countDocuments arguments: session: *session0 - filter: { } + filter: {} expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on aggregate aggregate' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on aggregate aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] errorCode: 11601 - - + - name: aggregate object: *collection0 - name: aggregate arguments: session: *session0 pipeline: [] expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on distinct distinct' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on distinct distinct operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - distinct + failCommands: ["distinct"] errorCode: 11601 - - + - name: distinct object: *collection0 - name: distinct arguments: session: *session0 fieldName: _id + filter: {} expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'remain pinned after non-transient Interrupted error on runCommand insert' - useMultipleMongoses: true + + - description: remain pinned after non-transient Interrupted error on runCommand insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 11601 - - + - name: runCommand object: *database0 - name: runCommand arguments: session: *session0 + commandName: insert command: insert: *collection_name documents: - - - _id: 1 - commandName: insert + - { _id : 1 } expectError: - errorLabelsOmit: - - TransientTransactionError + errorLabelsOmit: ["TransientTransactionError"] - *assertSessionPinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on insertOne insert' - useMultipleMongoses: true + + - description: unpin after transient connection error on insertOne insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] closeConnection: true - - + - name: insertOne object: *collection0 - name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on insertOne insert' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on insertOne insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 91 - - + - name: insertOne object: *collection0 - name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on insertMany insert' - useMultipleMongoses: true + + - description: unpin after transient connection error on insertMany insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] closeConnection: true - - + - name: insertMany object: *collection0 - name: insertMany arguments: session: *session0 - documents: - - - _id: 4 - - - _id: 5 + documents: [ { _id: 4 }, { _id: 5 } ] expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on insertMany insert' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on insertMany insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 91 - - + - name: insertMany object: *collection0 - name: insertMany arguments: session: *session0 - documents: - - - _id: 4 - - - _id: 5 + documents: [ { _id: 4 }, { _id: 5 } ] expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on updateOne update' - useMultipleMongoses: true + + - description: unpin after transient connection error on updateOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] closeConnection: true - - + - name: updateOne object: *collection0 - name: updateOne arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on updateOne update' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on updateOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 91 - - + - name: updateOne object: *collection0 - name: updateOne arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on replaceOne update' - useMultipleMongoses: true + + - description: unpin after transient connection error on replaceOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] closeConnection: true - - + - name: replaceOne object: *collection0 - name: replaceOne arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on replaceOne update' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on replaceOne update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 91 - - + - name: replaceOne object: *collection0 - name: replaceOne arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on updateMany update' - useMultipleMongoses: true + + - description: unpin after transient connection error on updateMany update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] closeConnection: true - - + - name: updateMany object: *collection0 - name: updateMany arguments: session: *session0 - filter: - _id: - $gte: 1 - update: - $set: - z: 1 + filter: { _id: { $gte: 1 } } + update: {$set: { z: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on updateMany update' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on updateMany update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 91 - - + - name: updateMany object: *collection0 - name: updateMany arguments: session: *session0 - filter: - _id: - $gte: 1 - update: - $set: - z: 1 + filter: { _id: { $gte: 1 } } + update: {$set: { z: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on deleteOne delete' - useMultipleMongoses: true + + - description: unpin after transient connection error on deleteOne delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] closeConnection: true - - + - name: deleteOne object: *collection0 - name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on deleteOne delete' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on deleteOne delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 91 - - + - name: deleteOne object: *collection0 - name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on deleteMany delete' - useMultipleMongoses: true + + - description: unpin after transient connection error on deleteMany delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] closeConnection: true - - + - name: deleteMany object: *collection0 - name: deleteMany arguments: session: *session0 - filter: - _id: - $gte: 1 + filter: { _id: { $gte: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on deleteMany delete' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on deleteMany delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 91 - - + - name: deleteMany object: *collection0 - name: deleteMany arguments: session: *session0 - filter: - _id: - $gte: 1 + filter: { _id: { $gte: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on findOneAndDelete findAndModify' - useMultipleMongoses: true + + - description: unpin after transient connection error on findOneAndDelete findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] closeConnection: true - - + - name: findOneAndDelete object: *collection0 - name: findOneAndDelete arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 91 - - + - name: findOneAndDelete object: *collection0 - name: findOneAndDelete arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on findOneAndUpdate findAndModify' - useMultipleMongoses: true + + - description: unpin after transient connection error on findOneAndUpdate findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] closeConnection: true - - + - name: findOneAndUpdate object: *collection0 - name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } returnDocument: Before expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 91 - - + - name: findOneAndUpdate object: *collection0 - name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - x: 1 + filter: { _id: 1 } + update: { $inc: { x: 1 } } returnDocument: Before expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on findOneAndReplace findAndModify' - useMultipleMongoses: true + + - description: unpin after transient connection error on findOneAndReplace findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] closeConnection: true - - + - name: findOneAndReplace object: *collection0 - name: findOneAndReplace arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } returnDocument: Before expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - findAndModify + failCommands: ["findAndModify"] errorCode: 91 - - + - name: findOneAndReplace object: *collection0 - name: findOneAndReplace arguments: session: *session0 - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } returnDocument: Before expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on bulkWrite insert' - useMultipleMongoses: true + + - description: unpin after transient connection error on bulkWrite insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] closeConnection: true - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - insertOne: - document: - _id: 1 + - insertOne: + document: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on bulkWrite insert' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on bulkWrite insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 91 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - insertOne: - document: - _id: 1 + - insertOne: + document: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on bulkWrite update' - useMultipleMongoses: true + + - description: unpin after transient connection error on bulkWrite update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] closeConnection: true - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - updateOne: - filter: - _id: 1 - update: - $set: - x: 1 + - updateOne: + filter: { _id: 1 } + update: { $set: { x: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on bulkWrite update' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on bulkWrite update operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - update + failCommands: ["update"] errorCode: 91 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - updateOne: - filter: - _id: 1 - update: - $set: - x: 1 + - updateOne: + filter: { _id: 1 } + update: { $set: { x: 1 } } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on bulkWrite delete' - useMultipleMongoses: true + + - description: unpin after transient connection error on bulkWrite delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] closeConnection: true - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - deleteOne: - filter: - _id: 1 + - deleteOne: + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on bulkWrite delete' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on bulkWrite delete operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - delete + failCommands: ["delete"] errorCode: 91 - - + - name: bulkWrite object: *collection0 - name: bulkWrite arguments: session: *session0 requests: - - - deleteOne: - filter: - _id: 1 + - deleteOne: + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on find find' - useMultipleMongoses: true + + - description: unpin after transient connection error on find find operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - find + failCommands: ["find"] closeConnection: true - - + - name: find object: *collection0 - name: find arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on find find' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on find find operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - find + failCommands: ["find"] errorCode: 91 - - + - name: find object: *collection0 - name: find arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on countDocuments aggregate' - useMultipleMongoses: true + + - description: unpin after transient connection error on countDocuments aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] closeConnection: true - - + - name: countDocuments object: *collection0 - name: countDocuments arguments: session: *session0 - filter: { } + filter: {} expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on countDocuments aggregate' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on countDocuments aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] errorCode: 91 - - + - name: countDocuments object: *collection0 - name: countDocuments arguments: session: *session0 - filter: { } + filter: {} expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on aggregate aggregate' - useMultipleMongoses: true + + - description: unpin after transient connection error on aggregate aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] closeConnection: true - - + - name: aggregate object: *collection0 - name: aggregate arguments: session: *session0 pipeline: [] expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on aggregate aggregate' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on aggregate aggregate operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - aggregate + failCommands: ["aggregate"] errorCode: 91 - - + - name: aggregate object: *collection0 - name: aggregate arguments: session: *session0 pipeline: [] expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on distinct distinct' - useMultipleMongoses: true + + - description: unpin after transient connection error on distinct distinct operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - distinct + failCommands: ["distinct"] closeConnection: true - - + - name: distinct object: *collection0 - name: distinct arguments: session: *session0 fieldName: _id + filter: {} expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on distinct distinct' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on distinct distinct operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - distinct + failCommands: ["distinct"] errorCode: 91 - - + - name: distinct object: *collection0 - name: distinct arguments: session: *session0 fieldName: _id + filter: {} expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient connection error on runCommand insert' - useMultipleMongoses: true + + - description: unpin after transient connection error on runCommand insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] closeConnection: true - - + - name: runCommand object: *database0 - name: runCommand arguments: session: *session0 + commandName: insert command: insert: *collection_name documents: - - - _id: 1 - commandName: insert + - { _id : 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction outcome: *outcome - - - description: 'unpin after transient ShutdownInProgress error on runCommand insert' - useMultipleMongoses: true + + - description: unpin after transient ShutdownInProgress error on runCommand insert operations: - *startTransaction - *initialCommand - - + - name: targetedFailPoint object: testRunner - name: targetedFailPoint arguments: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: {times: 1} data: - failCommands: - - insert + failCommands: ["insert"] errorCode: 91 - - + - name: runCommand object: *database0 - name: runCommand arguments: session: *session0 + commandName: insert command: insert: *collection_name documents: - - - _id: 1 - commandName: insert + - { _id : 1 } expectError: - errorLabelsContain: - - TransientTransactionError + errorLabelsContain: ["TransientTransactionError"] - *assertSessionUnpinned - *abortTransaction - outcome: *outcome \ No newline at end of file + outcome: *outcome + From ea4905e48976e6012e7adc67bb86fc1d50fb0e9a Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 10:13:45 -0500 Subject: [PATCH 40/55] Reorder top-level fields --- source/transactions/tests/unified/abort.yml | 28 ++++++------ source/transactions/tests/unified/bulk.yml | 28 ++++++------ .../tests/unified/causal-consistency.yml | 28 ++++++------ source/transactions/tests/unified/commit.yml | 28 ++++++------ source/transactions/tests/unified/count.yml | 30 +++++++------ .../tests/unified/create-collection.yml | 22 +++++----- .../tests/unified/create-index.yml | 21 ++++----- source/transactions/tests/unified/delete.yml | 28 ++++++------ .../unified/error-labels-blockConnection.yml | 22 +++++----- .../unified/error-labels-errorLabels.yml | 28 ++++++------ .../tests/unified/error-labels.yml | 34 +++++++------- .../tests/unified/errors-client.yml | 28 ++++++------ source/transactions/tests/unified/errors.yml | 28 ++++++------ .../tests/unified/findOneAndDelete.yml | 28 ++++++------ .../tests/unified/findOneAndReplace.yml | 28 ++++++------ .../tests/unified/findOneAndUpdate.yml | 28 ++++++------ source/transactions/tests/unified/insert.yml | 28 ++++++------ .../transactions/tests/unified/isolation.yml | 28 ++++++------ .../mongos-recovery-token-errorLabels.yml | 24 +++++----- .../tests/unified/mongos-recovery-token.yml | 24 +++++----- .../transactions/tests/unified/pin-mongos.yml | 26 ++++++----- .../tests/unified/read-concern.yml | 28 ++++++------ .../transactions/tests/unified/read-pref.yml | 28 ++++++------ source/transactions/tests/unified/reads.yml | 28 ++++++------ .../unified/retryable-abort-errorLabels.yml | 22 +++++----- .../tests/unified/retryable-abort.yml | 28 ++++++------ ...e-commit-errorLabels-forbid_serverless.yml | 38 ++++++++-------- .../unified/retryable-commit-errorLabels.yml | 22 +++++----- .../retryable-commit-forbid_serverless.yml | 44 ++++++++++--------- .../tests/unified/retryable-commit.yml | 28 ++++++------ .../tests/unified/retryable-writes.yml | 28 ++++++------ .../tests/unified/run-command.yml | 28 ++++++------ .../unified/transaction-options-repl.yml | 18 ++++---- .../tests/unified/transaction-options.yml | 28 ++++++------ source/transactions/tests/unified/update.yml | 28 ++++++------ .../tests/unified/write-concern.yml | 28 ++++++------ 36 files changed, 531 insertions(+), 460 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index a2a0253337..445601165e 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: abort + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: abort diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index feb0a76f27..227d4af406 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: bulk + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: bulk diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index c33d91e56b..bf2d73640a 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: causal-consistency + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -32,16 +42,7 @@ createEntities: client: *client0 sessionOptions: causalConsistency: false -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -50,6 +51,7 @@ initialData: - _id: 1 count: 0 + tests: - description: 'causal consistency' diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index 302ea54565..d99ef6feaf 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: commit + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -47,21 +57,13 @@ createEntities: session: id: &session1 session1 client: *client1 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: commit diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 4ad100c7df..9d9b28d089 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -1,8 +1,19 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: count + schemaVersion: '1.3' + +runOnRequirements: + # SERVER-35388 introduced OperationNotSupportedInTransaction in 4.0.2 + - + minServerVersion: 4.0.2 + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,17 +39,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - # SERVER-35388 introduced OperationNotSupportedInTransaction in 4.0.2 - - - minServerVersion: 4.0.2 - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -52,6 +53,7 @@ initialData: _id: 3 - _id: 4 + tests: - description: count diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 9fa188ced5..6fd3fdff32 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -1,8 +1,15 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: create-collection + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: 4.3.4 + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -28,18 +35,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.4 - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'explicitly create collection using create command' diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index c47b1be3da..1937881bbb 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -1,8 +1,15 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: create-index + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: 4.3.4 + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -28,13 +35,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.4 - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index 5986009987..f926d04da8 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: delete + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,16 +38,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -53,6 +54,7 @@ initialData: _id: 4 - _id: 5 + tests: - description: delete diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index 64cf955944..54d6794164 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -1,6 +1,3 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - # This file contains a single test that should be in error-labels.yml. The test # was moved from error-labels.yml during the spec work for client-side # operations timeout because it uses the blockConnection parameter in @@ -8,7 +5,17 @@ # merged back into error-labels.yml when that test file is ported to the # unified test format as the format allows for per-test runOn requirements. description: error-labels-blockConnection + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.2' + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -36,18 +43,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.2' - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: # This test previously used failCommand with closeConnection=true to force a # network error, but this does not work after CSOT is implemented because diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 3da86b5465..077ac2aed4 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: error-labels-errorLabels + schemaVersion: '1.4' + +runOnRequirements: + - + minServerVersion: 4.3.1 # failCommand errorLabels option + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: forbid + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: forbid - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors' diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index c251d5fde8..45b50ee47a 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -1,8 +1,21 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: error-labels + schemaVersion: '1.4' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: forbid + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,24 +41,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'DuplicateKey errors do not contain transient label' diff --git a/source/transactions/tests/unified/errors-client.yml b/source/transactions/tests/unified/errors-client.yml index 823a100992..00bf1bac4f 100644 --- a/source/transactions/tests/unified/errors-client.yml +++ b/source/transactions/tests/unified/errors-client.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: errors-client + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'Client side error in command starting transaction' diff --git a/source/transactions/tests/unified/errors.yml b/source/transactions/tests/unified/errors.yml index e0d1feb9e1..972a74a564 100644 --- a/source/transactions/tests/unified/errors.yml +++ b/source/transactions/tests/unified/errors.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: errors + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'start insert start' diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index 17a66a6ebf..0fbbb01418 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: findOneAndDelete + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,16 +38,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -49,6 +50,7 @@ initialData: _id: 2 - _id: 3 + tests: - description: findOneAndDelete diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 1ae50c0913..4f4ec7103c 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: findOneAndReplace + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,16 +38,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -49,6 +50,7 @@ initialData: _id: 2 - _id: 3 + tests: - description: findOneAndReplace diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 7c5306b2fe..69674c7e62 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: findOneAndUpdate + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,16 +38,7 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -49,6 +50,7 @@ initialData: _id: 2 - _id: 3 + tests: - description: findOneAndUpdate diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index cdeabde564..f9244dc769 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: insert + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,21 +38,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: insert diff --git a/source/transactions/tests/unified/isolation.yml b/source/transactions/tests/unified/isolation.yml index 4b72d1d8cb..3d236732d7 100644 --- a/source/transactions/tests/unified/isolation.yml +++ b/source/transactions/tests/unified/isolation.yml @@ -1,10 +1,20 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - # Test snapshot isolation. # This test doesn't check contents of command-started events. description: isolation + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -30,21 +40,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'one transaction' diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index 9711b51e51..7e875b88b2 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -1,8 +1,16 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: mongos-recovery-token-errorLabels + schemaVersion: '1.4' + +runOnRequirements: + - + minServerVersion: 4.3.1 # failCommand errorLabels option + # serverless proxy doesn't use recovery tokens + serverless: forbid + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,19 +36,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - # serverless proxy doesn't use recovery tokens - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction retry succeeds on new mongos' diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index ba621a5402..4f36158c66 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -1,8 +1,16 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: mongos-recovery-token + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: 4.1.8 + # serverless proxy doesn't use recovery tokens + serverless: forbid + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -28,19 +36,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.1.8 - # serverless proxy doesn't use recovery tokens - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction explicit retries include recoveryToken' diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 2615531d6b..95d7291b10 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -1,6 +1,3 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - # Test that all the operations go to the same mongos. # # In tests that don't include command-started events the assertion is implicit: @@ -16,7 +13,19 @@ # 'errorLabels': ['TransientTransactionError'] # } description: pin-mongos + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: 4.1.8 + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: forbid + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -38,15 +47,7 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: 4.1.8 - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -56,6 +57,7 @@ initialData: _id: 1 - _id: 2 + tests: - description: countDocuments diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index 1b2f98f0d8..8b14618bb6 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: read-concern + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -33,16 +43,7 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -56,6 +57,7 @@ initialData: _id: 3 - _id: 4 + tests: - description: 'only first countDocuments includes readConcern' diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml index fa130648c2..621a5ae7bc 100644 --- a/source/transactions/tests/unified/read-pref.yml +++ b/source/transactions/tests/unified/read-pref.yml @@ -1,9 +1,19 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - # This test doesn't check contents of command-started events. description: read-pref + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -35,21 +45,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'default readPreference' diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 6cea7dd65d..33e4e7bacf 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: reads + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,16 +34,7 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -47,6 +48,7 @@ initialData: _id: 3 - _id: 4 + tests: - description: 'collection readConcern without transaction' diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index eed127245d..7378c43092 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -1,8 +1,15 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-abort-errorLabels + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: 4.3.1 # failCommand errorLabels option + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -28,18 +35,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'abortTransaction only retries once with RetryableWriteError from server' diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index 4f92db1520..d165a6341d 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-abort + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -47,21 +57,13 @@ createEntities: session: id: &session1 session1 client: *client1 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'abortTransaction only performs a single retry' diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 875c2bac22..749952f4b3 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -1,8 +1,23 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-commit-errorLabels-forbid_serverless + schemaVersion: '1.4' + +runOnRequirements: + - + minServerVersion: 4.3.1 # failCommand errorLabels option + # This file contains tests originally found in retryable-commit.yml that + # are incompatible with serverless: + # + # * Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + # * Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). + serverless: forbid + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -28,26 +43,13 @@ createEntities: session: id: &session1 session1 client: *client0 -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: forbid - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction succeeds after InterruptedAtShutdown' diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index b5dd76e829..62fa146767 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -1,8 +1,15 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-commit-errorLabels + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: 4.3.1 # failCommand errorLabels option + topologies: + - replicaset + - sharded + - load-balanced + createEntities: - client: @@ -47,18 +54,13 @@ createEntities: session: id: &session1 session1 client: *client1 -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - topologies: - - replicaset - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction does not retry error without RetryableWriteError label' diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 59d9b108f2..92f223ba3e 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -1,8 +1,26 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-commit-forbid_serverless + schemaVersion: '1.4' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + # This file contains tests originally found in retryable-commit.yml that + # are incompatible with serverless: + # + # * Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + # * Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). + serverless: forbid + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -47,29 +65,13 @@ createEntities: session: id: &session1 session1 client: *client1 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: forbid - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction fails after two errors' diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 5e7272a8f4..2cc26d9ff2 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-commit + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,21 +34,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'commitTransaction fails after Interrupted' diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index c324214923..e34aa8d420 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: retryable-writes + schemaVersion: '1.3' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,21 +34,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'increment txnNumber' diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index 91a304b82d..b7abd2adcf 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: run-command + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,21 +34,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'run command with default read preference' diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index e576428b6a..3228352135 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -1,8 +1,13 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: transaction-options-repl + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + createEntities: - client: @@ -24,16 +29,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'readConcern snapshot in startTransaction options' diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index d5d66fefc8..fe47ae94b7 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: transaction-options + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,21 +34,13 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name databaseName: *database_name documents: [] + tests: - description: 'no transaction options set' diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index e3e470d47e..d1b56bafba 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -1,8 +1,18 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - description: update + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -24,16 +34,7 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -45,6 +46,7 @@ initialData: _id: 2 - _id: 3 + tests: - description: update diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index f6b48f2e56..a35b137cca 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -1,10 +1,20 @@ -# This file was created automatically using mongodb-spec-converter. -# Please review the generated file, then remove this notice. - # Assumes the default for transactions is the same as for all ops, tests # setting the writeConcern to "majority". description: write-concern + schemaVersion: '1.9' + +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - replicaset + - + minServerVersion: 4.1.8 + topologies: + - sharded + - load-balanced + createEntities: - client: @@ -33,16 +43,7 @@ createEntities: session: id: &session0 session0 client: *client0 -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - topologies: - - sharded - - load-balanced + initialData: - collectionName: *collection_name @@ -50,6 +51,7 @@ initialData: documents: &data - _id: 0 + tests: - description: 'commit with majority' From cf9d577def71c807aa59b7b91bccc73c5cc9057b Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 10:24:46 -0500 Subject: [PATCH 41/55] Consolidate $$unsetOrMatches --- source/transactions/tests/unified/abort.yml | 28 ++------ source/transactions/tests/unified/bulk.yml | 28 +++----- .../tests/unified/causal-consistency.yml | 22 ++---- source/transactions/tests/unified/commit.yml | 48 ++++--------- .../tests/unified/create-collection.yml | 4 +- .../unified/error-labels-blockConnection.yml | 4 +- .../unified/error-labels-errorLabels.yml | 8 +-- .../tests/unified/error-labels.yml | 36 +++------- .../tests/unified/errors-client.yml | 4 +- source/transactions/tests/unified/errors.yml | 16 ++--- source/transactions/tests/unified/insert.yml | 28 ++------ .../transactions/tests/unified/isolation.yml | 8 +-- .../mongos-recovery-token-errorLabels.yml | 4 +- .../tests/unified/mongos-recovery-token.yml | 12 +--- .../transactions/tests/unified/pin-mongos.yml | 60 ++++------------ .../transactions/tests/unified/read-pref.yml | 4 +- .../unified/retryable-abort-errorLabels.yml | 68 +++++-------------- .../tests/unified/retryable-abort.yml | 16 ++--- ...e-commit-errorLabels-forbid_serverless.yml | 8 +-- .../unified/retryable-commit-errorLabels.yml | 60 ++++------------ .../retryable-commit-forbid_serverless.yml | 12 +--- .../tests/unified/retryable-commit.yml | 8 +-- .../tests/unified/retryable-writes.yml | 12 +--- .../unified/transaction-options-repl.yml | 8 +-- .../tests/unified/transaction-options.yml | 60 ++++------------ source/transactions/tests/unified/update.yml | 24 +++---- .../tests/unified/write-concern.yml | 23 ++----- 27 files changed, 159 insertions(+), 454 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index 445601165e..792e9963ae 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -60,9 +60,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -77,9 +75,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -178,9 +174,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # The original legacy test relied on the test runner to call endSession after all operations. Since the unified # test runner has no such behavior, we manually call endSession as the last operation. - @@ -244,9 +238,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -354,9 +346,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -425,9 +415,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Abort the server transaction with a duplicate key error - object: *collection0 @@ -563,9 +551,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index 227d4af406..eeed3c53e9 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -60,9 +60,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: deleteOne @@ -249,18 +247,15 @@ tests: _id: 1 u: $set: { x: 1 } - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } - q: _id: 2 u: $set: { x: 2 } upsert: true - multi: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -310,19 +305,15 @@ tests: _id: 1 u: 'y': 1 - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } - q: _id: 2 u: 'y': 2 - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -371,8 +362,7 @@ tests: u: $set: { z: 1 } multi: true - upsert: - $$unsetOrMatches: false + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index bf2d73640a..843b583ed9 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -94,10 +94,8 @@ tests: _id: 1 u: $inc: { count: 1 } - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -123,10 +121,8 @@ tests: _id: 1 u: $inc: { count: 1 } - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true readConcern: afterClusterTime: @@ -176,9 +172,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session_no_cc name: startTransaction @@ -233,10 +227,8 @@ tests: _id: 1 u: $inc: { count: 1 } - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true # No afterClusterTime readConcern: diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index d99ef6feaf..b977a3c04c 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -79,9 +79,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -97,9 +95,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session0 name: commitTransaction @@ -211,9 +207,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -277,9 +271,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -385,9 +377,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -464,9 +454,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -528,9 +516,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -557,9 +543,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -658,9 +642,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -673,9 +655,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } # Calling commit again should error instead of re-running the commit - object: *session1 @@ -764,9 +744,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: abortTransaction @@ -779,9 +757,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } # Calling abort should error with "no transaction started" instead of "cannot call abortTransaction twice" - object: *session1 diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 6fd3fdff32..27c0a807a2 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -135,9 +135,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: testRunner name: assertCollectionNotExists diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index 54d6794164..bcabc35d04 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -86,9 +86,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 077ac2aed4..3c166ab80c 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -75,9 +75,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -203,9 +201,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 45b50ee47a..0ca965cc20 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -388,9 +388,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -632,9 +630,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -837,9 +833,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -950,9 +944,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1060,9 +1052,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1149,9 +1139,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1233,9 +1221,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: aggregate @@ -1348,9 +1334,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1461,9 +1445,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/errors-client.yml b/source/transactions/tests/unified/errors-client.yml index 00bf1bac4f..9261ed9cad 100644 --- a/source/transactions/tests/unified/errors-client.yml +++ b/source/transactions/tests/unified/errors-client.yml @@ -83,9 +83,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: updateOne diff --git a/source/transactions/tests/unified/errors.yml b/source/transactions/tests/unified/errors.yml index 972a74a564..7a90aae48f 100644 --- a/source/transactions/tests/unified/errors.yml +++ b/source/transactions/tests/unified/errors.yml @@ -60,9 +60,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: startTransaction @@ -99,9 +97,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -128,9 +124,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: startTransaction @@ -173,9 +167,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: startTransaction diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index f9244dc769..3be8489e65 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -60,9 +60,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: insertMany @@ -87,9 +85,7 @@ tests: document: _id: 4 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 4 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - object: *session0 name: commitTransaction @@ -104,9 +100,7 @@ tests: document: _id: 5 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 5 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } - object: *session0 name: commitTransaction @@ -254,9 +248,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: insertMany @@ -287,9 +279,7 @@ tests: document: _id: 4 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 4 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - object: *session1 name: abortTransaction @@ -437,9 +427,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } expectEvents: - client: *client1 @@ -501,9 +489,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection_wc_majority name: insertMany diff --git a/source/transactions/tests/unified/isolation.yml b/source/transactions/tests/unified/isolation.yml index 3d236732d7..55d56ce3c9 100644 --- a/source/transactions/tests/unified/isolation.yml +++ b/source/transactions/tests/unified/isolation.yml @@ -62,9 +62,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: find @@ -136,9 +134,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection0 name: find diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index 7e875b88b2..c0c15d69b2 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -61,9 +61,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 4f36158c66..bf1cbc22de 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -58,9 +58,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -196,9 +194,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the Mongos that session0 is pinned to. # Fail hello/legacy hello to prevent the heartbeat requested directly after the # retryable commit error from racing with server selection for the retry. @@ -316,9 +312,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 95d7291b10..6c865cdcfc 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -156,9 +156,7 @@ tests: _id: 3 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } - object: *collection0 name: insertOne @@ -167,9 +165,7 @@ tests: _id: 4 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 4 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - object: *collection0 name: insertOne @@ -178,9 +174,7 @@ tests: _id: 5 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 5 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } - object: *collection0 name: insertOne @@ -189,9 +183,7 @@ tests: _id: 6 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 6 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 6 } } - object: *collection0 name: insertOne @@ -200,9 +192,7 @@ tests: _id: 7 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 7 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 7 } } - object: *collection0 name: insertOne @@ -211,9 +201,7 @@ tests: _id: 8 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 8 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 8 } } - object: *collection0 name: insertOne @@ -222,9 +210,7 @@ tests: _id: 9 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 9 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 9 } } - object: *collection0 name: insertOne @@ -233,9 +219,7 @@ tests: _id: 10 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 10 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 10 } } - *commitTransaction outcome: - @@ -276,9 +260,7 @@ tests: _id: 3 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } - &countDocuments object: *collection0 name: countDocuments @@ -299,9 +281,7 @@ tests: _id: 4 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 4 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - object: *collection0 name: insertOne @@ -310,9 +290,7 @@ tests: _id: 5 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 5 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } - object: *collection0 name: insertOne @@ -321,9 +299,7 @@ tests: _id: 6 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 6 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 6 } } - object: *collection0 name: insertOne @@ -332,9 +308,7 @@ tests: _id: 7 session: *session0 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 7 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 7 } } - *commitTransaction outcome: - @@ -485,9 +459,7 @@ tests: document: _id: 3 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } # Enable the fail point only on the mongos that session0 is pinned to - object: testRunner @@ -637,9 +609,7 @@ tests: document: _id: 3 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } # Enable the fail point only on the Mongos that session0 is pinned to. # Fail hello/legacy hello to prevent the heartbeat requested directly after the # insert error from racing with server selection for the commit. diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml index 621a5ae7bc..14688f94e2 100644 --- a/source/transactions/tests/unified/read-pref.yml +++ b/source/transactions/tests/unified/read-pref.yml @@ -430,9 +430,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 7378c43092..d46f9438f6 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -73,9 +73,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -168,9 +166,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -249,9 +245,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -344,9 +338,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -439,9 +431,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -534,9 +524,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -629,9 +617,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -724,9 +710,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -819,9 +803,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -914,9 +896,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1009,9 +989,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1104,9 +1082,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1199,9 +1175,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1298,9 +1272,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1397,9 +1369,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1496,9 +1466,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -1595,9 +1563,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index d165a6341d..537bee4113 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -92,9 +92,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: abortTransaction @@ -185,9 +183,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -267,9 +263,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -344,9 +338,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 749952f4b3..ed53204781 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -81,9 +81,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -180,9 +178,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index 62fa146767..91cf8f6525 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -90,9 +90,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -175,9 +173,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -274,9 +270,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -373,9 +367,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -472,9 +464,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -571,9 +561,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -670,9 +658,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -769,9 +755,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -868,9 +852,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -967,9 +949,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1066,9 +1046,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1169,9 +1147,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1272,9 +1248,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1375,9 +1349,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -1478,9 +1450,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 92f223ba3e..096c02df5c 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -100,9 +100,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # First call to commit fails after a single retry attempt. - object: *session1 @@ -228,9 +226,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # First call to commit fails after a single retry attempt. - object: *session1 @@ -355,9 +351,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 2cc26d9ff2..33e55bb906 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -70,9 +70,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -158,9 +156,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index e34aa8d420..22a63c3345 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -56,9 +56,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -70,9 +68,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session0 name: startTransaction @@ -84,9 +80,7 @@ tests: document: _id: 3 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 3 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } - object: *session0 name: abortTransaction diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index 3228352135..4e65c0830c 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -65,9 +65,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -86,9 +84,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index fe47ae94b7..d4c2819d69 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -56,9 +56,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: commitTransaction @@ -74,9 +72,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session0 name: abortTransaction @@ -212,9 +208,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -229,9 +223,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction @@ -351,9 +343,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -368,9 +358,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction @@ -505,9 +493,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -527,9 +513,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction @@ -664,9 +648,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -681,9 +663,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction @@ -815,9 +795,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session1 name: commitTransaction @@ -832,9 +810,7 @@ tests: document: _id: 2 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 2 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - object: *session1 name: abortTransaction @@ -1052,9 +1028,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection1 name: find @@ -1155,9 +1129,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection1 name: find @@ -1261,9 +1233,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *collection1 name: find diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index d1b56bafba..cc8ef82d91 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -116,8 +116,7 @@ tests: u: $inc: { x: 1 } upsert: true - multi: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } ordered: true readConcern: $$exists: false @@ -141,10 +140,8 @@ tests: x: 1 u: 'y': 1 - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -168,8 +165,7 @@ tests: u: $set: { z: 1 } multi: true - upsert: - $$unsetOrMatches: false + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -295,8 +291,7 @@ tests: u: $inc: { x: 1 } upsert: true - multi: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } ordered: true readConcern: $$exists: false @@ -320,10 +315,8 @@ tests: x: 1 u: 'y': 1 - multi: - $$unsetOrMatches: false - upsert: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 @@ -347,8 +340,7 @@ tests: u: $set: { z: 1 } multi: true - upsert: - $$unsetOrMatches: false + upsert: { $$unsetOrMatches: false } ordered: true lsid: $$sessionLsid: *session0 diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index a35b137cca..8591a8b55c 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -70,9 +70,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - &commitTransaction object: *session0 name: commitTransaction @@ -139,9 +137,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - *commitTransaction expectEvents: - @@ -199,9 +195,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -254,9 +248,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - object: *session0 name: abortTransaction @@ -340,9 +332,7 @@ tests: document: _id: 1 expectResult: - $$unsetOrMatches: - insertedId: - $$unsetOrMatches: 1 + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - *commitTransaction expectEvents: - @@ -558,8 +548,7 @@ tests: u: $inc: { x: 1 } upsert: true - multi: - $$unsetOrMatches: false + multi: { $$unsetOrMatches: false } ordered: true <<: *transactionCommandArgs commandName: update From 78106375098673cf628d56c3b1c10e9398cb75e7 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:17:29 -0500 Subject: [PATCH 42/55] Consolidate document objects --- source/transactions/tests/unified/abort.yml | 54 ++---- source/transactions/tests/unified/bulk.yml | 147 +++++--------- .../tests/unified/causal-consistency.yml | 53 ++---- source/transactions/tests/unified/commit.yml | 93 +++------ source/transactions/tests/unified/count.yml | 18 +- .../tests/unified/create-collection.yml | 6 +- source/transactions/tests/unified/delete.yml | 50 ++--- .../unified/error-labels-blockConnection.yml | 9 +- .../unified/error-labels-errorLabels.yml | 18 +- .../tests/unified/error-labels.yml | 133 +++++-------- .../tests/unified/errors-client.yml | 9 +- source/transactions/tests/unified/errors.yml | 18 +- .../tests/unified/findOneAndDelete.yml | 33 ++-- .../tests/unified/findOneAndReplace.yml | 50 ++--- .../tests/unified/findOneAndUpdate.yml | 73 +++---- source/transactions/tests/unified/insert.yml | 114 ++++------- .../transactions/tests/unified/isolation.yml | 57 ++---- .../mongos-recovery-token-errorLabels.yml | 9 +- .../tests/unified/mongos-recovery-token.yml | 21 +- .../transactions/tests/unified/pin-mongos.yml | 180 ++++++------------ .../tests/unified/read-concern.yml | 78 ++------ .../transactions/tests/unified/read-pref.yml | 127 ++++-------- source/transactions/tests/unified/reads.yml | 30 +-- .../unified/retryable-abort-errorLabels.yml | 102 ++++------ .../tests/unified/retryable-abort.yml | 24 +-- ...e-commit-errorLabels-forbid_serverless.yml | 18 +- .../unified/retryable-commit-errorLabels.yml | 132 +++++-------- .../retryable-commit-forbid_serverless.yml | 27 +-- .../tests/unified/retryable-commit.yml | 15 +- .../tests/unified/retryable-writes.yml | 48 ++--- .../tests/unified/run-command.yml | 18 +- .../unified/transaction-options-repl.yml | 15 +- .../tests/unified/transaction-options.yml | 117 ++++-------- source/transactions/tests/unified/update.yml | 102 +++------- .../tests/unified/write-concern.yml | 164 +++++----------- 35 files changed, 693 insertions(+), 1469 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index 792e9963ae..98942893da 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -57,8 +57,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -72,8 +71,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -88,8 +86,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -123,8 +120,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: afterClusterTime: @@ -171,8 +167,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # The original legacy test relied on the test runner to call endSession after all operations. Since the unified @@ -189,8 +184,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -235,8 +229,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -256,8 +249,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -343,8 +335,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -364,8 +355,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -399,8 +389,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'abort ignores TransactionAborted' operations: @@ -412,8 +401,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Abort the server transaction with a duplicate key error @@ -422,8 +410,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: errorLabelsOmit: - TransientTransactionError @@ -436,8 +423,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: errorCodeName: NoSuchTransaction errorLabelsContain: @@ -457,8 +443,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -477,8 +462,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -498,8 +482,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -548,8 +531,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index eeed3c53e9..d31d50418c 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -57,8 +57,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -66,8 +65,7 @@ tests: name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectResult: deletedCount: 1 - @@ -78,81 +76,57 @@ tests: requests: - insertOne: - document: - _id: 1 + document: { _id: 1 } - updateOne: - filter: - _id: 1 - update: - $set: - x: 1 + filter: { _id: 1 } + update: { $set: { x: 1 } } - updateOne: - filter: - _id: 2 - update: - $set: - x: 2 + filter: { _id: 2 } + update: { $set: { x: 2 } } # Produces upsertedIds: {2: 2} in the result upsert: true - insertOne: - document: - _id: 3 + document: { _id: 3 } - insertOne: - document: - _id: 4 + document: { _id: 4 } - insertOne: - document: - _id: 5 + document: { _id: 5 } - insertOne: - document: - _id: 6 + document: { _id: 6 } - insertOne: - document: - _id: 7 + document: { _id: 7 } # Keep replaces segregated from updates, so that drivers that aren't able to coalesce # adjacent updates and replaces into a single update command will still pass this test - replaceOne: - filter: - _id: 1 - replacement: - 'y': 1 + filter: { _id: 1 } + replacement: { y: 1 } - replaceOne: - filter: - _id: 2 - replacement: - 'y': 2 + filter: { _id: 2 } + replacement: { y: 2 } - deleteOne: - filter: - _id: 3 + filter: { _id: 3 } - deleteOne: - filter: - _id: 4 + filter: { _id: 4 } - updateMany: - filter: - _id: - $gte: 2 - update: - $set: - z: 1 + filter: { _id: { $gte: 2 } } + update: { $set: { z: 1 } } # Keep deleteMany segregated from deleteOne, so that drivers that aren't able to coalesce # adjacent mixed deletes into a single delete command will still pass this test - deleteMany: - filter: - _id: - $gte: 6 + filter: { _id: { $gte: 6 } } expectResult: deletedCount: 4 insertedCount: 6 @@ -167,8 +141,7 @@ tests: matchedCount: 7 modifiedCount: 7 upsertedCount: 1 - upsertedIds: - '2': 2 + upsertedIds: { '2': 2 } - object: *session0 name: commitTransaction @@ -181,8 +154,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -202,8 +174,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 1 + q: { _id: 1 } limit: 1 ordered: true lsid: @@ -223,8 +194,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session0 @@ -243,17 +213,13 @@ tests: update: *collection_name updates: - - q: - _id: 1 - u: - $set: { x: 1 } + q: { _id: 1 } + u: { $set: { x: 1 } } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } - - q: - _id: 2 - u: - $set: { x: 2 } + q: { _id: 2 } + u: { $set: { x: 2 } } upsert: true multi: { $$unsetOrMatches: false } ordered: true @@ -273,16 +239,11 @@ tests: command: insert: *collection_name documents: - - - _id: 3 - - - _id: 4 - - - _id: 5 - - - _id: 6 - - - _id: 7 + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } + - { _id: 6 } + - { _id: 7 } ordered: true lsid: $$sessionLsid: *session0 @@ -301,17 +262,13 @@ tests: update: *collection_name updates: - - q: - _id: 1 - u: - 'y': 1 + q: { _id: 1 } + u: { y: 1 } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } - - q: - _id: 2 - u: - 'y': 2 + q: { _id: 2 } + u: { y: 2 } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -332,12 +289,10 @@ tests: delete: *collection_name deletes: - - q: - _id: 3 + q: { _id: 3 } limit: 1 - - q: - _id: 4 + q: { _id: 4 } limit: 1 ordered: true lsid: @@ -357,10 +312,8 @@ tests: update: *collection_name updates: - - q: - _id: { $gte: 2 } - u: - $set: { z: 1 } + q: { _id: { $gte: 2 } } + u: { $set: { z: 1 } } multi: true upsert: { $$unsetOrMatches: false } ordered: true @@ -381,8 +334,7 @@ tests: delete: *collection_name deletes: - - q: - _id: { $gte: 6 } + q: { _id: { $gte: 6 } } limit: 0 ordered: true lsid: @@ -416,13 +368,6 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - 'y': 1 - - - _id: 2 - 'y': 2 - z: 1 - - - _id: 5 - z: 1 + - { _id: 1, y: 1 } + - { _id: 2, y: 2, z: 1 } + - { _id: 5, z: 1 } diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index 843b583ed9..71d390f757 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -48,9 +48,7 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - count: 0 + - { _id: 1, count: 0 } tests: - @@ -62,11 +60,8 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 1 - update: - $inc: - count: 1 + filter: { _id: 1 } + update: { $inc: { count: 1 } } expectResult: matchedCount: 1 modifiedCount: 1 @@ -90,10 +85,8 @@ tests: update: *collection_name updates: - - q: - _id: 1 - u: - $inc: { count: 1 } + q: { _id: 1 } + u: { $inc: { count: 1 } } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -117,10 +110,8 @@ tests: update: *collection_name updates: - - q: - _id: 1 - u: - $inc: { count: 1 } + q: { _id: 1 } + u: { $inc: { count: 1 } } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -157,9 +148,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - count: 2 + - { _id: 1, count: 2 } - description: 'causal consistency disabled' operations: @@ -169,8 +158,7 @@ tests: name: insertOne arguments: session: *session_no_cc - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -181,11 +169,8 @@ tests: name: updateOne arguments: session: *session_no_cc - filter: - _id: 1 - update: - $inc: - count: 1 + filter: { _id: 1 } + update: { $inc: { count: 1 } } expectResult: matchedCount: 1 modifiedCount: 1 @@ -202,8 +187,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true readConcern: $$exists: false @@ -223,10 +207,8 @@ tests: update: *collection_name updates: - - q: - _id: 1 - u: - $inc: { count: 1 } + q: { _id: 1 } + u: { $inc: { count: 1 } } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -263,8 +245,5 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - count: 1 - - - _id: 2 + - { _id: 1, count: 1 } + - { _id: 2 } diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index b977a3c04c..0b813740e8 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -76,8 +76,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -92,8 +91,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -108,8 +106,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -143,8 +140,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true readConcern: afterClusterTime: @@ -179,10 +175,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } - description: 'rerun commit after empty transaction' operations: @@ -204,8 +198,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -220,8 +213,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -255,8 +247,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'multiple commits in a row' operations: @@ -268,8 +259,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -290,8 +280,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -358,8 +347,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'write concern error on commit' operations: @@ -374,8 +362,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -398,8 +385,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commit without start' operations: @@ -451,8 +437,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -472,8 +457,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -513,8 +497,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -540,8 +523,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -556,8 +538,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -591,8 +572,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: afterClusterTime: @@ -639,8 +619,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -652,8 +631,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } # Calling commit again should error instead of re-running the commit @@ -671,8 +649,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -706,8 +683,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true readConcern: $$exists: false @@ -726,10 +702,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } - description: 'reset session state abort' operations: @@ -741,8 +715,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -754,8 +727,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } # Calling abort should error with "no transaction started" instead of "cannot call abortTransaction twice" @@ -773,8 +745,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -808,8 +779,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true readConcern: $$exists: false @@ -828,5 +798,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 2 + - { _id: 2 } diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 9d9b28d089..6674caf14d 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -45,14 +45,10 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } tests: - @@ -66,8 +62,7 @@ tests: name: count arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectError: errorCodeName: OperationNotSupportedInTransaction errorLabelsOmit: @@ -84,8 +79,7 @@ tests: commandStartedEvent: command: count: *collection_name - query: - _id: 1 + query: { _id: 1 } readConcern: $$exists: false lsid: diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 27c0a807a2..14609e5b1d 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -132,8 +132,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -168,8 +167,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index f926d04da8..afb5a86a75 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -44,16 +44,11 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 - - - _id: 5 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } tests: - @@ -67,8 +62,7 @@ tests: name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectResult: deletedCount: 1 - @@ -76,9 +70,7 @@ tests: name: deleteMany arguments: session: *session0 - filter: - _id: - $lte: 3 + filter: { _id: { $lte: 3 } } expectResult: deletedCount: 2 - @@ -86,8 +78,7 @@ tests: name: deleteOne arguments: session: *session0 - filter: - _id: 4 + filter: { _id: 4 } expectResult: deletedCount: 1 - @@ -103,8 +94,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 1 + q: { _id: 1 } limit: 1 ordered: true readConcern: @@ -125,8 +115,7 @@ tests: delete: *collection_name deletes: - - q: - _id: { $lte: 3 } + q: { _id: { $lte: 3 } } limit: 0 ordered: true lsid: @@ -146,8 +135,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 4 + q: { _id: 4 } limit: 1 ordered: true lsid: @@ -181,8 +169,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 5 + - { _id: 5 } - description: 'collection writeConcern ignored for delete' operations: @@ -208,8 +195,7 @@ tests: name: deleteOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectResult: deletedCount: 1 - @@ -217,9 +203,7 @@ tests: name: deleteMany arguments: session: *session0 - filter: - _id: - $lte: 3 + filter: { _id: { $lte: 3 } } expectResult: deletedCount: 2 - @@ -235,8 +219,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 1 + q: { _id: 1 } limit: 1 ordered: true readConcern: @@ -257,8 +240,7 @@ tests: delete: *collection_name deletes: - - q: - _id: { $lte: 3 } + q: { _id: { $lte: 3 } } limit: 0 ordered: true lsid: diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index bcabc35d04..b15c52891b 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -83,8 +83,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -108,8 +107,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -176,5 +174,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 3c166ab80c..e8b4019107 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -72,8 +72,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -97,8 +96,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -165,8 +163,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress' operations: @@ -198,8 +195,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -223,8 +219,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -292,5 +287,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 0ca965cc20..2b54d85bc2 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -61,10 +61,8 @@ tests: arguments: session: *session0 documents: - - - _id: 1 - - - _id: 1 + - { _id: 1 } + - { _id: 1 } expectError: errorLabelsOmit: - TransientTransactionError @@ -84,10 +82,8 @@ tests: command: insert: *collection_name documents: - - - _id: 1 - - - _id: 1 + - { _id: 1 } + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -145,8 +141,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: # Note, the server will return the errorLabel in this case errorLabelsContain: @@ -166,8 +161,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -225,8 +219,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: # Note, the server will return the errorLabel in this case errorLabelsContain: @@ -246,8 +239,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -305,8 +297,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: # Note, the server will return the errorLabel in this case errorLabelsContain: @@ -326,8 +317,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -385,8 +375,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -408,8 +397,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -470,8 +458,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: &transient_label_only errorLabelsContain: - TransientTransactionError @@ -492,9 +479,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } session: *session0 expectError: *transient_label_only - @@ -517,8 +502,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -552,9 +536,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: { } readConcern: $$exists: false @@ -627,8 +609,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -652,8 +633,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -720,8 +700,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction' operations: @@ -751,8 +730,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: errorLabelsOmit: - RetryableWriteError @@ -770,8 +748,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -830,8 +807,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -855,8 +831,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -907,8 +882,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout' operations: @@ -941,8 +915,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -966,8 +939,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1018,8 +990,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern' operations: @@ -1049,8 +1020,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1070,8 +1040,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1105,8 +1074,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern' operations: @@ -1136,8 +1104,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1157,8 +1124,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1192,8 +1158,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions' operations: @@ -1218,8 +1183,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1227,9 +1191,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } maxTimeMS: 60000 session: *session0 expectError: @@ -1249,8 +1211,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1269,9 +1230,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: { } readConcern: $$exists: false @@ -1331,8 +1290,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1356,8 +1314,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1410,8 +1367,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired' operations: @@ -1442,8 +1398,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1467,8 +1422,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1521,5 +1475,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/errors-client.yml b/source/transactions/tests/unified/errors-client.yml index 9261ed9cad..7f51bf3871 100644 --- a/source/transactions/tests/unified/errors-client.yml +++ b/source/transactions/tests/unified/errors-client.yml @@ -57,8 +57,7 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } update: x: 1 expectError: @@ -80,8 +79,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -89,8 +87,7 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } update: x: 1 expectError: diff --git a/source/transactions/tests/unified/errors.yml b/source/transactions/tests/unified/errors.yml index 7a90aae48f..ce6ecfcff7 100644 --- a/source/transactions/tests/unified/errors.yml +++ b/source/transactions/tests/unified/errors.yml @@ -57,8 +57,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -94,8 +93,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -121,8 +119,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -133,8 +130,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectError: errorCodeName: WriteConflict errorLabelsContain: @@ -164,8 +160,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -176,8 +171,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectError: errorCodeName: WriteConflict errorLabelsContain: diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index 0fbbb01418..91a080f1d4 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -44,12 +44,9 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } tests: - @@ -63,8 +60,7 @@ tests: name: findOneAndDelete arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } expectResult: _id: 3 - @@ -72,8 +68,7 @@ tests: name: findOneAndDelete arguments: session: *session0 - filter: - _id: 4 + filter: { _id: 4 } - object: *session0 name: commitTransaction @@ -85,8 +80,7 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 + query: { _id: 3 } remove: true lsid: $$sessionLsid: *session0 @@ -104,8 +98,7 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 4 + query: { _id: 4 } remove: true lsid: $$sessionLsid: *session0 @@ -142,10 +135,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } - description: 'collection writeConcern ignored for findOneAndDelete' operations: @@ -171,8 +162,7 @@ tests: name: findOneAndDelete arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } expectResult: _id: 3 - @@ -186,8 +176,7 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 + query: { _id: 3 } remove: true lsid: $$sessionLsid: *session0 diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 4f4ec7103c..b5fb1b852a 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -44,12 +44,9 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } tests: - @@ -63,8 +60,7 @@ tests: name: findOneAndReplace arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } replacement: x: 1 returnDocument: Before @@ -75,8 +71,7 @@ tests: name: findOneAndReplace arguments: session: *session0 - filter: - _id: 4 + filter: { _id: 4 } replacement: x: 1 upsert: true @@ -95,10 +90,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - x: 1 + query: { _id: 3 } + update: { x: 1 } new: false lsid: $$sessionLsid: *session0 @@ -116,10 +109,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 4 - update: - x: 1 + query: { _id: 4 } + update: { x: 1 } new: true upsert: true lsid: @@ -157,16 +148,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - x: 1 - - - _id: 4 - x: 1 + - { _id: 1 } + - { _id: 2 } + - { _id: 3, x: 1 } + - { _id: 4, x: 1 } - description: 'collection writeConcern ignored for findOneAndReplace' operations: @@ -192,8 +177,7 @@ tests: name: findOneAndReplace arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } replacement: x: 1 returnDocument: Before @@ -210,10 +194,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - x: 1 + query: { _id: 3 } + update: { x: 1 } new: false lsid: $$sessionLsid: *session0 diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 69674c7e62..346eabef8f 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -44,12 +44,9 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } tests: - @@ -63,8 +60,7 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } update: $inc: x: 1 @@ -76,8 +72,7 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 4 + filter: { _id: 4 } update: $inc: x: 1 @@ -98,8 +93,7 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } update: $inc: x: 1 @@ -119,8 +113,7 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } update: $inc: x: 1 @@ -139,11 +132,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - $inc: - x: 1 + query: { _id: 3 } + update: { $inc: { x: 1 } } new: false lsid: $$sessionLsid: *session0 @@ -161,11 +151,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 4 - update: - $inc: - x: 1 + query: { _id: 4 } + update: { $inc: { x: 1 } } new: true upsert: true lsid: @@ -202,11 +189,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - $inc: - x: 1 + query: { _id: 3 } + update: { $inc: { x: 1 } } new: false lsid: $$sessionLsid: *session0 @@ -242,11 +226,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - $inc: - x: 1 + query: { _id: 3 } + update: { $inc: { x: 1 } } new: false lsid: $$sessionLsid: *session0 @@ -283,16 +264,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - x: 2 - - - _id: 4 - x: 1 + - { _id: 1 } + - { _id: 2 } + - { _id: 3, x: 2 } + - { _id: 4, x: 1 } - description: 'collection writeConcern ignored for findOneAndUpdate' operations: @@ -318,8 +293,7 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 3 + filter: { _id: 3 } update: $inc: x: 1 @@ -337,11 +311,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 3 - update: - $inc: - x: 1 + query: { _id: 3 } + update: { $inc: { x: 1 } } new: false lsid: $$sessionLsid: *session0 diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index 3be8489e65..92983afa68 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -57,8 +57,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -66,10 +65,8 @@ tests: name: insertMany arguments: documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } session: *session0 expectResult: $$unsetOrMatches: @@ -82,8 +79,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - @@ -97,8 +93,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 5 + document: { _id: 5 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } - @@ -113,8 +108,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -133,10 +127,8 @@ tests: command: insert: *collection_name documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } ordered: true lsid: $$sessionLsid: *session0 @@ -154,8 +146,7 @@ tests: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true lsid: $$sessionLsid: *session0 @@ -186,8 +177,7 @@ tests: command: insert: *collection_name documents: - - - _id: 5 + - { _id: 5 } ordered: true readConcern: afterClusterTime: @@ -222,16 +212,11 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 - - - _id: 5 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } # This test proves that the driver uses "session1" correctly in operations # and APM expectations - @@ -245,8 +230,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -254,10 +238,8 @@ tests: name: insertMany arguments: documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } session: *session1 expectResult: $$unsetOrMatches: @@ -276,8 +258,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 4 + document: { _id: 4 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } - @@ -292,8 +273,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -312,10 +292,8 @@ tests: command: insert: *collection_name documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } ordered: true lsid: $$sessionLsid: *session1 @@ -348,8 +326,7 @@ tests: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true readConcern: afterClusterTime: @@ -384,12 +361,9 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } # This test proves that the driver parses the collectionOptions writeConcern - description: 'collection writeConcern without transaction' @@ -424,8 +398,7 @@ tests: name: insertOne arguments: session: *session2 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } expectEvents: @@ -437,8 +410,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -459,8 +431,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'collection writeConcern ignored for insert' operations: @@ -486,8 +457,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -495,10 +465,8 @@ tests: name: insertMany arguments: documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } session: *session0 expectResult: $$unsetOrMatches: @@ -518,8 +486,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -538,10 +505,8 @@ tests: command: insert: *collection_name documents: - - - _id: 2 - - - _id: 3 + - { _id: 2 } + - { _id: 3 } ordered: true lsid: $$sessionLsid: *session0 @@ -574,9 +539,6 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } diff --git a/source/transactions/tests/unified/isolation.yml b/source/transactions/tests/unified/isolation.yml index 55d56ce3c9..ff8b14f873 100644 --- a/source/transactions/tests/unified/isolation.yml +++ b/source/transactions/tests/unified/isolation.yml @@ -59,8 +59,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -68,25 +67,21 @@ tests: name: find arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectResult: - - - _id: 1 + - { _id: 1 } - object: *collection0 name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectResult: [] - object: *collection0 name: find arguments: - filter: - _id: 1 + filter: { _id: 1 } expectResult: [] - object: *session0 @@ -96,27 +91,22 @@ tests: name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectResult: - - - _id: 1 + - { _id: 1 } - object: *collection0 name: find arguments: - filter: - _id: 1 + filter: { _id: 1 } expectResult: - - - _id: 1 + - { _id: 1 } outcome: - collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'two transactions' operations: @@ -131,8 +121,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -140,25 +129,21 @@ tests: name: find arguments: session: *session0 - filter: - _id: 1 + filter: { _id: 1 } expectResult: - - - _id: 1 + - { _id: 1 } - object: *collection0 name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectResult: [] - object: *collection0 name: find arguments: - filter: - _id: 1 + filter: { _id: 1 } expectResult: [] - object: *session0 @@ -169,18 +154,15 @@ tests: name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectResult: [] - object: *collection0 name: find arguments: - filter: - _id: 1 + filter: { _id: 1 } expectResult: - - - _id: 1 + - { _id: 1 } - object: *session1 name: commitTransaction @@ -189,5 +171,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index c0c15d69b2..fca05f08cb 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -58,8 +58,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the mongos that session0 is pinned to @@ -96,8 +95,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -152,5 +150,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index bf1cbc22de..543917e265 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -55,8 +55,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -77,8 +76,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -152,8 +150,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction retry fails on new mongos' operations: @@ -191,8 +188,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the Mongos that session0 is pinned to. @@ -242,8 +238,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -309,8 +304,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # Enable the fail point only on the mongos that session0 is pinned to @@ -344,8 +338,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 6c865cdcfc..d14285e2be 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -53,10 +53,8 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } tests: - @@ -69,8 +67,7 @@ tests: object: *collection0 name: countDocuments arguments: - filter: - _id: 2 + filter: { _id: 2 } session: *session0 expectResult: 1 - *countDocuments @@ -123,12 +120,10 @@ tests: object: *collection0 name: find arguments: - filter: - _id: 2 + filter: { _id: 2 } session: *session0 expectResult: - - - _id: 2 + - { _id: 2 } - *find - *find - *find @@ -152,8 +147,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 3 + document: { _id: 3 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } @@ -161,8 +155,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 4 + document: { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } @@ -170,8 +163,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 5 + document: { _id: 5 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } @@ -179,8 +171,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 6 + document: { _id: 6 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 6 } } @@ -188,8 +179,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 7 + document: { _id: 7 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 7 } } @@ -197,8 +187,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 8 + document: { _id: 8 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 8 } } @@ -206,8 +195,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 9 + document: { _id: 9 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 9 } } @@ -215,8 +203,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 10 + document: { _id: 10 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 10 } } @@ -226,26 +213,16 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 - - - _id: 5 - - - _id: 6 - - - _id: 7 - - - _id: 8 - - - _id: 9 - - - _id: 10 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } + - { _id: 6 } + - { _id: 7 } + - { _id: 8 } + - { _id: 9 } + - { _id: 10 } - description: 'mixed read write operations' operations: @@ -256,8 +233,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 3 + document: { _id: 3 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } @@ -265,8 +241,7 @@ tests: object: *collection0 name: countDocuments arguments: - filter: - _id: 3 + filter: { _id: 3 } session: *session0 expectResult: 1 - *countDocuments @@ -277,8 +252,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 4 + document: { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 4 } } @@ -286,8 +260,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 5 + document: { _id: 5 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 5 } } @@ -295,8 +268,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 6 + document: { _id: 6 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 6 } } @@ -304,8 +276,7 @@ tests: object: *collection0 name: insertOne arguments: - document: - _id: 7 + document: { _id: 7 } session: *session0 expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 7 } } @@ -315,20 +286,13 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 - - - _id: 5 - - - _id: 6 - - - _id: 7 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } + - { _id: 6 } + - { _id: 7 } - description: 'multiple commits' operations: @@ -340,10 +304,8 @@ tests: name: insertMany arguments: documents: - - - _id: 3 - - - _id: 4 + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -374,14 +336,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } - description: 'remain pinned after non-transient error on commit' operations: @@ -393,10 +351,8 @@ tests: name: insertMany arguments: documents: - - - _id: 3 - - - _id: 4 + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -437,14 +393,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } - description: 'unpin after transient error within a transaction' operations: @@ -456,8 +408,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 3 + document: { _id: 3 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } # Enable the fail point only on the mongos that session0 is pinned to @@ -479,8 +430,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 4 + document: { _id: 4 } expectError: errorLabelsContain: - TransientTransactionError @@ -500,8 +450,7 @@ tests: command: insert: *collection_name documents: - - - _id: 3 + - { _id: 3 } ordered: true readConcern: $$exists: false @@ -520,8 +469,7 @@ tests: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true readConcern: $$exists: false @@ -558,10 +506,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } # Applications should not run commitTransaction after transient errors but # the transactions API allows it and this test confirms unpinning behavior. # In a sharded cluster, a transient error within a transaction unpins the @@ -606,8 +552,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 3 + document: { _id: 3 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } # Enable the fail point only on the Mongos that session0 is pinned to. @@ -637,8 +582,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 4 + document: { _id: 4 } expectError: errorLabelsContain: - TransientTransactionError @@ -673,8 +617,7 @@ tests: command: insert: *collection_name documents: - - - _id: 3 + - { _id: 3 } ordered: true readConcern: $$exists: false @@ -693,8 +636,7 @@ tests: command: insert: *collection_name documents: - - - _id: 4 + - { _id: 4 } ordered: true readConcern: $$exists: false @@ -731,7 +673,5 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index 8b14618bb6..cc845c7e9f 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -49,14 +49,10 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } tests: - @@ -72,9 +68,7 @@ tests: object: *collection_rc_majority name: countDocuments arguments: - filter: - _id: - $gte: 2 + filter: { _id: { $gte: 2 } } session: *session0 expectResult: 3 - *countDocuments @@ -90,13 +84,8 @@ tests: command: aggregate: *collection_name pipeline: - - - $match: - _id: { $gte: 2 } - - - $group: - _id: 1 - 'n': { $sum: 1 } + - { $match: { _id: { $gte: 2 } } } + - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } lsid: $$sessionLsid: *session0 @@ -113,13 +102,8 @@ tests: command: aggregate: *collection_name pipeline: - - - $match: - _id: { $gte: 2 } - - - $group: - _id: 1 - 'n': { $sum: 1 } + - { $match: { _id: { $gte: 2 } } } + - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } lsid: $$sessionLsid: *session0 @@ -254,9 +238,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectResult: *data @@ -271,9 +253,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 lsid: @@ -309,9 +289,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 lsid: @@ -356,11 +334,7 @@ tests: fieldName: _id filter: {} session: *session0 - expectResult: - - 1 - - 2 - - 3 - - 4 + expectResult: [ 1, 2, 3, 4 ] - *distinct - *commitTransaction expectEvents: @@ -475,13 +449,8 @@ tests: command: aggregate: *collection_name pipeline: - - - $match: - _id: { $gte: 2 } - - - $group: - _id: 1 - 'n': { $sum: 1 } + - { $match: { _id: { $gte: 2 } } } + - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } lsid: $$sessionLsid: *session0 @@ -498,13 +467,8 @@ tests: command: aggregate: *collection_name pipeline: - - - $match: - _id: { $gte: 2 } - - - $group: - _id: 1 - 'n': { $sum: 1 } + - { $match: { _id: { $gte: 2 } } } + - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } lsid: $$sessionLsid: *session0 @@ -615,9 +579,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 lsid: @@ -653,9 +615,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 lsid: diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml index 14688f94e2..5afe5fd97e 100644 --- a/source/transactions/tests/unified/read-pref.yml +++ b/source/transactions/tests/unified/read-pref.yml @@ -64,14 +64,10 @@ tests: name: insertMany arguments: documents: &insertedDocs - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -87,14 +83,10 @@ tests: arguments: session: *session0 pipeline: - - - $match: - _id: 1 - - - $count: count + - { $match: { _id: 1 } } + - { $count: count } expectResult: - - - count: 1 + - { count: 1 } - object: *collection_rp_secondary name: find @@ -108,9 +100,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectResult: *insertedDocs @@ -136,14 +126,10 @@ tests: name: insertMany arguments: documents: &insertedDocs - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -159,14 +145,10 @@ tests: arguments: session: *session0 pipeline: - - - $match: - _id: 1 - - - $count: count + - { $match: { _id: 1 } } + - { $count: count } expectResult: - - - count: 1 + - { count: 1 } - object: *collection_rp_secondary name: find @@ -180,9 +162,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectResult: *insertedDocs @@ -208,14 +188,10 @@ tests: name: insertMany arguments: documents: &insertedDocs - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -231,11 +207,8 @@ tests: arguments: session: *session0 pipeline: - - - $match: - _id: 1 - - - $count: count + - { $match: { _id: 1 } } + - { $count: count } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -252,9 +225,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectError: @@ -281,14 +252,10 @@ tests: name: insertMany arguments: documents: &insertedDocs - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -304,11 +271,8 @@ tests: arguments: session: *session0 pipeline: - - - $match: - _id: 1 - - - $count: count + - { $match: { _id: 1 } } + - { $count: count } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -325,9 +289,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectError: @@ -354,14 +316,10 @@ tests: name: insertMany arguments: documents: &insertedDocs - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } session: *session0 expectResult: $$unsetOrMatches: @@ -377,11 +335,8 @@ tests: arguments: session: *session0 pipeline: - - - $match: - _id: 1 - - - $count: count + - { $match: { _id: 1 } } + - { $count: count } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -398,9 +353,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectError: @@ -427,8 +380,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -439,5 +391,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 33e4e7bacf..4ecc7e0f11 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -40,14 +40,10 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 1 - - - _id: 2 - - - _id: 3 - - - _id: 4 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } tests: - @@ -204,9 +200,7 @@ tests: name: aggregate arguments: pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } batchSize: 3 session: *session0 expectResult: *data @@ -221,9 +215,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 readConcern: @@ -257,9 +249,7 @@ tests: command: aggregate: *collection_name pipeline: - - - $project: - _id: 1 + - { $project: { _id: 1 } } cursor: batchSize: 3 lsid: @@ -314,11 +304,7 @@ tests: fieldName: _id filter: {} session: *session0 - expectResult: - - 1 - - 2 - - 3 - - 4 + expectResult: [ 1, 2, 3, 4] - *commitTransaction expectEvents: - diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index d46f9438f6..5fddc8c1e9 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -70,8 +70,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -86,8 +85,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -163,8 +161,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -179,8 +176,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -242,8 +238,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -258,8 +253,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -335,8 +329,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -351,8 +344,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -428,8 +420,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -444,8 +435,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -521,8 +511,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -537,8 +526,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -614,8 +602,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -630,8 +617,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -707,8 +693,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -723,8 +708,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -800,8 +784,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -816,8 +799,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -893,8 +875,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -909,8 +890,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -986,8 +966,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1002,8 +981,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1079,8 +1057,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1095,8 +1072,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1172,8 +1148,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1188,8 +1163,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1269,8 +1243,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1285,8 +1258,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1366,8 +1338,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1382,8 +1353,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1463,8 +1433,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1479,8 +1448,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1560,8 +1528,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1576,8 +1543,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index 537bee4113..8702b4a771 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -89,8 +89,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -105,8 +104,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -180,8 +178,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -196,8 +193,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -260,8 +256,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -276,8 +271,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -335,8 +329,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -351,8 +344,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index ed53204781..18e67d4b53 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -78,8 +78,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -94,8 +93,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -146,8 +144,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after ShutdownInProgress' operations: @@ -175,8 +172,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -191,8 +187,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -243,5 +238,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index 91cf8f6525..da93e04d3a 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -87,8 +87,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -107,8 +106,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -170,8 +168,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -186,8 +183,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -238,8 +234,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after NotWritablePrimary' operations: @@ -267,8 +262,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -283,8 +277,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -335,8 +328,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after NotPrimaryOrSecondary' operations: @@ -364,8 +356,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -380,8 +371,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -432,8 +422,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after NotPrimaryNoSecondaryOk' operations: @@ -461,8 +450,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -477,8 +465,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -529,8 +516,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after InterruptedDueToReplStateChange' operations: @@ -558,8 +544,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -574,8 +559,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -626,8 +610,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after PrimarySteppedDown' operations: @@ -655,8 +638,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -671,8 +653,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -723,8 +704,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after HostNotFound' operations: @@ -752,8 +732,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -768,8 +747,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -820,8 +798,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after HostUnreachable' operations: @@ -849,8 +826,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -865,8 +841,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -917,8 +892,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after SocketException' operations: @@ -946,8 +920,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -962,8 +935,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1014,8 +986,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after NetworkTimeout' operations: @@ -1043,8 +1014,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1059,8 +1029,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1111,8 +1080,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after WriteConcernError InterruptedAtShutdown' operations: @@ -1144,8 +1112,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1160,8 +1127,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1212,8 +1178,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange' operations: @@ -1245,8 +1210,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1261,8 +1225,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1313,8 +1276,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after WriteConcernError PrimarySteppedDown' operations: @@ -1346,8 +1308,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1362,8 +1323,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1414,8 +1374,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after WriteConcernError ShutdownInProgress' operations: @@ -1447,8 +1406,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1463,8 +1421,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1515,5 +1472,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 096c02df5c..909861aa13 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -97,8 +97,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # First call to commit fails after a single retry attempt. @@ -124,8 +123,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -192,8 +190,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction applies majority write concern on retries' operations: @@ -223,8 +220,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } # First call to commit fails after a single retry attempt. @@ -250,8 +246,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -322,8 +317,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'commitTransaction succeeds after connection error' operations: @@ -348,8 +342,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -364,8 +357,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -416,5 +408,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 33e55bb906..87fae61de6 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -67,8 +67,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -89,8 +88,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -153,8 +151,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -174,8 +171,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -209,5 +205,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index 22a63c3345..57cf55ae90 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -53,8 +53,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -65,8 +64,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -77,8 +75,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 3 + document: { _id: 3 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } - @@ -89,10 +86,8 @@ tests: name: insertMany arguments: documents: - - - _id: 4 - - - _id: 5 + - { _id: 4 } + - { _id: 5 } session: *session0 expectResult: $$unsetOrMatches: @@ -109,8 +104,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -144,8 +138,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true readConcern: $$exists: false @@ -166,8 +159,7 @@ tests: command: insert: *collection_name documents: - - - _id: 3 + - { _id: 3 } ordered: true readConcern: afterClusterTime: @@ -202,10 +194,8 @@ tests: command: insert: *collection_name documents: - - - _id: 4 - - - _id: 5 + - { _id: 4 } + - { _id: 5 } ordered: true readConcern: $$exists: false @@ -226,14 +216,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 4 - - - _id: 5 + - { _id: 1 } + - { _id: 2 } + - { _id: 4 } + - { _id: 5 } - description: 'writes are not retried' operations: @@ -258,8 +244,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectError: errorLabelsContain: - TransientTransactionError @@ -275,8 +260,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index b7abd2adcf..f9434344d4 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -56,8 +56,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } commandName: insert expectResult: 'n': 1 @@ -73,8 +72,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } readConcern: $$exists: false lsid: @@ -137,8 +135,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } commandName: insert expectResult: 'n': 1 @@ -154,8 +151,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } readConcern: $$exists: false lsid: @@ -197,8 +193,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } readPreference: mode: Primary commandName: insert @@ -216,8 +211,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } readConcern: $$exists: false lsid: diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index 4e65c0830c..341d217055 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -62,8 +62,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -81,8 +80,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -97,8 +95,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -134,8 +131,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -173,5 +169,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index d4c2819d69..f29199bd4e 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -53,8 +53,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -69,8 +68,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -85,8 +83,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session0 @@ -126,8 +123,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session0 @@ -168,8 +164,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'transaction options inherited from client' operations: @@ -205,8 +200,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -220,8 +214,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -236,8 +229,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -277,8 +269,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -340,8 +331,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -355,8 +345,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -371,8 +360,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -409,8 +397,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -490,8 +477,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -510,8 +496,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -526,8 +511,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -566,8 +550,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -645,8 +628,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -660,8 +642,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -676,8 +657,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -716,8 +696,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -792,8 +771,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -807,8 +785,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 2 + document: { _id: 2 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } - @@ -823,8 +800,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -860,8 +836,7 @@ tests: command: insert: *collection_name documents: - - - _id: 2 + - { _id: 2 } ordered: true lsid: $$sessionLsid: *session1 @@ -934,8 +909,7 @@ tests: requests: - insertOne: - document: - _id: 1 + document: { _id: 1 } session: *session1 expectResult: deletedCount: 0 @@ -959,8 +933,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true readConcern: $$exists: false @@ -1025,8 +998,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1034,8 +1006,7 @@ tests: name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -1050,8 +1021,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -1087,8 +1057,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'readPreference inherited from defaultTransactionOptions' operations: @@ -1126,8 +1095,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1135,8 +1103,7 @@ tests: name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -1151,8 +1118,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -1188,8 +1154,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } - description: 'startTransaction overrides readPreference' operations: @@ -1230,8 +1195,7 @@ tests: name: insertOne arguments: session: *session1 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -1239,8 +1203,7 @@ tests: name: find arguments: session: *session1 - filter: - _id: 1 + filter: { _id: 1 } expectError: errorContains: 'read preference in a transaction must be primary' - @@ -1255,8 +1218,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true lsid: $$sessionLsid: *session1 @@ -1292,5 +1254,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 + - { _id: 1 } diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index cc8ef82d91..1af8c7a589 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -40,12 +40,9 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } tests: - @@ -59,11 +56,8 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 4 - update: - $inc: - x: 1 + filter: { _id: 4 } + update: { $inc: { x: 1 } } upsert: true expectResult: matchedCount: 0 @@ -75,10 +69,8 @@ tests: name: replaceOne arguments: session: *session0 - filter: - x: 1 - replacement: - 'y': 1 + filter: { x: 1 } + replacement: { y: 1 } expectResult: matchedCount: 1 modifiedCount: 1 @@ -88,12 +80,8 @@ tests: name: updateMany arguments: session: *session0 - filter: - _id: - $gte: 3 - update: - $set: - z: 1 + filter: { _id: { $gte: 3 } } + update: { $set: { z: 1 } } expectResult: matchedCount: 2 modifiedCount: 2 @@ -111,10 +99,8 @@ tests: update: *collection_name updates: - - q: - _id: 4 - u: - $inc: { x: 1 } + q: { _id: 4 } + u: { $inc: { x: 1 } } upsert: true multi: { $$unsetOrMatches: false } ordered: true @@ -136,10 +122,8 @@ tests: update: *collection_name updates: - - q: - x: 1 - u: - 'y': 1 + q: { x: 1 } + u: { y: 1 } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -160,10 +144,8 @@ tests: update: *collection_name updates: - - q: - _id: { $gte: 3 } - u: - $set: { z: 1 } + q: { _id: { $gte: 3 } } + u: { $set: { z: 1 } } multi: true upsert: { $$unsetOrMatches: false } ordered: true @@ -198,17 +180,10 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 1 - - - _id: 2 - - - _id: 3 - z: 1 - - - _id: 4 - 'y': 1 - z: 1 + - { _id: 1 } + - { _id: 2 } + - { _id: 3, z: 1 } + - { _id: 4, y: 1, z: 1 } - description: 'collections writeConcern ignored for update' operations: @@ -234,11 +209,8 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 4 - update: - $inc: - x: 1 + filter: { _id: 4 } + update: { $inc: { x: 1 } } upsert: true expectResult: matchedCount: 0 @@ -250,10 +222,8 @@ tests: name: replaceOne arguments: session: *session0 - filter: - x: 1 - replacement: - 'y': 1 + filter: { x: 1 } + replacement: { y: 1 } expectResult: matchedCount: 1 modifiedCount: 1 @@ -263,12 +233,8 @@ tests: name: updateMany arguments: session: *session0 - filter: - _id: - $gte: 3 - update: - $set: - z: 1 + filter: { _id: { $gte: 3 } } + update: { $set: { z: 1 } } expectResult: matchedCount: 2 modifiedCount: 2 @@ -286,10 +252,8 @@ tests: update: *collection_name updates: - - q: - _id: 4 - u: - $inc: { x: 1 } + q: { _id: 4 } + u: { $inc: { x: 1 } } upsert: true multi: { $$unsetOrMatches: false } ordered: true @@ -311,10 +275,8 @@ tests: update: *collection_name updates: - - q: - x: 1 - u: - 'y': 1 + q: { x: 1 } + u: { y: 1 } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true @@ -335,10 +297,8 @@ tests: update: *collection_name updates: - - q: - _id: { $gte: 3 } - u: - $set: { z: 1 } + q: { _id: { $gte: 3 } } + u: { $set: { z: 1 } } multi: true upsert: { $$unsetOrMatches: false } ordered: true diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index 8591a8b55c..467828b553 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -49,8 +49,7 @@ initialData: collectionName: *collection_name databaseName: *database_name documents: &data - - - _id: 0 + - { _id: 0 } tests: - @@ -67,8 +66,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - &commitTransaction @@ -83,8 +81,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true <<: &transactionCommandArgs lsid: @@ -119,10 +116,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - - - _id: 1 + - { _id: 0 } + - { _id: 1 } - description: 'commit with default' operations: @@ -134,8 +129,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - *commitTransaction @@ -148,8 +142,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true <<: *transactionCommandArgs commandName: insert @@ -174,10 +167,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - - - _id: 1 + - { _id: 0 } + - { _id: 1 } - description: 'abort with majority' operations: @@ -192,8 +183,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -208,8 +198,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true <<: *transactionCommandArgs commandName: insert @@ -245,8 +234,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - @@ -261,8 +249,7 @@ tests: command: insert: *collection_name documents: - - - _id: 1 + - { _id: 1 } ordered: true <<: *transactionCommandArgs commandName: insert @@ -329,8 +316,7 @@ tests: name: insertOne arguments: session: *session0 - document: - _id: 1 + document: { _id: 1 } expectResult: $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - *commitTransaction @@ -345,10 +331,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - - - _id: 1 + - { _id: 0 } + - { _id: 1 } - description: 'unacknowledged write concern coll insertMany' operations: @@ -359,10 +343,8 @@ tests: arguments: session: *session0 documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } expectResult: $$unsetOrMatches: insertedIds: @@ -379,10 +361,8 @@ tests: command: insert: *collection_name documents: - - - _id: 1 - - - _id: 2 + - { _id: 1 } + - { _id: 2 } ordered: true <<: *transactionCommandArgs commandName: insert @@ -393,12 +373,9 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - - - _id: 1 - - - _id: 2 + - { _id: 0 } + - { _id: 1 } + - { _id: 2 } - description: 'unacknowledged write concern coll bulkWrite' operations: @@ -411,8 +388,7 @@ tests: requests: - insertOne: - document: - _id: 1 + document: { _id: 1 } expectResult: deletedCount: 0 insertedCount: 1 @@ -435,10 +411,8 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - - - _id: 1 + - { _id: 0 } + - { _id: 1 } - description: 'unacknowledged write concern coll deleteOne' operations: @@ -448,8 +422,7 @@ tests: name: deleteOne arguments: session: *session0 - filter: - _id: 0 + filter: { _id: 0 } expectResult: deletedCount: 1 - *commitTransaction @@ -463,8 +436,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 0 + q: { _id: 0 } limit: 1 ordered: true <<: *transactionCommandArgs @@ -485,8 +457,7 @@ tests: name: deleteMany arguments: session: *session0 - filter: - _id: 0 + filter: { _id: 0 } expectResult: deletedCount: 1 - *commitTransaction @@ -500,8 +471,7 @@ tests: delete: *collection_name deletes: - - q: - _id: 0 + q: { _id: 0 } limit: 0 ordered: true <<: *transactionCommandArgs @@ -522,11 +492,8 @@ tests: name: updateOne arguments: session: *session0 - filter: - _id: 0 - update: - $inc: - x: 1 + filter: { _id: 0 } + update: { $inc: { x: 1 } } upsert: true expectResult: matchedCount: 1 @@ -543,10 +510,8 @@ tests: update: *collection_name updates: - - q: - _id: 0 - u: - $inc: { x: 1 } + q: { _id: 0 } + u: { $inc: { x: 1 } } upsert: true multi: { $$unsetOrMatches: false } ordered: true @@ -559,9 +524,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - x: 1 + - { _id: 0, x: 1 } - description: 'unacknowledged write concern coll updateMany' operations: @@ -571,11 +534,8 @@ tests: name: updateMany arguments: session: *session0 - filter: - _id: 0 - update: - $inc: - x: 1 + filter: { _id: 0 } + update: { $inc: { x: 1 } } upsert: true expectResult: matchedCount: 1 @@ -592,10 +552,8 @@ tests: update: *collection_name updates: - - q: - _id: 0 - u: - $inc: { x: 1 } + q: { _id: 0 } + u: { $inc: { x: 1 } } multi: true upsert: true ordered: true @@ -608,9 +566,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - x: 1 + - { _id: 0, x: 1 } - description: 'unacknowledged write concern coll findOneAndDelete' operations: @@ -620,8 +576,7 @@ tests: name: findOneAndDelete arguments: session: *session0 - filter: - _id: 0 + filter: { _id: 0 } expectResult: _id: 0 - *commitTransaction @@ -633,8 +588,7 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 0 + query: { _id: 0 } remove: true <<: *transactionCommandArgs commandName: findAndModify @@ -654,10 +608,8 @@ tests: name: findOneAndReplace arguments: session: *session0 - filter: - _id: 0 - replacement: - x: 1 + filter: { _id: 0 } + replacement: { x: 1 } returnDocument: Before expectResult: _id: 0 @@ -670,10 +622,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 0 - update: - x: 1 + query: { _id: 0 } + update: { x: 1 } new: false <<: *transactionCommandArgs commandName: findAndModify @@ -684,9 +634,7 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - x: 1 + - { _id: 0, x: 1 } - description: 'unacknowledged write concern coll findOneAndUpdate' operations: @@ -696,11 +644,8 @@ tests: name: findOneAndUpdate arguments: session: *session0 - filter: - _id: 0 - update: - $inc: - x: 1 + filter: { _id: 0 } + update: { $inc: { x: 1 } } returnDocument: Before expectResult: _id: 0 @@ -713,11 +658,8 @@ tests: commandStartedEvent: command: findAndModify: *collection_name - query: - _id: 0 - update: - $inc: - x: 1 + query: { _id: 0 } + update: { $inc: { x: 1 } } new: false <<: *transactionCommandArgs commandName: findAndModify @@ -728,6 +670,4 @@ tests: collectionName: *collection_name databaseName: *database_name documents: - - - _id: 0 - x: 1 + - { _id: 0, x: 1 } From 88318f66d6837d57bba6f7db209d9c39c21f7c02 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:20:55 -0500 Subject: [PATCH 43/55] Consolidate $$exists --- source/transactions/tests/unified/abort.yml | 90 ++---- source/transactions/tests/unified/bulk.yml | 60 ++-- .../tests/unified/causal-consistency.yml | 51 ++-- source/transactions/tests/unified/commit.yml | 138 +++------ source/transactions/tests/unified/count.yml | 12 +- .../tests/unified/create-collection.yml | 27 +- .../tests/unified/create-index.yml | 27 +- source/transactions/tests/unified/delete.yml | 39 +-- .../unified/error-labels-blockConnection.yml | 18 +- .../unified/error-labels-errorLabels.yml | 33 +-- .../tests/unified/error-labels.yml | 195 +++++-------- .../tests/unified/findOneAndDelete.yml | 36 +-- .../tests/unified/findOneAndReplace.yml | 36 +-- .../tests/unified/findOneAndUpdate.yml | 66 ++--- source/transactions/tests/unified/insert.yml | 90 ++---- .../mongos-recovery-token-errorLabels.yml | 18 +- .../tests/unified/mongos-recovery-token.yml | 72 ++--- .../transactions/tests/unified/pin-mongos.yml | 48 +-- .../tests/unified/read-concern.yml | 156 ++++------ source/transactions/tests/unified/reads.yml | 60 ++-- .../unified/retryable-abort-errorLabels.yml | 276 ++++++------------ .../tests/unified/retryable-abort.yml | 57 ++-- ...e-commit-errorLabels-forbid_serverless.yml | 30 +- .../unified/retryable-commit-errorLabels.yml | 210 +++++-------- .../retryable-commit-forbid_serverless.yml | 48 +-- .../tests/unified/retryable-commit.yml | 21 +- .../tests/unified/retryable-writes.yml | 60 ++-- .../tests/unified/run-command.yml | 36 +-- .../unified/transaction-options-repl.yml | 27 +- .../tests/unified/transaction-options.yml | 231 +++++---------- source/transactions/tests/unified/update.yml | 45 +-- .../tests/unified/write-concern.yml | 24 +- 32 files changed, 779 insertions(+), 1558 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index 98942893da..3761c5f88f 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -88,16 +88,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -108,11 +106,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -123,16 +119,14 @@ tests: - { _id: 1 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '2' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -143,11 +137,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -186,16 +178,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -206,11 +196,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -251,16 +239,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -271,11 +257,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -357,16 +341,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -377,11 +359,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -445,16 +425,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -464,17 +442,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -484,17 +459,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -505,11 +477,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index d31d50418c..906a3b1d94 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -156,16 +156,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -181,11 +179,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name # Commands in the bulkWrite @@ -200,11 +196,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -227,11 +221,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -249,11 +241,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -276,11 +266,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -299,11 +287,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -321,11 +307,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -341,11 +325,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -356,11 +338,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index 71d390f757..815ac26a1f 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -92,16 +92,11 @@ tests: ordered: true lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false - txnNumber: - $$exists: false - startTransaction: - $$exists: false - autocommit: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + txnNumber: { $$exists: false } + startTransaction: { $$exists: false } + autocommit: { $$exists: false } + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -116,16 +111,14 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -136,11 +129,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -189,16 +180,12 @@ tests: documents: - { _id: 2 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session_no_cc - txnNumber: - $$exists: false - autocommit: - $$exists: false - writeConcern: - $$exists: false + txnNumber: { $$exists: false } + autocommit: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -213,16 +200,14 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true # No afterClusterTime - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session_no_cc txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -233,11 +218,9 @@ tests: $$sessionLsid: *session_no_cc txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index 0b813740e8..8ae0891c91 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -108,16 +108,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -128,11 +126,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -143,16 +139,14 @@ tests: - { _id: 2 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '2' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -163,11 +157,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -215,16 +207,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '2' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -235,11 +225,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -282,16 +270,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -302,11 +288,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -317,8 +301,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -334,8 +317,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -459,16 +441,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -479,11 +459,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -540,16 +518,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -560,11 +536,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -575,8 +549,7 @@ tests: - { _id: 1 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 # txnNumber 2 was skipped @@ -584,8 +557,7 @@ tests: $numberLong: '3' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -596,11 +568,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '3' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -651,16 +621,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -671,11 +639,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -685,16 +651,12 @@ tests: documents: - { _id: 2 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 - txnNumber: - $$exists: false - startTransaction: - $$exists: false - autocommit: - $$exists: false + txnNumber: { $$exists: false } + startTransaction: { $$exists: false } + autocommit: { $$exists: false } commandName: insert databaseName: *database_name outcome: @@ -747,16 +709,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -767,11 +727,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -781,16 +739,12 @@ tests: documents: - { _id: 2 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 - txnNumber: - $$exists: false - startTransaction: - $$exists: false - autocommit: - $$exists: false + txnNumber: { $$exists: false } + startTransaction: { $$exists: false } + autocommit: { $$exists: false } commandName: insert databaseName: *database_name outcome: diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 6674caf14d..0769eafc84 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -80,16 +80,14 @@ tests: command: count: *collection_name query: { _id: 1 } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: count databaseName: *database_name - @@ -100,11 +98,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 14609e5b1d..719c387b3f 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -83,8 +83,7 @@ tests: commandStartedEvent: command: drop: *collection_name - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: drop databaseName: *database_name - @@ -97,8 +96,7 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: create databaseName: *database_name - @@ -109,11 +107,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -158,8 +154,7 @@ tests: commandStartedEvent: command: drop: *collection_name - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: drop databaseName: *database_name - @@ -169,16 +164,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -189,10 +182,8 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index 1937881bbb..72aa0879cd 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -86,8 +86,7 @@ tests: commandStartedEvent: command: drop: *collection_name - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: drop databaseName: *database_name - @@ -105,8 +104,7 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: createIndexes databaseName: *database_name - @@ -117,11 +115,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -174,8 +170,7 @@ tests: commandStartedEvent: command: drop: *collection_name - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: drop databaseName: *database_name - @@ -188,8 +183,7 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: create databaseName: *database_name - @@ -203,8 +197,7 @@ tests: x: 1 lsid: $$sessionLsid: *session0 - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: createIndexes databaseName: *database_name - @@ -215,10 +208,8 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index afb5a86a75..b9312fc93d 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -97,16 +97,14 @@ tests: q: { _id: 1 } limit: 1 ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -122,11 +120,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -142,11 +138,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -157,11 +151,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -222,16 +214,14 @@ tests: q: { _id: 1 } limit: 1 ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -247,11 +237,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: delete databaseName: *database_name - @@ -262,8 +250,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index b15c52891b..e69c32a04b 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -109,16 +109,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -129,11 +127,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -144,8 +140,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -161,8 +156,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index e8b4019107..4bfb923f8e 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -98,16 +98,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -118,11 +116,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -133,8 +129,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -150,8 +145,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -221,16 +215,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -241,8 +233,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -256,8 +247,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -273,8 +263,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 2b54d85bc2..5a280b28a0 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -85,16 +85,14 @@ tests: - { _id: 1 } - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -105,11 +103,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -163,16 +159,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -183,11 +177,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -241,16 +233,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -261,11 +251,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -319,16 +307,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -339,11 +325,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -399,16 +383,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -419,11 +401,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -504,30 +484,26 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - commandStartedEvent: command: find: *collection_name - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: find databaseName: *database_name @@ -538,14 +514,12 @@ tests: pipeline: - { $project: { _id: 1 } } cursor: { } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -556,12 +530,10 @@ tests: key: _id lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: distinct databaseName: *database_name @@ -573,11 +545,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -635,16 +605,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -655,11 +623,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -670,8 +636,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -687,8 +652,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -750,8 +714,7 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: @@ -768,8 +731,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: abortTransaction databaseName: admin @@ -833,16 +795,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -853,8 +813,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -868,8 +827,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -941,16 +899,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -961,8 +917,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -976,8 +931,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1042,16 +996,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1062,8 +1014,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1126,16 +1077,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1146,8 +1095,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1213,16 +1161,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1232,8 +1178,7 @@ tests: pipeline: - { $project: { _id: 1 } } cursor: { } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: @@ -1250,11 +1195,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -1316,16 +1259,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1336,8 +1277,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1352,8 +1292,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1424,16 +1363,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1444,8 +1381,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1460,8 +1396,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index 91a080f1d4..d555bfd908 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -88,10 +88,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -104,13 +102,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -121,13 +116,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -184,10 +176,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -198,11 +188,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority commandName: commitTransaction diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index b5fb1b852a..380e825da0 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -99,10 +99,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -117,13 +115,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -134,13 +129,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -203,10 +195,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -217,11 +207,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority commandName: commitTransaction diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 346eabef8f..2a9ce1eb12 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -141,10 +141,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -159,13 +157,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -176,13 +171,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -199,10 +191,8 @@ tests: startTransaction: true autocommit: false readConcern: - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -213,13 +203,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -236,10 +223,8 @@ tests: startTransaction: true autocommit: false readConcern: - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -250,13 +235,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '3' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -320,10 +302,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: findAndModify databaseName: *database_name - @@ -334,11 +314,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority commandName: commitTransaction diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index 92983afa68..34e16b3905 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -110,16 +110,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -134,11 +132,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -153,8 +149,7 @@ tests: txnNumber: $numberLong: '1' autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -165,11 +160,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -180,16 +173,14 @@ tests: - { _id: 5 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '2' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -200,11 +191,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -275,16 +264,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -299,11 +286,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -314,11 +299,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -329,16 +312,14 @@ tests: - { _id: 4 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '2' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -349,11 +330,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -412,16 +391,12 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session2 - txnNumber: - $$exists: false - startTransaction: - $$exists: false - autocommit: - $$exists: false + txnNumber: { $$exists: false } + startTransaction: { $$exists: false } + autocommit: { $$exists: false } writeConcern: w: majority commandName: insert @@ -488,16 +463,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -512,11 +485,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -527,8 +498,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index fca05f08cb..b6a7ba245e 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -97,16 +97,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -117,13 +115,11 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority - recoveryToken: - $$exists: true + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin - @@ -134,15 +130,13 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 - recoveryToken: - $$exists: true + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 543917e265..d4d83a7897 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -78,16 +78,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -98,13 +96,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin - @@ -115,15 +110,13 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 - recoveryToken: - $$exists: true + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin - @@ -134,15 +127,13 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 - recoveryToken: - $$exists: true + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin outcome: @@ -240,16 +231,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -260,13 +249,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin - @@ -277,15 +263,13 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: w: majority wtimeout: 10000 - recoveryToken: - $$exists: true + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin outcome: @@ -340,16 +324,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -360,13 +342,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: abortTransaction databaseName: admin - @@ -377,13 +356,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index d14285e2be..1df17f92d2 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -452,16 +452,14 @@ tests: documents: - { _id: 3 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -471,17 +469,14 @@ tests: documents: - { _id: 4 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -492,13 +487,10 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: abortTransaction databaseName: admin outcome: @@ -619,16 +611,14 @@ tests: documents: - { _id: 3 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -638,17 +628,14 @@ tests: documents: - { _id: 4 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -659,13 +646,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false - recoveryToken: - $$exists: true + writeConcern: { $$exists: false } + recoveryToken: { $$exists: true } commandName: commitTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index cc845c7e9f..e65d846eb9 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -107,12 +107,10 @@ tests: cursor: { } lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -122,15 +120,12 @@ tests: commitTransaction: 1 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: &outcome @@ -180,12 +175,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -196,12 +189,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: find databaseName: *database_name @@ -214,12 +205,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -275,12 +264,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -294,12 +281,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -312,12 +297,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -354,8 +337,7 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: distinct databaseName: *database_name - @@ -365,15 +347,12 @@ tests: key: _id lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: distinct databaseName: *database_name - *commitTransactionEvent @@ -408,8 +387,7 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: find databaseName: *database_name - @@ -418,15 +396,12 @@ tests: find: *collection_name lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: find databaseName: *database_name - *commitTransactionEvent @@ -454,8 +429,7 @@ tests: cursor: { } lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true @@ -472,12 +446,10 @@ tests: cursor: { } lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -501,8 +473,7 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true @@ -518,12 +489,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -534,12 +503,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: find databaseName: *database_name @@ -552,12 +519,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -584,8 +549,7 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true @@ -601,12 +565,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -620,12 +582,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -638,12 +598,10 @@ tests: batchSize: 3 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -667,14 +625,12 @@ tests: key: _id lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: distinct databaseName: *database_name - @@ -684,15 +640,12 @@ tests: key: _id lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: distinct databaseName: *database_name - *commitTransactionEvent @@ -721,14 +674,12 @@ tests: find: *collection_name lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: find databaseName: *database_name - @@ -737,15 +688,12 @@ tests: find: *collection_name lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: find databaseName: *database_name - *commitTransactionEvent diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 4ecc7e0f11..227650799c 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -79,12 +79,9 @@ tests: level: majority lsid: $$sessionLsid: *session0 - txnNumber: - $$exists: false - startTransaction: - $$exists: false - autocommit: - $$exists: false + txnNumber: { $$exists: false } + startTransaction: { $$exists: false } + autocommit: { $$exists: false } commandName: find databaseName: *database_name outcome: &outcome @@ -119,8 +116,7 @@ tests: command: find: *collection_name batchSize: 3 - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: @@ -140,8 +136,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -154,8 +149,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: find databaseName: *database_name @@ -170,8 +164,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -183,11 +176,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: *outcome @@ -218,8 +209,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: @@ -239,8 +229,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -256,8 +245,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: aggregate databaseName: *database_name @@ -272,8 +260,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false commandName: getMore databaseName: *database_name @@ -285,11 +272,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: *outcome @@ -317,14 +302,12 @@ tests: key: _id lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: distinct databaseName: *database_name - @@ -333,15 +316,12 @@ tests: commitTransaction: 1 lsid: $$sessionLsid: *session0 - readConcern: - $$exists: false + readConcern: { $$exists: false } txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: *outcome \ No newline at end of file diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 5fddc8c1e9..64cbd0bb20 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -87,16 +87,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -107,11 +105,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin # Driver retries abort once @@ -123,11 +119,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -178,16 +172,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -198,11 +190,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin # Driver does not retry abort @@ -255,16 +245,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -275,11 +263,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -290,11 +276,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -346,16 +330,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -366,11 +348,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -381,11 +361,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -437,16 +415,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -457,11 +433,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -472,11 +446,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -528,16 +500,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -548,11 +518,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -563,11 +531,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -619,16 +585,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -639,11 +603,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -654,11 +616,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -710,16 +670,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -730,11 +688,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -745,11 +701,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -801,16 +755,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -821,11 +773,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -836,11 +786,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -892,16 +840,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -912,11 +858,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -927,11 +871,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -983,16 +925,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1003,11 +943,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -1018,11 +956,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -1074,16 +1010,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1094,11 +1028,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -1109,11 +1041,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -1165,16 +1095,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1185,11 +1113,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -1200,11 +1126,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -1260,16 +1184,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1280,8 +1202,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1295,8 +1216,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1355,16 +1275,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1375,8 +1293,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1390,8 +1307,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1450,16 +1366,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1470,8 +1384,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1485,8 +1398,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1545,16 +1457,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1565,8 +1475,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1580,8 +1489,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index 8702b4a771..1ea4adf639 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -106,16 +106,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -126,11 +124,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -141,11 +137,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -195,16 +189,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -215,11 +207,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: @@ -273,16 +263,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -293,8 +281,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -346,16 +333,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -366,11 +351,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -381,11 +364,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 18e67d4b53..1d6f9d3ac0 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -95,16 +95,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -115,11 +113,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -130,8 +126,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -189,16 +184,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -209,11 +202,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -224,8 +215,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index da93e04d3a..4304e17a68 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -108,16 +108,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -128,11 +126,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin # Driver does not retry commit because there was no RetryableWriteError label on response @@ -185,16 +181,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -205,11 +199,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -220,8 +212,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -279,16 +270,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -299,11 +288,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -314,8 +301,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -373,16 +359,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -393,11 +377,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -408,8 +390,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -467,16 +448,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -487,11 +466,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -502,8 +479,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -561,16 +537,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -581,11 +555,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -596,8 +568,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -655,16 +626,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -675,11 +644,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -690,8 +657,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -749,16 +715,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -769,11 +733,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -784,8 +746,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -843,16 +804,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -863,11 +822,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -878,8 +835,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -937,16 +893,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -957,11 +911,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -972,8 +924,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1031,16 +982,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1051,11 +1000,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -1066,8 +1013,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1129,16 +1075,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1149,8 +1093,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1164,8 +1107,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1227,16 +1169,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1247,8 +1187,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1262,8 +1201,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1325,16 +1263,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1345,8 +1281,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1360,8 +1295,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -1423,16 +1357,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1443,8 +1375,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -1458,8 +1389,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 909861aa13..2ea2439a84 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -125,16 +125,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -145,11 +143,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -160,8 +156,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -177,8 +172,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -248,16 +242,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -268,8 +260,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: 2 @@ -285,8 +276,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: @@ -303,8 +293,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -359,16 +348,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -379,11 +366,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -394,8 +379,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries writeConcern: diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 87fae61de6..6d38877079 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -90,16 +90,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -110,11 +108,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -173,16 +169,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -193,8 +187,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index 57cf55ae90..bc3bd7ad35 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -106,16 +106,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -126,11 +124,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -140,18 +136,14 @@ tests: documents: - { _id: 2 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false - autocommit: - $$exists: false - writeConcern: - $$exists: false + startTransaction: { $$exists: false } + autocommit: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -162,16 +154,14 @@ tests: - { _id: 3 } ordered: true readConcern: - afterClusterTime: - $$exists: true + afterClusterTime: { $$exists: true } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '3' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -182,11 +172,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '3' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin - @@ -197,18 +185,14 @@ tests: - { _id: 4 } - { _id: 5 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '4' - startTransaction: - $$exists: false - autocommit: - $$exists: false - writeConcern: - $$exists: false + startTransaction: { $$exists: false } + autocommit: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name outcome: @@ -262,16 +246,14 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -282,11 +264,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index f9434344d4..d78c1c6ab0 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -73,16 +73,14 @@ tests: insert: *collection_name documents: - { _id: 1 } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -93,11 +91,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -152,16 +148,14 @@ tests: insert: *collection_name documents: - { _id: 1 } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -172,11 +166,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -212,16 +204,14 @@ tests: insert: *collection_name documents: - { _id: 1 } - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -232,11 +222,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index 341d217055..b9b8dea4c9 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -105,8 +105,7 @@ tests: autocommit: false readConcern: level: snapshot - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -117,13 +116,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -141,10 +137,8 @@ tests: autocommit: false readConcern: level: snapshot - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -155,13 +149,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index f29199bd4e..c4229a008b 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -91,12 +91,9 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -107,15 +104,11 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -132,12 +125,9 @@ tests: startTransaction: true autocommit: false readConcern: - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -148,15 +138,11 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: &outcome @@ -239,10 +225,8 @@ tests: autocommit: false readConcern: level: local - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -253,15 +237,12 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 - maxTimeMS: - $$exists: false + maxTimeMS: { $$exists: false } commandName: commitTransaction databaseName: admin - @@ -279,12 +260,9 @@ tests: autocommit: false readConcern: level: local - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -295,15 +273,12 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 - maxTimeMS: - $$exists: false + maxTimeMS: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: *outcome @@ -370,8 +345,7 @@ tests: autocommit: false readConcern: level: majority - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -382,11 +356,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 maxTimeMS: 60000 @@ -407,10 +379,8 @@ tests: autocommit: false readConcern: level: majority - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -421,11 +391,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 commandName: abortTransaction @@ -521,10 +489,8 @@ tests: autocommit: false readConcern: level: majority - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -535,11 +501,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority maxTimeMS: 60000 @@ -560,12 +524,9 @@ tests: autocommit: false readConcern: level: majority - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -576,15 +537,12 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority - maxTimeMS: - $$exists: false + maxTimeMS: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: *outcome @@ -667,10 +625,8 @@ tests: autocommit: false readConcern: level: majority - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -681,11 +637,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority maxTimeMS: 60000 @@ -706,12 +660,9 @@ tests: autocommit: false readConcern: level: majority - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false - maxTimeMS: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } + maxTimeMS: { $$exists: false } commandName: insert databaseName: *database_name - @@ -722,15 +673,12 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: majority - maxTimeMS: - $$exists: false + maxTimeMS: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: *outcome @@ -810,8 +758,7 @@ tests: autocommit: false readConcern: level: local - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -822,11 +769,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 commandName: commitTransaction @@ -846,10 +791,8 @@ tests: autocommit: false readConcern: level: local - afterClusterTime: - $$exists: true - writeConcern: - $$exists: false + afterClusterTime: { $$exists: true } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -860,11 +803,9 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '2' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false + readConcern: { $$exists: false } writeConcern: w: 1 commandName: abortTransaction @@ -935,8 +876,7 @@ tests: documents: - { _id: 1 } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session1 txnNumber: @@ -944,8 +884,7 @@ tests: startTransaction: true autocommit: false # No writeConcern - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -956,8 +895,7 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: 1 @@ -1029,10 +967,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1043,13 +979,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -1126,10 +1059,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1140,13 +1071,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -1226,10 +1154,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -1240,13 +1166,10 @@ tests: $$sessionLsid: *session1 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index 1af8c7a589..bd898fd468 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -104,16 +104,14 @@ tests: upsert: true multi: { $$unsetOrMatches: false } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -131,11 +129,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -153,11 +149,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -168,11 +162,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -257,16 +249,14 @@ tests: upsert: true multi: { $$unsetOrMatches: false } ordered: true - readConcern: - $$exists: false + readConcern: { $$exists: false } lsid: $$sessionLsid: *session0 txnNumber: $numberLong: '1' startTransaction: true autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -284,11 +274,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -306,11 +294,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: update databaseName: *database_name - @@ -321,8 +307,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index 467828b553..d5befcffad 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -90,10 +90,8 @@ tests: $numberLong: '1' startTransaction: true autocommit: false - readConcern: - $$exists: false - writeConcern: - $$exists: false + readConcern: { $$exists: false } + writeConcern: { $$exists: false } commandName: insert databaseName: *database_name - @@ -104,8 +102,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -155,11 +152,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: commitTransaction databaseName: admin outcome: @@ -211,8 +206,7 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false writeConcern: w: majority @@ -262,11 +256,9 @@ tests: $$sessionLsid: *session0 txnNumber: $numberLong: '1' - startTransaction: - $$exists: false + startTransaction: { $$exists: false } autocommit: false - writeConcern: - $$exists: false + writeConcern: { $$exists: false } commandName: abortTransaction databaseName: admin outcome: From 63324203270a3d36c20ce5a20d77aca1da04f1c4 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:25:42 -0500 Subject: [PATCH 44/55] Consolidate $$sessionLsid --- source/transactions/tests/unified/abort.yml | 42 ++--- source/transactions/tests/unified/bulk.yml | 30 ++-- .../tests/unified/causal-consistency.yml | 18 +-- source/transactions/tests/unified/commit.yml | 66 +++----- source/transactions/tests/unified/count.yml | 6 +- .../tests/unified/create-collection.yml | 12 +- .../tests/unified/create-index.yml | 15 +- source/transactions/tests/unified/delete.yml | 21 +-- .../unified/error-labels-blockConnection.yml | 12 +- .../unified/error-labels-errorLabels.yml | 24 +-- .../tests/unified/error-labels.yml | 120 +++++--------- .../tests/unified/findOneAndDelete.yml | 15 +- .../tests/unified/findOneAndReplace.yml | 15 +- .../tests/unified/findOneAndUpdate.yml | 27 ++-- source/transactions/tests/unified/insert.yml | 45 ++---- .../mongos-recovery-token-errorLabels.yml | 9 +- .../tests/unified/mongos-recovery-token.yml | 30 ++-- .../transactions/tests/unified/pin-mongos.yml | 18 +-- .../tests/unified/read-concern.yml | 87 ++++------ source/transactions/tests/unified/reads.yml | 39 ++--- .../unified/retryable-abort-errorLabels.yml | 150 ++++++------------ .../unified/retryable-abort-handshake.yml | 3 +- .../tests/unified/retryable-abort.yml | 30 ++-- ...e-commit-errorLabels-forbid_serverless.yml | 18 +-- .../unified/retryable-commit-errorLabels.yml | 132 +++++---------- .../retryable-commit-forbid_serverless.yml | 33 ++-- .../unified/retryable-commit-handshake.yml | 3 +- .../tests/unified/retryable-commit.yml | 12 +- .../tests/unified/retryable-writes.yml | 24 +-- .../tests/unified/run-command.yml | 18 +-- .../unified/transaction-options-repl.yml | 12 +- .../tests/unified/transaction-options.yml | 96 ++++------- source/transactions/tests/unified/update.yml | 24 +-- .../tests/unified/write-concern.yml | 15 +- 34 files changed, 407 insertions(+), 814 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index 3761c5f88f..e27d7c81aa 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -89,8 +89,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -102,8 +101,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -120,8 +118,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -133,8 +130,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -179,8 +175,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -192,8 +187,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -240,8 +234,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -253,8 +246,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -342,8 +334,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -355,8 +346,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -426,8 +416,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -443,8 +432,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -460,8 +448,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -473,8 +460,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index 906a3b1d94..64a4fb968c 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -157,8 +157,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -175,8 +174,7 @@ tests: q: { _id: 1 } limit: 1 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -192,8 +190,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -217,8 +214,7 @@ tests: upsert: true multi: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -237,8 +233,7 @@ tests: - { _id: 6 } - { _id: 7 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -262,8 +257,7 @@ tests: multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -283,8 +277,7 @@ tests: q: { _id: 4 } limit: 1 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -303,8 +296,7 @@ tests: multi: true upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -321,8 +313,7 @@ tests: q: { _id: { $gte: 6 } } limit: 0 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -334,8 +325,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index 815ac26a1f..fad6b8b7c2 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -90,8 +90,7 @@ tests: multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: { $$exists: false } startTransaction: { $$exists: false } @@ -112,8 +111,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -125,8 +123,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -181,8 +178,7 @@ tests: - { _id: 2 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session_no_cc + lsid: { $$sessionLsid: *session_no_cc } txnNumber: { $$exists: false } autocommit: { $$exists: false } writeConcern: { $$exists: false } @@ -201,8 +197,7 @@ tests: ordered: true # No afterClusterTime readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session_no_cc + lsid: { $$sessionLsid: *session_no_cc } txnNumber: $numberLong: '1' startTransaction: true @@ -214,8 +209,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session_no_cc + lsid: { $$sessionLsid: *session_no_cc } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index 8ae0891c91..a4677516ec 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -109,8 +109,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -122,8 +121,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -140,8 +138,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -153,8 +150,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -208,8 +204,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -221,8 +216,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -271,8 +265,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -284,8 +277,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -297,8 +289,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -313,8 +304,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -442,8 +432,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -455,8 +444,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -519,8 +507,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -532,8 +519,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -550,8 +536,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } # txnNumber 2 was skipped txnNumber: $numberLong: '3' @@ -564,8 +549,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '3' startTransaction: { $$exists: false } @@ -622,8 +606,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -635,8 +618,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -652,8 +634,7 @@ tests: - { _id: 2 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: { $$exists: false } startTransaction: { $$exists: false } autocommit: { $$exists: false } @@ -710,8 +691,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -723,8 +703,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -740,8 +719,7 @@ tests: - { _id: 2 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: { $$exists: false } startTransaction: { $$exists: false } autocommit: { $$exists: false } diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 0769eafc84..b7d3df3b2b 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -81,8 +81,7 @@ tests: count: *collection_name query: { _id: 1 } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -94,8 +93,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 719c387b3f..c66753e448 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -90,8 +90,7 @@ tests: commandStartedEvent: command: create: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -103,8 +102,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -165,8 +163,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -178,8 +175,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index 72aa0879cd..cffe255d5a 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -98,8 +98,7 @@ tests: name: *index_name key: x: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -111,8 +110,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -177,8 +175,7 @@ tests: commandStartedEvent: command: create: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -195,8 +192,7 @@ tests: name: *index_name key: x: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } writeConcern: { $$exists: false } commandName: createIndexes databaseName: *database_name @@ -204,8 +200,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index b9312fc93d..fc19d6bc5e 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -98,8 +98,7 @@ tests: limit: 1 ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -116,8 +115,7 @@ tests: q: { _id: { $lte: 3 } } limit: 0 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -134,8 +132,7 @@ tests: q: { _id: 4 } limit: 1 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -147,8 +144,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -215,8 +211,7 @@ tests: limit: 1 ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -233,8 +228,7 @@ tests: q: { _id: { $lte: 3 } } limit: 0 ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -246,8 +240,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index e69c32a04b..e5091a04d7 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -110,8 +110,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -123,8 +122,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -136,8 +134,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -152,8 +149,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 4bfb923f8e..9f778d5905 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -99,8 +99,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -112,8 +111,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -125,8 +123,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -141,8 +138,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -216,8 +212,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -229,8 +224,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -243,8 +237,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -259,8 +252,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 5a280b28a0..ca48c77d06 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -86,8 +86,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -99,8 +98,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -160,8 +158,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -173,8 +170,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -234,8 +230,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -247,8 +242,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -308,8 +302,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -321,8 +314,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -384,8 +376,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -397,8 +388,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -485,8 +475,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -499,8 +488,7 @@ tests: command: find: *collection_name readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -515,8 +503,7 @@ tests: - { $project: { _id: 1 } } cursor: { } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -528,8 +515,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -541,8 +527,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -606,8 +591,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -619,8 +603,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -632,8 +615,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -648,8 +630,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -715,8 +696,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -727,8 +707,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -796,8 +775,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -809,8 +787,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -823,8 +800,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -900,8 +876,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -913,8 +888,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -927,8 +901,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -997,8 +970,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1010,8 +982,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1078,8 +1049,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1091,8 +1061,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1162,8 +1131,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1179,8 +1147,7 @@ tests: - { $project: { _id: 1 } } cursor: { } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' autocommit: false @@ -1191,8 +1158,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1260,8 +1226,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1273,8 +1238,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1288,8 +1252,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1364,8 +1327,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1377,8 +1339,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1392,8 +1353,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index d555bfd908..d07ec2d810 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -82,8 +82,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } remove: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -98,8 +97,7 @@ tests: findAndModify: *collection_name query: { _id: 4 } remove: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -112,8 +110,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -170,8 +167,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } remove: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -184,8 +180,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 380e825da0..c1375fd123 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -93,8 +93,7 @@ tests: query: { _id: 3 } update: { x: 1 } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -111,8 +110,7 @@ tests: update: { x: 1 } new: true upsert: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -125,8 +123,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -189,8 +186,7 @@ tests: query: { _id: 3 } update: { x: 1 } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -203,8 +199,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 2a9ce1eb12..28e1e59dac 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -135,8 +135,7 @@ tests: query: { _id: 3 } update: { $inc: { x: 1 } } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -153,8 +152,7 @@ tests: update: { $inc: { x: 1 } } new: true upsert: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -167,8 +165,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -184,8 +181,7 @@ tests: query: { _id: 3 } update: { $inc: { x: 1 } } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -199,8 +195,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -216,8 +211,7 @@ tests: query: { _id: 3 } update: { $inc: { x: 1 } } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '3' startTransaction: true @@ -231,8 +225,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '3' startTransaction: { $$exists: false } @@ -296,8 +289,7 @@ tests: query: { _id: 3 } update: { $inc: { x: 1 } } new: false - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -310,8 +302,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index 34e16b3905..2767d9152a 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -111,8 +111,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -128,8 +127,7 @@ tests: - { _id: 2 } - { _id: 3 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -144,8 +142,7 @@ tests: documents: - { _id: 4 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' autocommit: false @@ -156,8 +153,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -174,8 +170,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -187,8 +182,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -265,8 +259,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -282,8 +275,7 @@ tests: - { _id: 2 } - { _id: 3 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -295,8 +287,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -313,8 +304,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -326,8 +316,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -392,8 +381,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session2 + lsid: { $$sessionLsid: *session2 } txnNumber: { $$exists: false } startTransaction: { $$exists: false } autocommit: { $$exists: false } @@ -464,8 +452,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -481,8 +468,7 @@ tests: - { _id: 2 } - { _id: 3 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -494,8 +480,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index b6a7ba245e..b6726b71d9 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -98,8 +98,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -111,8 +110,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -126,8 +124,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index d4d83a7897..541c3a495e 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -79,8 +79,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -92,8 +91,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -106,8 +104,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -123,8 +120,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -232,8 +228,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -245,8 +240,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -259,8 +253,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -325,8 +318,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -338,8 +330,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -352,8 +343,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 1df17f92d2..47689ae68c 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -453,8 +453,7 @@ tests: - { _id: 3 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -470,8 +469,7 @@ tests: - { _id: 4 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -483,8 +481,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -612,8 +609,7 @@ tests: - { _id: 3 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -629,8 +625,7 @@ tests: - { _id: 4 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -642,8 +637,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index e65d846eb9..8a03ba4cc0 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -87,8 +87,7 @@ tests: - { $match: { _id: { $gte: 2 } } } - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: level: majority txnNumber: @@ -105,8 +104,7 @@ tests: - { $match: { _id: { $gte: 2 } } } - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -118,8 +116,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -156,8 +153,7 @@ tests: command: find: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: level: majority txnNumber: @@ -173,8 +169,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -187,8 +182,7 @@ tests: command: find: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -203,8 +197,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -245,8 +238,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: level: majority txnNumber: @@ -262,8 +254,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -279,8 +270,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -295,8 +285,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -329,8 +318,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: level: majority txnNumber: @@ -345,8 +333,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -379,8 +366,7 @@ tests: commandStartedEvent: command: find: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: level: majority txnNumber: @@ -394,8 +380,7 @@ tests: commandStartedEvent: command: find: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -427,8 +412,7 @@ tests: - { $match: { _id: { $gte: 2 } } } - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -444,8 +428,7 @@ tests: - { $match: { _id: { $gte: 2 } } } - { $group: { _id: 1, n: { $sum: 1 } } } cursor: { } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -471,8 +454,7 @@ tests: command: find: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -487,8 +469,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -501,8 +482,7 @@ tests: command: find: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -517,8 +497,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -547,8 +526,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -563,8 +541,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -580,8 +557,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -596,8 +572,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -623,8 +598,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -638,8 +612,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -672,8 +645,7 @@ tests: commandStartedEvent: command: find: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -686,8 +658,7 @@ tests: commandStartedEvent: command: find: *collection_name - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 227650799c..3d94b47d6c 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -77,8 +77,7 @@ tests: find: *collection_name readConcern: level: majority - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: { $$exists: false } startTransaction: { $$exists: false } autocommit: { $$exists: false } @@ -117,8 +116,7 @@ tests: find: *collection_name batchSize: 3 readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -132,8 +130,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -145,8 +142,7 @@ tests: command: find: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -160,8 +156,7 @@ tests: $$type: [ int, long ] collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -172,8 +167,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -210,8 +204,7 @@ tests: cursor: batchSize: 3 readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -225,8 +218,7 @@ tests: $$type: long collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -241,8 +233,7 @@ tests: - { $project: { _id: 1 } } cursor: batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -256,8 +247,7 @@ tests: $$type: long collection: *collection_name batchSize: 3 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -268,8 +258,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -300,8 +289,7 @@ tests: command: distinct: *collection_name key: _id - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' @@ -314,8 +302,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } txnNumber: $numberLong: '1' diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 64cbd0bb20..8efd6683cb 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -88,8 +88,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -101,8 +100,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -115,8 +113,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -173,8 +170,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -186,8 +182,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -246,8 +241,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -259,8 +253,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -272,8 +265,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -331,8 +323,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -344,8 +335,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -357,8 +347,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -416,8 +405,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -429,8 +417,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -442,8 +429,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -501,8 +487,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -514,8 +499,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -527,8 +511,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -586,8 +569,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -599,8 +581,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -612,8 +593,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -671,8 +651,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -684,8 +663,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -697,8 +675,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -756,8 +733,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -769,8 +745,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -782,8 +757,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -841,8 +815,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -854,8 +827,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -867,8 +839,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -926,8 +897,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -939,8 +909,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -952,8 +921,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1011,8 +979,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1024,8 +991,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1037,8 +1003,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1096,8 +1061,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1109,8 +1073,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1122,8 +1085,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1185,8 +1147,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1198,8 +1159,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1212,8 +1172,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1276,8 +1235,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1289,8 +1247,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1303,8 +1260,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1367,8 +1323,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1380,8 +1335,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1394,8 +1348,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1458,8 +1411,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1471,8 +1423,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1485,8 +1436,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-abort-handshake.yml b/source/transactions/tests/unified/retryable-abort-handshake.yml index d0e9ec86b4..2d91b75a99 100644 --- a/source/transactions/tests/unified/retryable-abort-handshake.yml +++ b/source/transactions/tests/unified/retryable-abort-handshake.yml @@ -106,8 +106,7 @@ tests: - commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } commandName: abortTransaction databaseName: admin diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index 1ea4adf639..aa28514a7b 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -107,8 +107,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -120,8 +119,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -133,8 +131,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -190,8 +187,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -203,8 +199,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -264,8 +259,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -277,8 +271,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -334,8 +327,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -347,8 +339,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -360,8 +351,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 1d6f9d3ac0..8f05687846 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -96,8 +96,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -109,8 +108,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -122,8 +120,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -185,8 +182,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -198,8 +194,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -211,8 +206,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index 4304e17a68..b4bbe8cd6b 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -109,8 +109,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -122,8 +121,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -182,8 +180,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -195,8 +192,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -208,8 +204,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -271,8 +266,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -284,8 +278,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -297,8 +290,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -360,8 +352,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -373,8 +364,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -386,8 +376,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -449,8 +438,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -462,8 +450,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -475,8 +462,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -538,8 +524,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -551,8 +536,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -564,8 +548,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -627,8 +610,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -640,8 +622,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -653,8 +634,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -716,8 +696,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -729,8 +708,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -742,8 +720,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -805,8 +782,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -818,8 +794,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -831,8 +806,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -894,8 +868,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -907,8 +880,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -920,8 +892,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -983,8 +954,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -996,8 +966,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1009,8 +978,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1076,8 +1044,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1089,8 +1056,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1103,8 +1069,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1170,8 +1135,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1183,8 +1147,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1197,8 +1160,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1264,8 +1226,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1277,8 +1238,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1291,8 +1251,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1358,8 +1317,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -1371,8 +1329,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1385,8 +1342,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 2ea2439a84..27a267caeb 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -126,8 +126,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -139,8 +138,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -152,8 +150,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -168,8 +165,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -243,8 +239,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -256,8 +251,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -272,8 +266,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -289,8 +282,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -349,8 +341,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -362,8 +353,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -375,8 +365,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-commit-handshake.yml b/source/transactions/tests/unified/retryable-commit-handshake.yml index e9904fdf51..6a03ba6b6d 100644 --- a/source/transactions/tests/unified/retryable-commit-handshake.yml +++ b/source/transactions/tests/unified/retryable-commit-handshake.yml @@ -105,8 +105,7 @@ tests: - commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } commandName: commitTransaction databaseName: admin diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 6d38877079..8aa49f6476 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -91,8 +91,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -104,8 +103,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -170,8 +168,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -183,8 +180,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index bc3bd7ad35..274f5c6b72 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -107,8 +107,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -120,8 +119,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -137,8 +135,7 @@ tests: - { _id: 2 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -155,8 +152,7 @@ tests: ordered: true readConcern: afterClusterTime: { $$exists: true } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '3' startTransaction: true @@ -168,8 +164,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '3' startTransaction: { $$exists: false } @@ -186,8 +181,7 @@ tests: - { _id: 5 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '4' startTransaction: { $$exists: false } @@ -247,8 +241,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -260,8 +253,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index d78c1c6ab0..1e2c481420 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -74,8 +74,7 @@ tests: documents: - { _id: 1 } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -87,8 +86,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -149,8 +147,7 @@ tests: documents: - { _id: 1 } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -162,8 +159,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -205,8 +201,7 @@ tests: documents: - { _id: 1 } readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -218,8 +213,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index b9b8dea4c9..b3b7c0859e 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -97,8 +97,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -112,8 +111,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -129,8 +127,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -145,8 +142,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index c4229a008b..384f4b0893 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -85,8 +85,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -100,8 +99,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -118,8 +116,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: true @@ -134,8 +131,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -217,8 +213,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -233,8 +228,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -252,8 +246,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -269,8 +262,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -337,8 +329,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -352,8 +343,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -371,8 +361,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -387,8 +376,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -481,8 +469,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -497,8 +484,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -516,8 +502,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -533,8 +518,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -617,8 +601,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -633,8 +616,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -652,8 +634,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -669,8 +650,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -750,8 +730,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -765,8 +744,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -783,8 +761,7 @@ tests: documents: - { _id: 2 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: true @@ -799,8 +776,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '2' startTransaction: { $$exists: false } @@ -877,8 +853,7 @@ tests: - { _id: 1 } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -891,8 +866,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -961,8 +935,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -975,8 +948,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1053,8 +1025,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -1067,8 +1038,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -1148,8 +1118,7 @@ tests: documents: - { _id: 1 } ordered: true - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: true @@ -1162,8 +1131,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session1 + lsid: { $$sessionLsid: *session1 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index bd898fd468..126dff879d 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -105,8 +105,7 @@ tests: multi: { $$unsetOrMatches: false } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -125,8 +124,7 @@ tests: multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -145,8 +143,7 @@ tests: multi: true upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -158,8 +155,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -250,8 +246,7 @@ tests: multi: { $$unsetOrMatches: false } ordered: true readConcern: { $$exists: false } - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -270,8 +265,7 @@ tests: multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -290,8 +284,7 @@ tests: multi: true upsert: { $$unsetOrMatches: false } ordered: true - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -303,8 +296,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index d5befcffad..23b94d395f 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -84,8 +84,7 @@ tests: - { _id: 1 } ordered: true <<: &transactionCommandArgs - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: true @@ -98,8 +97,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -148,8 +146,7 @@ tests: commandStartedEvent: command: commitTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -202,8 +199,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } @@ -252,8 +248,7 @@ tests: commandStartedEvent: command: abortTransaction: 1 - lsid: - $$sessionLsid: *session0 + lsid: { $$sessionLsid: *session0 } txnNumber: $numberLong: '1' startTransaction: { $$exists: false } From 833905b38b39c1bb3e936081685d92d7bef03526 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:27:20 -0500 Subject: [PATCH 45/55] Consolidate $numberLong --- source/transactions/tests/unified/abort.yml | 42 ++--- source/transactions/tests/unified/bulk.yml | 30 ++-- .../tests/unified/causal-consistency.yml | 12 +- source/transactions/tests/unified/commit.yml | 60 +++---- source/transactions/tests/unified/count.yml | 6 +- .../tests/unified/create-collection.yml | 12 +- .../tests/unified/create-index.yml | 12 +- source/transactions/tests/unified/delete.yml | 21 +-- .../unified/error-labels-blockConnection.yml | 12 +- .../unified/error-labels-errorLabels.yml | 24 +-- .../tests/unified/error-labels.yml | 120 +++++--------- .../tests/unified/findOneAndDelete.yml | 15 +- .../tests/unified/findOneAndReplace.yml | 15 +- .../tests/unified/findOneAndUpdate.yml | 27 ++-- source/transactions/tests/unified/insert.yml | 42 ++--- .../mongos-recovery-token-errorLabels.yml | 9 +- .../tests/unified/mongos-recovery-token.yml | 30 ++-- .../transactions/tests/unified/pin-mongos.yml | 18 +-- .../tests/unified/read-concern.yml | 87 ++++------ source/transactions/tests/unified/reads.yml | 36 ++--- .../unified/retryable-abort-errorLabels.yml | 150 ++++++------------ .../tests/unified/retryable-abort.yml | 30 ++-- ...e-commit-errorLabels-forbid_serverless.yml | 18 +-- .../unified/retryable-commit-errorLabels.yml | 132 +++++---------- .../retryable-commit-forbid_serverless.yml | 33 ++-- .../tests/unified/retryable-commit.yml | 12 +- .../tests/unified/retryable-writes.yml | 24 +-- .../tests/unified/run-command.yml | 18 +-- .../unified/transaction-options-repl.yml | 12 +- .../tests/unified/transaction-options.yml | 96 ++++------- source/transactions/tests/unified/update.yml | 24 +-- .../tests/unified/write-concern.yml | 15 +- 32 files changed, 398 insertions(+), 796 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index e27d7c81aa..017275dcbc 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -90,8 +90,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -102,8 +101,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -119,8 +117,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -131,8 +128,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -176,8 +172,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -188,8 +183,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -235,8 +229,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -247,8 +240,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -335,8 +327,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -347,8 +338,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -417,8 +407,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -433,8 +422,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -449,8 +437,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -461,8 +448,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index 64a4fb968c..32cd3d1407 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -158,8 +158,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -175,8 +174,7 @@ tests: limit: 1 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -191,8 +189,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -215,8 +212,7 @@ tests: multi: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -234,8 +230,7 @@ tests: - { _id: 7 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -258,8 +253,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -278,8 +272,7 @@ tests: limit: 1 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -297,8 +290,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -314,8 +306,7 @@ tests: limit: 0 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -326,8 +317,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/causal-consistency.yml b/source/transactions/tests/unified/causal-consistency.yml index fad6b8b7c2..c3e75523de 100644 --- a/source/transactions/tests/unified/causal-consistency.yml +++ b/source/transactions/tests/unified/causal-consistency.yml @@ -112,8 +112,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -124,8 +123,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -198,8 +196,7 @@ tests: # No afterClusterTime readConcern: { $$exists: false } lsid: { $$sessionLsid: *session_no_cc } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -210,8 +207,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session_no_cc } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/commit.yml b/source/transactions/tests/unified/commit.yml index a4677516ec..d9af084894 100644 --- a/source/transactions/tests/unified/commit.yml +++ b/source/transactions/tests/unified/commit.yml @@ -110,8 +110,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -122,8 +121,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -139,8 +137,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -151,8 +148,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -205,8 +201,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -217,8 +212,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -266,8 +260,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -278,8 +271,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -290,8 +282,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -305,8 +296,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -433,8 +423,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -445,8 +434,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -508,8 +496,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -520,8 +507,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -538,8 +524,7 @@ tests: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } # txnNumber 2 was skipped - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -550,8 +535,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -607,8 +591,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -619,8 +602,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -692,8 +674,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -704,8 +685,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index b7d3df3b2b..52b89e9377 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -82,8 +82,7 @@ tests: query: { _id: 1 } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -94,8 +93,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index c66753e448..77c37b6bb4 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -91,8 +91,7 @@ tests: command: create: *collection_name lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -103,8 +102,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -164,8 +162,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -176,8 +173,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index cffe255d5a..4c1b45826b 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -99,8 +99,7 @@ tests: key: x: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -111,8 +110,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -176,8 +174,7 @@ tests: command: create: *collection_name lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -201,8 +198,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index fc19d6bc5e..d7536d9f8f 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -99,8 +99,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -116,8 +115,7 @@ tests: limit: 0 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -133,8 +131,7 @@ tests: limit: 1 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -145,8 +142,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -212,8 +208,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -229,8 +224,7 @@ tests: limit: 0 ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -241,8 +235,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index e5091a04d7..efa16ecb86 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -111,8 +111,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -123,8 +122,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -135,8 +133,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -150,8 +147,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 9f778d5905..b5f0d5237f 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -100,8 +100,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -112,8 +111,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -124,8 +122,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -139,8 +136,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -213,8 +209,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -225,8 +220,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -238,8 +232,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -253,8 +246,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index ca48c77d06..f0703b3b7b 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -87,8 +87,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -99,8 +98,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -159,8 +157,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -171,8 +168,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -231,8 +227,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -243,8 +238,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -303,8 +297,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -315,8 +308,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -377,8 +369,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -389,8 +380,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -476,8 +466,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -489,8 +478,7 @@ tests: find: *collection_name readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: find @@ -504,8 +492,7 @@ tests: cursor: { } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -517,8 +504,7 @@ tests: key: _id lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: distinct @@ -528,8 +514,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -592,8 +577,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -604,8 +588,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -616,8 +599,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -631,8 +613,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -697,8 +678,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: insert @@ -708,8 +688,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: abortTransaction @@ -776,8 +755,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -788,8 +766,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -801,8 +778,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -877,8 +853,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -889,8 +864,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -902,8 +876,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -971,8 +944,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -983,8 +955,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1050,8 +1021,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1062,8 +1032,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1132,8 +1101,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1148,8 +1116,7 @@ tests: cursor: { } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } autocommit: false maxTimeMS: 60000 commandName: aggregate @@ -1159,8 +1126,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -1227,8 +1193,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1239,8 +1204,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1253,8 +1217,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -1328,8 +1291,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1340,8 +1302,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1354,8 +1315,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index d07ec2d810..ec7c6cdcfd 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -83,8 +83,7 @@ tests: query: { _id: 3 } remove: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -98,8 +97,7 @@ tests: query: { _id: 4 } remove: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -111,8 +109,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -168,8 +165,7 @@ tests: query: { _id: 3 } remove: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -181,8 +177,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index c1375fd123..7c215e95e7 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -94,8 +94,7 @@ tests: update: { x: 1 } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -111,8 +110,7 @@ tests: new: true upsert: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -124,8 +122,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -187,8 +184,7 @@ tests: update: { x: 1 } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -200,8 +196,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 28e1e59dac..392b114389 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -136,8 +136,7 @@ tests: update: { $inc: { x: 1 } } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -153,8 +152,7 @@ tests: new: true upsert: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -166,8 +164,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -182,8 +179,7 @@ tests: update: { $inc: { x: 1 } } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -196,8 +192,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -212,8 +207,7 @@ tests: update: { $inc: { x: 1 } } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: true autocommit: false readConcern: @@ -226,8 +220,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -290,8 +283,7 @@ tests: update: { $inc: { x: 1 } } new: false lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -303,8 +295,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/insert.yml b/source/transactions/tests/unified/insert.yml index 2767d9152a..1e97069715 100644 --- a/source/transactions/tests/unified/insert.yml +++ b/source/transactions/tests/unified/insert.yml @@ -112,8 +112,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -128,8 +127,7 @@ tests: - { _id: 3 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -143,8 +141,7 @@ tests: - { _id: 4 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } autocommit: false writeConcern: { $$exists: false } commandName: insert @@ -154,8 +151,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -171,8 +167,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -183,8 +178,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -260,8 +254,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -276,8 +269,7 @@ tests: - { _id: 3 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -288,8 +280,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -305,8 +296,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -317,8 +307,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -453,8 +442,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -469,8 +457,7 @@ tests: - { _id: 3 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -481,8 +468,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index b6726b71d9..6dcfccee43 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -99,8 +99,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -111,8 +110,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -125,8 +123,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 541c3a495e..22aec2ae8b 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -80,8 +80,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -92,8 +91,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -105,8 +103,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -121,8 +118,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -229,8 +225,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -241,8 +236,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -254,8 +248,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -319,8 +312,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -331,8 +323,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -344,8 +335,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 47689ae68c..ddffcfebdd 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -454,8 +454,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -470,8 +469,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -482,8 +480,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -610,8 +607,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -626,8 +622,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -638,8 +633,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index 8a03ba4cc0..6d572544bd 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -90,8 +90,7 @@ tests: lsid: { $$sessionLsid: *session0 } readConcern: level: majority - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: aggregate @@ -106,8 +105,7 @@ tests: cursor: { } lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -118,8 +116,7 @@ tests: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -156,8 +153,7 @@ tests: lsid: { $$sessionLsid: *session0 } readConcern: level: majority - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: find @@ -171,8 +167,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -184,8 +179,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: find @@ -199,8 +193,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -241,8 +234,7 @@ tests: lsid: { $$sessionLsid: *session0 } readConcern: level: majority - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: aggregate @@ -256,8 +248,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -272,8 +263,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -287,8 +277,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -321,8 +310,7 @@ tests: lsid: { $$sessionLsid: *session0 } readConcern: level: majority - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -335,8 +323,7 @@ tests: key: _id lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -369,8 +356,7 @@ tests: lsid: { $$sessionLsid: *session0 } readConcern: level: majority - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -382,8 +368,7 @@ tests: find: *collection_name lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -414,8 +399,7 @@ tests: cursor: { } lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: aggregate @@ -430,8 +414,7 @@ tests: cursor: { } lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -456,8 +439,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: find @@ -471,8 +453,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -484,8 +465,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: find @@ -499,8 +479,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -528,8 +507,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: aggregate @@ -543,8 +521,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -559,8 +536,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -574,8 +550,7 @@ tests: batchSize: 3 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -600,8 +575,7 @@ tests: key: _id lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -614,8 +588,7 @@ tests: key: _id lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -647,8 +620,7 @@ tests: find: *collection_name lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -660,8 +632,7 @@ tests: find: *collection_name lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 3d94b47d6c..0dd3b0064d 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -117,8 +117,7 @@ tests: batchSize: 3 readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: find @@ -131,8 +130,7 @@ tests: collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -143,8 +141,7 @@ tests: find: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: find @@ -157,8 +154,7 @@ tests: collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -168,8 +164,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -205,8 +200,7 @@ tests: batchSize: 3 readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false commandName: aggregate @@ -219,8 +213,7 @@ tests: collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -234,8 +227,7 @@ tests: cursor: batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: aggregate @@ -248,8 +240,7 @@ tests: collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false commandName: getMore @@ -259,8 +250,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -291,8 +281,7 @@ tests: key: _id lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -304,8 +293,7 @@ tests: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } readConcern: { $$exists: false } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 8efd6683cb..1c4cd4e88d 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -89,8 +89,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -101,8 +100,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -114,8 +112,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -171,8 +168,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -183,8 +179,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -242,8 +237,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -254,8 +248,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -266,8 +259,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -324,8 +316,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -336,8 +327,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -348,8 +338,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -406,8 +395,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -418,8 +406,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -430,8 +417,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -488,8 +474,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -500,8 +485,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -512,8 +496,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -570,8 +553,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -582,8 +564,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -594,8 +575,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -652,8 +632,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -664,8 +643,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -676,8 +654,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -734,8 +711,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -746,8 +722,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -758,8 +733,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -816,8 +790,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -828,8 +801,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -840,8 +812,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -898,8 +869,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -910,8 +880,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -922,8 +891,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -980,8 +948,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -992,8 +959,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -1004,8 +970,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -1062,8 +1027,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1074,8 +1038,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -1086,8 +1049,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -1148,8 +1110,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1160,8 +1121,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1173,8 +1133,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1236,8 +1195,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1248,8 +1206,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1261,8 +1218,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1324,8 +1280,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1336,8 +1291,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1349,8 +1303,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1412,8 +1365,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1424,8 +1376,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1437,8 +1388,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index aa28514a7b..e5ed0f483f 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -108,8 +108,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -120,8 +119,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -132,8 +130,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -188,8 +185,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -200,8 +196,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -260,8 +255,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -272,8 +266,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -328,8 +321,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -340,8 +332,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -352,8 +343,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 8f05687846..710f9d5612 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -97,8 +97,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -109,8 +108,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -121,8 +119,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -183,8 +180,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -195,8 +191,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -207,8 +202,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index b4bbe8cd6b..8764315b91 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -110,8 +110,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -122,8 +121,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -181,8 +179,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -193,8 +190,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -205,8 +201,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -267,8 +262,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -279,8 +273,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -291,8 +284,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -353,8 +345,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -365,8 +356,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -377,8 +367,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -439,8 +428,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -451,8 +439,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -463,8 +450,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -525,8 +511,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -537,8 +522,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -549,8 +533,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -611,8 +594,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -623,8 +605,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -635,8 +616,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -697,8 +677,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -709,8 +688,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -721,8 +699,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -783,8 +760,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -795,8 +771,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -807,8 +782,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -869,8 +843,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -881,8 +854,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -893,8 +865,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -955,8 +926,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -967,8 +937,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -979,8 +948,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -1045,8 +1013,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1057,8 +1024,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1070,8 +1036,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -1136,8 +1101,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1148,8 +1112,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1161,8 +1124,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -1227,8 +1189,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1239,8 +1200,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1252,8 +1212,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -1318,8 +1277,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -1330,8 +1288,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -1343,8 +1300,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 27a267caeb..3998010035 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -127,8 +127,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -139,8 +138,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -151,8 +149,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -166,8 +163,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -240,8 +236,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -252,8 +247,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -267,8 +261,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries @@ -283,8 +276,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -342,8 +334,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -354,8 +345,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -366,8 +356,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false # commitTransaction applies w:majority on retries diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 8aa49f6476..59cd604285 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -92,8 +92,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -104,8 +103,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -169,8 +167,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -181,8 +178,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index 274f5c6b72..d875ed1aaa 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -108,8 +108,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -120,8 +119,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -136,8 +134,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: { $$exists: false } writeConcern: { $$exists: false } @@ -153,8 +150,7 @@ tests: readConcern: afterClusterTime: { $$exists: true } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -165,8 +161,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '3' + txnNumber: { $numberLong: '3' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -182,8 +177,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '4' + txnNumber: { $numberLong: '4' } startTransaction: { $$exists: false } autocommit: { $$exists: false } writeConcern: { $$exists: false } @@ -242,8 +236,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -254,8 +247,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index 1e2c481420..18b4e41841 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -75,8 +75,7 @@ tests: - { _id: 1 } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -87,8 +86,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -148,8 +146,7 @@ tests: - { _id: 1 } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -160,8 +157,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -202,8 +198,7 @@ tests: - { _id: 1 } readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -214,8 +209,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/transaction-options-repl.yml b/source/transactions/tests/unified/transaction-options-repl.yml index b3b7c0859e..f801c13dd8 100644 --- a/source/transactions/tests/unified/transaction-options-repl.yml +++ b/source/transactions/tests/unified/transaction-options-repl.yml @@ -98,8 +98,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -112,8 +111,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -128,8 +126,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -143,8 +140,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/transaction-options.yml b/source/transactions/tests/unified/transaction-options.yml index 384f4b0893..f3ab07cfc4 100644 --- a/source/transactions/tests/unified/transaction-options.yml +++ b/source/transactions/tests/unified/transaction-options.yml @@ -86,8 +86,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -100,8 +99,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -117,8 +115,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -132,8 +129,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -214,8 +210,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -229,8 +224,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -247,8 +241,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -263,8 +256,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -330,8 +322,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -344,8 +335,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -362,8 +352,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -377,8 +366,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -470,8 +458,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -485,8 +472,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -503,8 +489,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -519,8 +504,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -602,8 +586,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -617,8 +600,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -635,8 +617,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -651,8 +632,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -731,8 +711,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: @@ -745,8 +724,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -762,8 +740,7 @@ tests: - { _id: 2 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: true autocommit: false readConcern: @@ -777,8 +754,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '2' + txnNumber: { $numberLong: '2' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -854,8 +830,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false # No writeConcern @@ -867,8 +842,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -936,8 +910,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -949,8 +922,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -1026,8 +998,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -1039,8 +1010,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } @@ -1119,8 +1089,7 @@ tests: - { _id: 1 } ordered: true lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -1132,8 +1101,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session1 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false readConcern: { $$exists: false } diff --git a/source/transactions/tests/unified/update.yml b/source/transactions/tests/unified/update.yml index 126dff879d..4e49350653 100644 --- a/source/transactions/tests/unified/update.yml +++ b/source/transactions/tests/unified/update.yml @@ -106,8 +106,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -125,8 +124,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -144,8 +142,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -156,8 +153,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -247,8 +243,7 @@ tests: ordered: true readConcern: { $$exists: false } lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false writeConcern: { $$exists: false } @@ -266,8 +261,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -285,8 +279,7 @@ tests: upsert: { $$unsetOrMatches: false } ordered: true lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -297,8 +290,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index 23b94d395f..ecb9fac0ea 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -85,8 +85,7 @@ tests: ordered: true <<: &transactionCommandArgs lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: true autocommit: false readConcern: { $$exists: false } @@ -98,8 +97,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -147,8 +145,7 @@ tests: command: commitTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } @@ -200,8 +197,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: @@ -249,8 +245,7 @@ tests: command: abortTransaction: 1 lsid: { $$sessionLsid: *session0 } - txnNumber: - $numberLong: '1' + txnNumber: { $numberLong: '1' } startTransaction: { $$exists: false } autocommit: false writeConcern: { $$exists: false } From a607f7dfe28fea9de878f23024ab470ea6482a68 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:28:17 -0500 Subject: [PATCH 46/55] Consolidate configureFailPoint times option --- .../unified/error-labels-blockConnection.yml | 3 +- .../unified/error-labels-errorLabels.yml | 6 +-- .../tests/unified/error-labels.yml | 42 +++++---------- .../mongos-recovery-token-errorLabels.yml | 3 +- .../tests/unified/mongos-recovery-token.yml | 6 +-- .../transactions/tests/unified/pin-mongos.yml | 9 ++-- .../unified/retryable-abort-errorLabels.yml | 51 +++++++------------ .../tests/unified/retryable-abort.yml | 12 ++--- ...e-commit-errorLabels-forbid_serverless.yml | 6 +-- .../unified/retryable-commit-errorLabels.yml | 45 ++++++---------- .../retryable-commit-forbid_serverless.yml | 9 ++-- .../tests/unified/retryable-commit.yml | 6 +-- .../tests/unified/retryable-writes.yml | 3 +- 13 files changed, 67 insertions(+), 134 deletions(-) diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index efa16ecb86..303f29b0f5 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -68,8 +68,7 @@ tests: failPoint: # Drivers stop retrying after two socket timeouts that occur due to the use of socketTimeoutMS configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index b5f0d5237f..3a8836af1e 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -56,8 +56,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction @@ -160,8 +159,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index f0703b3b7b..80507ec844 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -119,8 +119,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert @@ -189,8 +188,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert @@ -259,8 +257,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert @@ -329,8 +326,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -401,8 +397,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 4 + mode: { times: 4 } data: failCommands: - insert @@ -535,8 +530,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction @@ -637,8 +631,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert @@ -708,8 +701,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -803,8 +795,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -901,8 +892,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -978,8 +968,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -1055,8 +1044,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - aggregate @@ -1147,8 +1135,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -1243,8 +1230,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index 6dcfccee43..2db5756f01 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -69,8 +69,7 @@ tests: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 22aec2ae8b..90a9c81688 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -188,8 +188,7 @@ tests: session: *session1 failPoint: configureFailPoint: failCommand - mode: - times: 7 + mode: { times: 7 } data: failCommands: - commitTransaction @@ -285,8 +284,7 @@ tests: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index ddffcfebdd..a0b8a1b0a7 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -369,8 +369,7 @@ tests: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -419,8 +418,7 @@ tests: session: *session0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert @@ -555,8 +553,7 @@ tests: session: *session1 failPoint: configureFailPoint: failCommand - mode: - times: 7 + mode: { times: 7 } data: failCommands: - insert diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 1c4cd4e88d..59e9544bc2 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -53,8 +53,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - abortTransaction @@ -133,8 +132,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -201,8 +199,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -280,8 +277,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -359,8 +355,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -438,8 +433,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -517,8 +511,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -596,8 +589,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -675,8 +667,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -754,8 +745,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -833,8 +823,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -912,8 +901,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -991,8 +979,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -1070,8 +1057,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -1155,8 +1141,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -1240,8 +1225,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -1325,8 +1309,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction diff --git a/source/transactions/tests/unified/retryable-abort.yml b/source/transactions/tests/unified/retryable-abort.yml index e5ed0f483f..602c92aec0 100644 --- a/source/transactions/tests/unified/retryable-abort.yml +++ b/source/transactions/tests/unified/retryable-abort.yml @@ -75,8 +75,7 @@ tests: client: *client1 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - abortTransaction @@ -151,8 +150,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -217,8 +215,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction @@ -288,8 +285,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - abortTransaction diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 710f9d5612..54326eeecb 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -61,8 +61,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -144,8 +143,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index 8764315b91..b70828f625 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -72,8 +72,7 @@ tests: client: *client1 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -143,8 +142,7 @@ tests: client: *client1 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -226,8 +224,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -309,8 +306,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -392,8 +388,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -475,8 +470,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -558,8 +552,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -641,8 +634,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -724,8 +716,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -807,8 +798,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -890,8 +880,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -973,8 +962,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -1061,8 +1049,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -1149,8 +1136,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -1237,8 +1223,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml index 3998010035..9b45cc71f7 100644 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml @@ -83,8 +83,7 @@ tests: client: *client1 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction @@ -187,8 +186,7 @@ tests: client: *client1 failPoint: configureFailPoint: failCommand - mode: - times: 2 + mode: { times: 2 } data: failCommands: - commitTransaction @@ -301,8 +299,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 59cd604285..2e0605641e 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -52,8 +52,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction @@ -124,8 +123,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - commitTransaction diff --git a/source/transactions/tests/unified/retryable-writes.yml b/source/transactions/tests/unified/retryable-writes.yml index d875ed1aaa..aa9c037d41 100644 --- a/source/transactions/tests/unified/retryable-writes.yml +++ b/source/transactions/tests/unified/retryable-writes.yml @@ -202,8 +202,7 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: failCommands: - insert From 3d8eeed82b6cd8bc061eb23b6ef2e8cc39e0bcf3 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:51:46 -0500 Subject: [PATCH 47/55] Move legacy test format docs to separate file --- .../client-side-encryption/tests/README.rst | 2 +- source/read-write-concern/tests/README.rst | 2 +- source/transactions/tests/README.rst | 563 +---------------- .../transactions/tests/legacy-test-format.rst | 570 ++++++++++++++++++ 4 files changed, 577 insertions(+), 560 deletions(-) create mode 100644 source/transactions/tests/legacy-test-format.rst diff --git a/source/client-side-encryption/tests/README.rst b/source/client-side-encryption/tests/README.rst index cefc26d25e..f16d811047 100644 --- a/source/client-side-encryption/tests/README.rst +++ b/source/client-side-encryption/tests/README.rst @@ -39,7 +39,7 @@ are true: Spec Test Format ================ -The spec tests format is an extension of `transactions spec tests `_ with some additions: +The spec tests format is an extension of the `transactions spec legacy test format `__ with some additions: - A ``json_schema`` to set on the collection used for operations. diff --git a/source/read-write-concern/tests/README.rst b/source/read-write-concern/tests/README.rst index 2f2b84dc9c..1d4beb3fc1 100644 --- a/source/read-write-concern/tests/README.rst +++ b/source/read-write-concern/tests/README.rst @@ -57,7 +57,7 @@ Operation These tests check that the default write concern is omitted in operations. -The spec test format is an extension of `transactions spec tests `_ with the following additions: +The spec test format is an extension of the `transactions spec legacy test format `__ with the following additions: - ``writeConcern`` in the ``databaseOptions`` or ``collectionOptions`` may be an empty document to indicate a `server default write concern `_. For example, in libmongoc: diff --git a/source/transactions/tests/README.rst b/source/transactions/tests/README.rst index b42cac4259..c772509cd3 100644 --- a/source/transactions/tests/README.rst +++ b/source/transactions/tests/README.rst @@ -9,531 +9,13 @@ Transactions Tests Introduction ============ -The YAML and JSON files in the ``legacy`` and ``unified`` sub-directories are -platform-independent tests that drivers can use to prove their conformance to -the Transactions Spec. The tests in the ``legacy`` directory are designed with -the intention of sharing some test-runner code with the CRUD Spec tests and the -Command Monitoring Spec tests. The format for these tests and instructions for -executing them are provided in the following sections. Tests in the -``unified`` directory are written using the `Unified Test Format -<../../unified-test-format/unified-test-format.md>`_. +The YAML and JSON files in this directory are platform-independent tests +meant to exercise a driver's implementation of transactions. These tests utilize +the `Unified Test Format <../../unified-test-format/unified-test-format.md>`__. Several prose tests, which are not easily expressed in YAML, are also presented in this file. Those tests will need to be manually implemented by each driver. -Server Fail Point -================= - -failCommand -``````````` - -Some tests depend on a server fail point, expressed in the ``failPoint`` field. -For example the ``failCommand`` fail point allows the client to force the -server to return an error. Keep in mind that the fail point only triggers for -commands listed in the "failCommands" field. See `SERVER-35004`_ and -`SERVER-35083`_ for more information. - -.. _SERVER-35004: https://jira.mongodb.org/browse/SERVER-35004 -.. _SERVER-35083: https://jira.mongodb.org/browse/SERVER-35083 - -The ``failCommand`` fail point may be configured like so:: - - db.adminCommand({ - configureFailPoint: "failCommand", - mode: , - data: { - failCommands: ["commandName", "commandName2"], - closeConnection: , - errorCode: , - writeConcernError: , - appName: , - blockConnection: , - blockTimeMS: , - } - }); - -``mode`` is a generic fail point option and may be assigned a string or document -value. The string values ``"alwaysOn"`` and ``"off"`` may be used to enable or -disable the fail point, respectively. A document may be used to specify either -``times`` or ``skip``, which are mutually exclusive: - -- ``{ times: }`` may be used to limit the number of times the fail - point may trigger before transitioning to ``"off"``. -- ``{ skip: }`` may be used to defer the first trigger of a fail - point, after which it will transition to ``"alwaysOn"``. - -The ``data`` option is a document that may be used to specify options that -control the fail point's behavior. ``failCommand`` supports the following -``data`` options, which may be combined if desired: - -- ``failCommands``: Required, the list of command names to fail. -- ``closeConnection``: Boolean option, which defaults to ``false``. If - ``true``, the command will not be executed, the connection will be closed, and - the client will see a network error. -- ``errorCode``: Integer option, which is unset by default. If set, the command - will not be executed and the specified command error code will be returned as - a command error. -- ``appName``: A string to filter which MongoClient should be affected by - the failpoint. `New in mongod 4.4.0-rc2 `_. -- ``blockConnection``: Whether the server should block the affected commands. - Default false. -- ``blockTimeMS``: The number of milliseconds the affect commands should be - blocked for. Required when blockConnection is true. - `New in mongod 4.3.4 `_. - -Speeding Up Tests -================= - -See `Speeding Up Tests <../../retryable-reads/tests/README.rst#speeding-up-tests>`_ in the retryable reads spec tests. - -Test Format -=========== - -Each YAML file has the following keys: - -- ``runOn`` (optional): An array of server version and/or topology requirements - for which the tests can be run. If the test environment satisfies one or more - of these requirements, the tests may be executed; otherwise, this file should - be skipped. If this field is omitted, the tests can be assumed to have no - particular requirements and should be executed. Each element will have some or - all of the following fields: - - - ``minServerVersion`` (optional): The minimum server version (inclusive) - required to successfully run the tests. If this field is omitted, it should - be assumed that there is no lower bound on the required server version. - - - ``maxServerVersion`` (optional): The maximum server version (inclusive) - against which the tests can be run successfully. If this field is omitted, - it should be assumed that there is no upper bound on the required server - version. - - - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - "sharded", and "load-balanced". If this field is omitted, the default is all - topologies (i.e. ``["single", "replicaset", "sharded", "load-balanced"]``). - - - ``serverless``: (optional): Whether or not the test should be run on Atlas - Serverless instances. Valid values are "require", "forbid", and "allow". If - "require", the test MUST only be run on Atlas Serverless instances. If - "forbid", the test MUST NOT be run on Atlas Serverless instances. If omitted - or "allow", this option has no effect. - - The test runner MUST be informed whether or not Atlas Serverless is being - used in order to determine if this requirement is met (e.g. through an - environment variable or configuration option). - - Note: the Atlas Serverless proxy imitates mongos, so the test runner is not - capable of determining if Atlas Serverless is in use by issuing commands - such as ``buildInfo`` or ``hello``. Furthermore, connections to Atlas - Serverless use a load balancer, so the topology will appear as - "load-balanced". - -- ``database_name`` and ``collection_name``: The database and collection to use - for testing. - -- ``data``: The data that should exist in the collection under test before each - test run. - -- ``tests``: An array of tests that are to be run independently of each other. - Each test will have some or all of the following fields: - - - ``description``: The name of the test. - - - ``skipReason``: Optional, string describing why this test should be - skipped. - - - ``useMultipleMongoses`` (optional): If ``true``, and the topology type is - ``Sharded``, the MongoClient for this test should be initialized with multiple - mongos seed addresses. If ``false`` or omitted, only a single mongos address - should be specified. - - If ``true``, the topology type is ``LoadBalanced``, and Atlas Serverless is - not being used, the MongoClient for this test should be initialized with the - URI of the load balancer fronting multiple servers. If ``false`` or omitted, - the MongoClient for this test should be initialized with the URI of the load - balancer fronting a single server. - - ``useMultipleMongoses`` only affects ``Sharded`` and ``LoadBalanced`` - topologies (excluding Atlas Serverless). - - - ``clientOptions``: Optional, parameters to pass to MongoClient(). - - - ``failPoint``: Optional, a server failpoint to enable expressed as the - configureFailPoint command to run on the admin database. This option and - ``useMultipleMongoses: true`` are mutually exclusive. - - - ``sessionOptions``: Optional, map of session names (e.g. "session0") to - parameters to pass to MongoClient.startSession() when creating that session. - - - ``operations``: Array of documents, each describing an operation to be - executed. Each document has the following fields: - - - ``name``: The name of the operation on ``object``. - - - ``object``: The name of the object to perform the operation on. Can be - "database", "collection", "session0", "session1", or "testRunner". See - the "targetedFailPoint" operation in `Special Test Operations`_. - - - ``collectionOptions``: Optional, parameters to pass to the Collection() - used for this operation. - - - ``databaseOptions``: Optional, parameters to pass to the Database() - used for this operation. - - - ``command_name``: Present only when ``name`` is "runCommand". The name - of the command to run. Required for languages that are unable preserve - the order keys in the "command" argument when parsing JSON/YAML. - - - ``arguments``: Optional, the names and values of arguments. - - - ``error``: Optional. If true, the test should expect an error or - exception. This could be a server-generated or a driver-generated error. - - - ``result``: The return value from the operation, if any. This field may - be a single document or an array of documents in the case of a - multi-document read. If the operation is expected to return an error, the - ``result`` is a single document that has one or more of the following - fields: - - - ``errorContains``: A substring of the expected error message. - - - ``errorCodeName``: The expected "codeName" field in the server - error response. - - - ``errorLabelsContain``: A list of error label strings that the - error is expected to have. - - - ``errorLabelsOmit``: A list of error label strings that the - error is expected not to have. - - - ``expectations``: Optional list of command-started events. - - - ``outcome``: Document describing the return value and/or expected state of - the collection after the operation is executed. Contains the following - fields: - - - ``collection``: - - - ``data``: The data that should exist in the collection after the - operations have run, sorted by "_id". - -Use as Integration Tests -======================== - -Run a MongoDB replica set with a primary, a secondary, and an arbiter, -**server version 4.0.0 or later**. (Including a secondary ensures that -server selection in a transaction works properly. Including an arbiter helps -ensure that no new bugs have been introduced related to arbiters.) - -A driver that implements support for sharded transactions MUST also run these -tests against a MongoDB sharded cluster with multiple mongoses and -**server version 4.2 or later**. Some tests require -initializing the MongoClient with multiple mongos seeds to ensures that mongos -transaction pinning and the recoveryToken works properly. - -Load each YAML (or JSON) file using a Canonical Extended JSON parser. - -Then for each element in ``tests``: - -#. If the ``skipReason`` field is present, skip this test completely. -#. Create a MongoClient and call - ``client.admin.runCommand({killAllSessions: []})`` to clean up any open - transactions from previous test failures. Ignore a command failure with - error code 11601 ("Interrupted") to work around `SERVER-38335`_. - - - Running ``killAllSessions`` cleans up any open transactions from - a previously failed test to prevent the current test from blocking. - It is sufficient to run this command once before starting the test suite - and once after each failed test. - - When testing against a sharded cluster run this command on ALL mongoses. - -#. Create a collection object from the MongoClient, using the ``database_name`` - and ``collection_name`` fields of the YAML file. -#. Drop the test collection, using writeConcern "majority". -#. Execute the "create" command to recreate the collection, using writeConcern - "majority". (Creating the collection inside a transaction is prohibited, so - create it explicitly.) -#. If the YAML file contains a ``data`` array, insert the documents in ``data`` - into the test collection, using writeConcern "majority". -#. When testing against a sharded cluster run a ``distinct`` command on the - newly created collection on all mongoses. For an explanation see, - `Why do tests that run distinct sometimes fail with StaleDbVersion?`_ -#. If ``failPoint`` is specified, its value is a configureFailPoint command. - Run the command on the admin database to enable the fail point. -#. Create a **new** MongoClient ``client``, with Command Monitoring listeners - enabled. (Using a new MongoClient for each test ensures a fresh session pool - that hasn't executed any transactions previously, so the tests can assert - actual txnNumbers, starting from 1.) Pass this test's ``clientOptions`` if - present. - - - When testing against a sharded cluster and ``useMultipleMongoses`` is - ``true`` the client MUST be created with multiple (valid) mongos seed - addresses. - -#. Call ``client.startSession`` twice to create ClientSession objects - ``session0`` and ``session1``, using the test's "sessionOptions" if they - are present. Save their lsids so they are available after calling - ``endSession``, see `Logical Session Id`_. -#. For each element in ``operations``: - - - If the operation ``name`` is a special test operation type, execute it and - go to the next operation, otherwise proceed to the next step. - - Enter a "try" block or your programming language's closest equivalent. - - Create a Database object from the MongoClient, using the ``database_name`` - field at the top level of the test file. - - Create a Collection object from the Database, using the - ``collection_name`` field at the top level of the test file. - If ``collectionOptions`` or ``databaseOptions`` is present, create the - Collection or Database object with the provided options, respectively. - Otherwise create the object with the default options. - - Execute the named method on the provided ``object``, passing the - arguments listed. Pass ``session0`` or ``session1`` to the method, - depending on which session's name is in the arguments list. - If ``arguments`` contains no "session", pass no explicit session to the - method. - - If the driver throws an exception / returns an error while executing this - series of operations, store the error message and server error code. - - If the operation's ``error`` field is ``true``, verify that the method - threw an exception or returned an error. - - If the result document has an "errorContains" field, verify that the - method threw an exception or returned an error, and that the value of the - "errorContains" field matches the error string. "errorContains" is a - substring (case-insensitive) of the actual error message. - - If the result document has an "errorCodeName" field, verify that the - method threw a command failed exception or returned an error, and that - the value of the "errorCodeName" field matches the "codeName" in the - server error response. - - If the result document has an "errorLabelsContain" field, verify that the - method threw an exception or returned an error. Verify that all of the - error labels in "errorLabelsContain" are present in the error or exception - using the ``hasErrorLabel`` method. - - If the result document has an "errorLabelsOmit" field, verify that the - method threw an exception or returned an error. Verify that none of the - error labels in "errorLabelsOmit" are present in the error or exception - using the ``hasErrorLabel`` method. - - If the operation returns a raw command response, eg from ``runCommand``, - then compare only the fields present in the expected result document. - Otherwise, compare the method's return value to ``result`` using the same - logic as the CRUD Spec Tests runner. - -#. Call ``session0.endSession()`` and ``session1.endSession``. -#. If the test includes a list of command-started events in ``expectations``, - compare them to the actual command-started events using the - same logic as the `legacy Command Monitoring Spec Tests runner `_, plus the rules in - the Command-Started Events instructions below. -#. If ``failPoint`` is specified, disable the fail point to avoid spurious - failures in subsequent tests. The fail point may be disabled like so:: - - db.adminCommand({ - configureFailPoint: , - mode: "off" - }); - -#. For each element in ``outcome``: - - - If ``name`` is "collection", verify that the test collection contains - exactly the documents in the ``data`` array. Ensure this find reads the - latest data by using **primary read preference** with - **local read concern** even when the MongoClient is configured with - another read preference or read concern. - Note the server does not guarantee that documents returned by a find - command will be in inserted order. This find MUST sort by ``{_id:1}``. - -.. _SERVER-38335: https://jira.mongodb.org/browse/SERVER-38335 - -Special Test Operations -``````````````````````` - -Certain operations that appear in the "operations" array do not correspond to -API methods but instead represent special test operations. Such operations are -defined on the "testRunner" object and documented here: - -targetedFailPoint -~~~~~~~~~~~~~~~~~ - -The "targetedFailPoint" operation instructs the test runner to configure a fail -point on a specific mongos. The mongos to run the ``configureFailPoint`` is -determined by the "session" argument (either "session0" or "session1"). -The session must already be pinned to a mongos server. The "failPoint" argument -is the ``configureFailPoint`` command to run. - -If a test uses ``targetedFailPoint``, disable the fail point after running -all ``operations`` to avoid spurious failures in subsequent tests. The fail -point may be disabled like so:: - - db.adminCommand({ - configureFailPoint: , - mode: "off" - }); - -Here is an example which instructs the test runner to enable the failCommand -fail point on the mongos server which "session0" is pinned to:: - - # Enable the fail point only on the Mongos that session0 is pinned to. - - name: targetedFailPoint - object: testRunner - arguments: - session: session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["commitTransaction"] - closeConnection: true - -Tests that use the "targetedFailPoint" operation do not include -``configureFailPoint`` commands in their command expectations. Drivers MUST -ensure that ``configureFailPoint`` commands do not appear in the list of logged -commands, either by manually filtering it from the list of observed commands or -by using a different MongoClient to execute ``configureFailPoint``. - -assertSessionTransactionState -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The "assertSessionTransactionState" operation instructs the test runner to -assert that the transaction state of the given session is equal to the -specified value. The possible values are as follows: ``none``, ``starting``, -``in_progress``, ``committed``, ``aborted``:: - - - name: assertSessionTransactionState - object: testRunner - arguments: - session: session0 - state: in_progress - -assertSessionPinned -~~~~~~~~~~~~~~~~~~~ - -The "assertSessionPinned" operation instructs the test runner to assert that -the given session is pinned to a mongos:: - - - name: assertSessionPinned - object: testRunner - arguments: - session: session0 - -assertSessionUnpinned -~~~~~~~~~~~~~~~~~~~~~ - -The "assertSessionUnpinned" operation instructs the test runner to assert that -the given session is not pinned to a mongos:: - - - name: assertSessionPinned - object: testRunner - arguments: - session: session0 - -assertCollectionExists -~~~~~~~~~~~~~~~~~~~~~~ - -The "assertCollectionExists" operation instructs the test runner to assert that -the given collection exists in the database:: - - - name: assertCollectionExists - object: testRunner - arguments: - database: db - collection: test - -Use a ``listCollections`` command to check whether the collection exists. Note -that it is currently not possible to run ``listCollections`` from within a -transaction. - -assertCollectionNotExists -~~~~~~~~~~~~~~~~~~~~~~~~~ - -The "assertCollectionNotExists" operation instructs the test runner to assert -that the given collection does not exist in the database:: - - - name: assertCollectionNotExists - object: testRunner - arguments: - database: db - collection: test - -Use a ``listCollections`` command to check whether the collection exists. Note -that it is currently not possible to run ``listCollections`` from within a -transaction. - -assertIndexExists -~~~~~~~~~~~~~~~~~ - -The "assertIndexExists" operation instructs the test runner to assert that the -index with the given name exists on the collection:: - - - name: assertIndexExists - object: testRunner - arguments: - database: db - collection: test - index: t_1 - -Use a ``listIndexes`` command to check whether the index exists. Note that it is -currently not possible to run ``listIndexes`` from within a transaction. - -assertIndexNotExists -~~~~~~~~~~~~~~~~~~~~ - -The "assertIndexNotExists" operation instructs the test runner to assert that -the index with the given name does not exist on the collection:: - - - name: assertIndexNotExists - object: testRunner - arguments: - database: db - collection: test - index: t_1 - -Use a ``listIndexes`` command to check whether the index exists. Note that it is -currently not possible to run ``listIndexes`` from within a transaction. - -Command-Started Events -`````````````````````` - -The event listener used for these tests MUST ignore the security commands -listed in the Command Monitoring Spec. - -Logical Session Id -~~~~~~~~~~~~~~~~~~ - -Each command-started event in ``expectations`` includes an ``lsid`` with the -value "session0" or "session1". Tests MUST assert that the command's actual -``lsid`` matches the id of the correct ClientSession named ``session0`` or -``session1``. - -Null Values -~~~~~~~~~~~ - -Some command-started events in ``expectations`` include ``null`` values for top -level ``command`` fields such as ``txnNumber``, ``autocommit``, and -``writeConcern``. Tests MUST assert that the actual command **omits** any field -that has a ``null`` value in the expected command. - -Cursor Id -~~~~~~~~~ - -A ``getMore`` value of ``"42"`` in a command-started event is a fake cursorId -that MUST be ignored. (In the Command Monitoring Spec tests, fake cursorIds are -correlated with real ones, but that is not necessary for Transactions Spec -tests.) - -afterClusterTime -~~~~~~~~~~~~~~~~ - -A ``readConcern.afterClusterTime`` value of ``42`` in a command-started event -is a fake cluster time. Drivers MUST assert that the actual command includes an -afterClusterTime. - -recoveryToken -~~~~~~~~~~~~~ - -A ``recoveryToken`` value of ``42`` in a command-started event is a -placeholder for an arbitrary recovery token. Drivers MUST assert that the -actual command includes a "recoveryToken" field and SHOULD assert that field -is a BSON document. Mongos Pinning Prose Tests ========================== @@ -601,44 +83,9 @@ instead. assert len(addresses) > 1 -Q & A -===== - -Why do tests that run distinct sometimes fail with StaleDbVersion? -`````````````````````````````````````````````````````````````````` - -When a shard receives its first command that contains a dbVersion, the shard -returns a StaleDbVersion error and the Mongos retries the operation. In a -sharded transaction, Mongos does not retry these operations and instead returns -the error to the client. For example:: - - Command distinct failed: Transaction aa09e296-472a-494f-8334-48d57ab530b6:1 was aborted on statement 0 due to: an error from cluster data placement change :: caused by :: got stale databaseVersion response from shard sh01 at host localhost:27217 :: caused by :: don't know dbVersion. - -To workaround this limitation, a driver test runner MUST run a -non-transactional ``distinct`` command on each Mongos before running any test -that uses ``distinct``. To ease the implementation drivers can simply run -``distinct`` before *every* test. - -Note that drivers can remove this workaround once `SERVER-39704`_ is resolved -so that mongos retries this operation transparently. The ``distinct`` command -is the only command allowed in a sharded transaction that uses the -``dbVersion`` concept so it is the only command affected. - -.. _SERVER-39704: https://jira.mongodb.org/browse/SERVER-39704 Changelog ========= -:2023-09-28: Add ``load-balanced`` to test topology requirements. -:2022-04-22: Clarifications to ``serverless`` and ``useMultipleMongoses``. -:2019-05-15: Add operation level ``error`` field to assert any error. -:2019-03-25: Add workaround for StaleDbVersion on distinct. -:2019-03-01: Add top-level ``runOn`` field to denote server version and/or - topology requirements requirements for the test file. Removes the - ``topology`` top-level field, which is now expressed within - ``runOn`` elements. -:2019-02-28: ``useMultipleMongoses: true`` and non-targeted fail points are - mutually exclusive. -:2019-02-13: Modify test format for 4.2 sharded transactions, including - "useMultipleMongoses", ``object: testRunner``, the - ``targetedFailPoint`` operation, and recoveryToken assertions. +:2024-02-07: Converted legacy transaction tests to unified format and moved the + legacy test format docs to a separate file. diff --git a/source/transactions/tests/legacy-test-format.rst b/source/transactions/tests/legacy-test-format.rst new file mode 100644 index 0000000000..5414f6321a --- /dev/null +++ b/source/transactions/tests/legacy-test-format.rst @@ -0,0 +1,570 @@ +================================ +Legacy Transactions Tests Format +================================ + +.. contents:: + +---- + +Introduction +============ + +This test format is no longer used by the transactions spec but may still be +referenced by other specs (e.g. CSFLE) and is preserved for historical record. + +Server Fail Point +================= + +failCommand +``````````` + +Some tests depend on a server fail point, expressed in the ``failPoint`` field. +For example the ``failCommand`` fail point allows the client to force the +server to return an error. Keep in mind that the fail point only triggers for +commands listed in the "failCommands" field. See `SERVER-35004`_ and +`SERVER-35083`_ for more information. + +.. _SERVER-35004: https://jira.mongodb.org/browse/SERVER-35004 +.. _SERVER-35083: https://jira.mongodb.org/browse/SERVER-35083 + +The ``failCommand`` fail point may be configured like so:: + + db.adminCommand({ + configureFailPoint: "failCommand", + mode: , + data: { + failCommands: ["commandName", "commandName2"], + closeConnection: , + errorCode: , + writeConcernError: , + appName: , + blockConnection: , + blockTimeMS: , + } + }); + +``mode`` is a generic fail point option and may be assigned a string or document +value. The string values ``"alwaysOn"`` and ``"off"`` may be used to enable or +disable the fail point, respectively. A document may be used to specify either +``times`` or ``skip``, which are mutually exclusive: + +- ``{ times: }`` may be used to limit the number of times the fail + point may trigger before transitioning to ``"off"``. +- ``{ skip: }`` may be used to defer the first trigger of a fail + point, after which it will transition to ``"alwaysOn"``. + +The ``data`` option is a document that may be used to specify options that +control the fail point's behavior. ``failCommand`` supports the following +``data`` options, which may be combined if desired: + +- ``failCommands``: Required, the list of command names to fail. +- ``closeConnection``: Boolean option, which defaults to ``false``. If + ``true``, the command will not be executed, the connection will be closed, and + the client will see a network error. +- ``errorCode``: Integer option, which is unset by default. If set, the command + will not be executed and the specified command error code will be returned as + a command error. +- ``appName``: A string to filter which MongoClient should be affected by + the failpoint. `New in mongod 4.4.0-rc2 `_. +- ``blockConnection``: Whether the server should block the affected commands. + Default false. +- ``blockTimeMS``: The number of milliseconds the affect commands should be + blocked for. Required when blockConnection is true. + `New in mongod 4.3.4 `_. + +Speeding Up Tests +================= + +See `Speeding Up Tests <../../retryable-reads/tests/README.rst#speeding-up-tests>`_ in the retryable reads spec tests. + +Test Format +=========== + +Each YAML file has the following keys: + +- ``runOn`` (optional): An array of server version and/or topology requirements + for which the tests can be run. If the test environment satisfies one or more + of these requirements, the tests may be executed; otherwise, this file should + be skipped. If this field is omitted, the tests can be assumed to have no + particular requirements and should be executed. Each element will have some or + all of the following fields: + + - ``minServerVersion`` (optional): The minimum server version (inclusive) + required to successfully run the tests. If this field is omitted, it should + be assumed that there is no lower bound on the required server version. + + - ``maxServerVersion`` (optional): The maximum server version (inclusive) + against which the tests can be run successfully. If this field is omitted, + it should be assumed that there is no upper bound on the required server + version. + + - ``topology`` (optional): An array of server topologies against which the + tests can be run successfully. Valid topologies are "single", "replicaset", + "sharded", and "load-balanced". If this field is omitted, the default is all + topologies (i.e. ``["single", "replicaset", "sharded", "load-balanced"]``). + + - ``serverless``: (optional): Whether or not the test should be run on Atlas + Serverless instances. Valid values are "require", "forbid", and "allow". If + "require", the test MUST only be run on Atlas Serverless instances. If + "forbid", the test MUST NOT be run on Atlas Serverless instances. If omitted + or "allow", this option has no effect. + + The test runner MUST be informed whether or not Atlas Serverless is being + used in order to determine if this requirement is met (e.g. through an + environment variable or configuration option). + + Note: the Atlas Serverless proxy imitates mongos, so the test runner is not + capable of determining if Atlas Serverless is in use by issuing commands + such as ``buildInfo`` or ``hello``. Furthermore, connections to Atlas + Serverless use a load balancer, so the topology will appear as + "load-balanced". + +- ``database_name`` and ``collection_name``: The database and collection to use + for testing. + +- ``data``: The data that should exist in the collection under test before each + test run. + +- ``tests``: An array of tests that are to be run independently of each other. + Each test will have some or all of the following fields: + + - ``description``: The name of the test. + + - ``skipReason``: Optional, string describing why this test should be + skipped. + + - ``useMultipleMongoses`` (optional): If ``true``, and the topology type is + ``Sharded``, the MongoClient for this test should be initialized with multiple + mongos seed addresses. If ``false`` or omitted, only a single mongos address + should be specified. + + If ``true``, the topology type is ``LoadBalanced``, and Atlas Serverless is + not being used, the MongoClient for this test should be initialized with the + URI of the load balancer fronting multiple servers. If ``false`` or omitted, + the MongoClient for this test should be initialized with the URI of the load + balancer fronting a single server. + + ``useMultipleMongoses`` only affects ``Sharded`` and ``LoadBalanced`` + topologies (excluding Atlas Serverless). + + - ``clientOptions``: Optional, parameters to pass to MongoClient(). + + - ``failPoint``: Optional, a server failpoint to enable expressed as the + configureFailPoint command to run on the admin database. This option and + ``useMultipleMongoses: true`` are mutually exclusive. + + - ``sessionOptions``: Optional, map of session names (e.g. "session0") to + parameters to pass to MongoClient.startSession() when creating that session. + + - ``operations``: Array of documents, each describing an operation to be + executed. Each document has the following fields: + + - ``name``: The name of the operation on ``object``. + + - ``object``: The name of the object to perform the operation on. Can be + "database", "collection", "session0", "session1", or "testRunner". See + the "targetedFailPoint" operation in `Special Test Operations`_. + + - ``collectionOptions``: Optional, parameters to pass to the Collection() + used for this operation. + + - ``databaseOptions``: Optional, parameters to pass to the Database() + used for this operation. + + - ``command_name``: Present only when ``name`` is "runCommand". The name + of the command to run. Required for languages that are unable preserve + the order keys in the "command" argument when parsing JSON/YAML. + + - ``arguments``: Optional, the names and values of arguments. + + - ``error``: Optional. If true, the test should expect an error or + exception. This could be a server-generated or a driver-generated error. + + - ``result``: The return value from the operation, if any. This field may + be a single document or an array of documents in the case of a + multi-document read. If the operation is expected to return an error, the + ``result`` is a single document that has one or more of the following + fields: + + - ``errorContains``: A substring of the expected error message. + + - ``errorCodeName``: The expected "codeName" field in the server + error response. + + - ``errorLabelsContain``: A list of error label strings that the + error is expected to have. + + - ``errorLabelsOmit``: A list of error label strings that the + error is expected not to have. + + - ``expectations``: Optional list of command-started events. + + - ``outcome``: Document describing the return value and/or expected state of + the collection after the operation is executed. Contains the following + fields: + + - ``collection``: + + - ``data``: The data that should exist in the collection after the + operations have run, sorted by "_id". + +Use as Integration Tests +======================== + +Run a MongoDB replica set with a primary, a secondary, and an arbiter, +**server version 4.0.0 or later**. (Including a secondary ensures that +server selection in a transaction works properly. Including an arbiter helps +ensure that no new bugs have been introduced related to arbiters.) + +A driver that implements support for sharded transactions MUST also run these +tests against a MongoDB sharded cluster with multiple mongoses and +**server version 4.2 or later**. Some tests require +initializing the MongoClient with multiple mongos seeds to ensures that mongos +transaction pinning and the recoveryToken works properly. + +Load each YAML (or JSON) file using a Canonical Extended JSON parser. + +Then for each element in ``tests``: + +#. If the ``skipReason`` field is present, skip this test completely. +#. Create a MongoClient and call + ``client.admin.runCommand({killAllSessions: []})`` to clean up any open + transactions from previous test failures. Ignore a command failure with + error code 11601 ("Interrupted") to work around `SERVER-38335`_. + + - Running ``killAllSessions`` cleans up any open transactions from + a previously failed test to prevent the current test from blocking. + It is sufficient to run this command once before starting the test suite + and once after each failed test. + - When testing against a sharded cluster run this command on ALL mongoses. + +#. Create a collection object from the MongoClient, using the ``database_name`` + and ``collection_name`` fields of the YAML file. +#. Drop the test collection, using writeConcern "majority". +#. Execute the "create" command to recreate the collection, using writeConcern + "majority". (Creating the collection inside a transaction is prohibited, so + create it explicitly.) +#. If the YAML file contains a ``data`` array, insert the documents in ``data`` + into the test collection, using writeConcern "majority". +#. When testing against a sharded cluster run a ``distinct`` command on the + newly created collection on all mongoses. For an explanation see, + `Why do tests that run distinct sometimes fail with StaleDbVersion?`_ +#. If ``failPoint`` is specified, its value is a configureFailPoint command. + Run the command on the admin database to enable the fail point. +#. Create a **new** MongoClient ``client``, with Command Monitoring listeners + enabled. (Using a new MongoClient for each test ensures a fresh session pool + that hasn't executed any transactions previously, so the tests can assert + actual txnNumbers, starting from 1.) Pass this test's ``clientOptions`` if + present. + + - When testing against a sharded cluster and ``useMultipleMongoses`` is + ``true`` the client MUST be created with multiple (valid) mongos seed + addresses. + +#. Call ``client.startSession`` twice to create ClientSession objects + ``session0`` and ``session1``, using the test's "sessionOptions" if they + are present. Save their lsids so they are available after calling + ``endSession``, see `Logical Session Id`_. +#. For each element in ``operations``: + + - If the operation ``name`` is a special test operation type, execute it and + go to the next operation, otherwise proceed to the next step. + - Enter a "try" block or your programming language's closest equivalent. + - Create a Database object from the MongoClient, using the ``database_name`` + field at the top level of the test file. + - Create a Collection object from the Database, using the + ``collection_name`` field at the top level of the test file. + If ``collectionOptions`` or ``databaseOptions`` is present, create the + Collection or Database object with the provided options, respectively. + Otherwise create the object with the default options. + - Execute the named method on the provided ``object``, passing the + arguments listed. Pass ``session0`` or ``session1`` to the method, + depending on which session's name is in the arguments list. + If ``arguments`` contains no "session", pass no explicit session to the + method. + - If the driver throws an exception / returns an error while executing this + series of operations, store the error message and server error code. + - If the operation's ``error`` field is ``true``, verify that the method + threw an exception or returned an error. + - If the result document has an "errorContains" field, verify that the + method threw an exception or returned an error, and that the value of the + "errorContains" field matches the error string. "errorContains" is a + substring (case-insensitive) of the actual error message. + + If the result document has an "errorCodeName" field, verify that the + method threw a command failed exception or returned an error, and that + the value of the "errorCodeName" field matches the "codeName" in the + server error response. + + If the result document has an "errorLabelsContain" field, verify that the + method threw an exception or returned an error. Verify that all of the + error labels in "errorLabelsContain" are present in the error or exception + using the ``hasErrorLabel`` method. + + If the result document has an "errorLabelsOmit" field, verify that the + method threw an exception or returned an error. Verify that none of the + error labels in "errorLabelsOmit" are present in the error or exception + using the ``hasErrorLabel`` method. + - If the operation returns a raw command response, eg from ``runCommand``, + then compare only the fields present in the expected result document. + Otherwise, compare the method's return value to ``result`` using the same + logic as the CRUD Spec Tests runner. + +#. Call ``session0.endSession()`` and ``session1.endSession``. +#. If the test includes a list of command-started events in ``expectations``, + compare them to the actual command-started events using the + same logic as the `legacy Command Monitoring Spec Tests runner `_, plus the rules in + the Command-Started Events instructions below. +#. If ``failPoint`` is specified, disable the fail point to avoid spurious + failures in subsequent tests. The fail point may be disabled like so:: + + db.adminCommand({ + configureFailPoint: , + mode: "off" + }); + +#. For each element in ``outcome``: + + - If ``name`` is "collection", verify that the test collection contains + exactly the documents in the ``data`` array. Ensure this find reads the + latest data by using **primary read preference** with + **local read concern** even when the MongoClient is configured with + another read preference or read concern. + Note the server does not guarantee that documents returned by a find + command will be in inserted order. This find MUST sort by ``{_id:1}``. + +.. _SERVER-38335: https://jira.mongodb.org/browse/SERVER-38335 + +Special Test Operations +``````````````````````` + +Certain operations that appear in the "operations" array do not correspond to +API methods but instead represent special test operations. Such operations are +defined on the "testRunner" object and documented here: + +targetedFailPoint +~~~~~~~~~~~~~~~~~ + +The "targetedFailPoint" operation instructs the test runner to configure a fail +point on a specific mongos. The mongos to run the ``configureFailPoint`` is +determined by the "session" argument (either "session0" or "session1"). +The session must already be pinned to a mongos server. The "failPoint" argument +is the ``configureFailPoint`` command to run. + +If a test uses ``targetedFailPoint``, disable the fail point after running +all ``operations`` to avoid spurious failures in subsequent tests. The fail +point may be disabled like so:: + + db.adminCommand({ + configureFailPoint: , + mode: "off" + }); + +Here is an example which instructs the test runner to enable the failCommand +fail point on the mongos server which "session0" is pinned to:: + + # Enable the fail point only on the Mongos that session0 is pinned to. + - name: targetedFailPoint + object: testRunner + arguments: + session: session0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: ["commitTransaction"] + closeConnection: true + +Tests that use the "targetedFailPoint" operation do not include +``configureFailPoint`` commands in their command expectations. Drivers MUST +ensure that ``configureFailPoint`` commands do not appear in the list of logged +commands, either by manually filtering it from the list of observed commands or +by using a different MongoClient to execute ``configureFailPoint``. + +assertSessionTransactionState +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The "assertSessionTransactionState" operation instructs the test runner to +assert that the transaction state of the given session is equal to the +specified value. The possible values are as follows: ``none``, ``starting``, +``in_progress``, ``committed``, ``aborted``:: + + - name: assertSessionTransactionState + object: testRunner + arguments: + session: session0 + state: in_progress + +assertSessionPinned +~~~~~~~~~~~~~~~~~~~ + +The "assertSessionPinned" operation instructs the test runner to assert that +the given session is pinned to a mongos:: + + - name: assertSessionPinned + object: testRunner + arguments: + session: session0 + +assertSessionUnpinned +~~~~~~~~~~~~~~~~~~~~~ + +The "assertSessionUnpinned" operation instructs the test runner to assert that +the given session is not pinned to a mongos:: + + - name: assertSessionPinned + object: testRunner + arguments: + session: session0 + +assertCollectionExists +~~~~~~~~~~~~~~~~~~~~~~ + +The "assertCollectionExists" operation instructs the test runner to assert that +the given collection exists in the database:: + + - name: assertCollectionExists + object: testRunner + arguments: + database: db + collection: test + +Use a ``listCollections`` command to check whether the collection exists. Note +that it is currently not possible to run ``listCollections`` from within a +transaction. + +assertCollectionNotExists +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The "assertCollectionNotExists" operation instructs the test runner to assert +that the given collection does not exist in the database:: + + - name: assertCollectionNotExists + object: testRunner + arguments: + database: db + collection: test + +Use a ``listCollections`` command to check whether the collection exists. Note +that it is currently not possible to run ``listCollections`` from within a +transaction. + +assertIndexExists +~~~~~~~~~~~~~~~~~ + +The "assertIndexExists" operation instructs the test runner to assert that the +index with the given name exists on the collection:: + + - name: assertIndexExists + object: testRunner + arguments: + database: db + collection: test + index: t_1 + +Use a ``listIndexes`` command to check whether the index exists. Note that it is +currently not possible to run ``listIndexes`` from within a transaction. + +assertIndexNotExists +~~~~~~~~~~~~~~~~~~~~ + +The "assertIndexNotExists" operation instructs the test runner to assert that +the index with the given name does not exist on the collection:: + + - name: assertIndexNotExists + object: testRunner + arguments: + database: db + collection: test + index: t_1 + +Use a ``listIndexes`` command to check whether the index exists. Note that it is +currently not possible to run ``listIndexes`` from within a transaction. + +Command-Started Events +`````````````````````` + +The event listener used for these tests MUST ignore the security commands +listed in the Command Monitoring Spec. + +Logical Session Id +~~~~~~~~~~~~~~~~~~ + +Each command-started event in ``expectations`` includes an ``lsid`` with the +value "session0" or "session1". Tests MUST assert that the command's actual +``lsid`` matches the id of the correct ClientSession named ``session0`` or +``session1``. + +Null Values +~~~~~~~~~~~ + +Some command-started events in ``expectations`` include ``null`` values for top +level ``command`` fields such as ``txnNumber``, ``autocommit``, and +``writeConcern``. Tests MUST assert that the actual command **omits** any field +that has a ``null`` value in the expected command. + +Cursor Id +~~~~~~~~~ + +A ``getMore`` value of ``"42"`` in a command-started event is a fake cursorId +that MUST be ignored. (In the Command Monitoring Spec tests, fake cursorIds are +correlated with real ones, but that is not necessary for Transactions Spec +tests.) + +afterClusterTime +~~~~~~~~~~~~~~~~ + +A ``readConcern.afterClusterTime`` value of ``42`` in a command-started event +is a fake cluster time. Drivers MUST assert that the actual command includes an +afterClusterTime. + +recoveryToken +~~~~~~~~~~~~~ + +A ``recoveryToken`` value of ``42`` in a command-started event is a +placeholder for an arbitrary recovery token. Drivers MUST assert that the +actual command includes a "recoveryToken" field and SHOULD assert that field +is a BSON document. + +Q & A +===== + +Why do tests that run distinct sometimes fail with StaleDbVersion? +`````````````````````````````````````````````````````````````````` + +When a shard receives its first command that contains a dbVersion, the shard +returns a StaleDbVersion error and the Mongos retries the operation. In a +sharded transaction, Mongos does not retry these operations and instead returns +the error to the client. For example:: + + Command distinct failed: Transaction aa09e296-472a-494f-8334-48d57ab530b6:1 was aborted on statement 0 due to: an error from cluster data placement change :: caused by :: got stale databaseVersion response from shard sh01 at host localhost:27217 :: caused by :: don't know dbVersion. + +To workaround this limitation, a driver test runner MUST run a +non-transactional ``distinct`` command on each Mongos before running any test +that uses ``distinct``. To ease the implementation drivers can simply run +``distinct`` before *every* test. + +Note that drivers can remove this workaround once `SERVER-39704`_ is resolved +so that mongos retries this operation transparently. The ``distinct`` command +is the only command allowed in a sharded transaction that uses the +``dbVersion`` concept so it is the only command affected. + +.. _SERVER-39704: https://jira.mongodb.org/browse/SERVER-39704 + +Changelog +========= + +:2024-02-07: Moved legacy test format docs to this file from README.rst. +:2023-09-28: Add ``load-balanced`` to test topology requirements. +:2022-04-22: Clarifications to ``serverless`` and ``useMultipleMongoses``. +:2019-05-15: Add operation level ``error`` field to assert any error. +:2019-03-25: Add workaround for StaleDbVersion on distinct. +:2019-03-01: Add top-level ``runOn`` field to denote server version and/or + topology requirements requirements for the test file. Removes the + ``topology`` top-level field, which is now expressed within + ``runOn`` elements. +:2019-02-28: ``useMultipleMongoses: true`` and non-targeted fail points are + mutually exclusive. +:2019-02-13: Modify test format for 4.2 sharded transactions, including + "useMultipleMongoses", ``object: testRunner``, the + ``targetedFailPoint`` operation, and recoveryToken assertions. From 6b8795191d1a83fb992eaa0e5013a83600728777 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 13:29:34 -0500 Subject: [PATCH 48/55] Remove unused session1 entities --- source/transactions/tests/unified/abort.yml | 4 ---- source/transactions/tests/unified/bulk.yml | 4 ---- source/transactions/tests/unified/count.yml | 4 ---- source/transactions/tests/unified/create-collection.yml | 4 ---- source/transactions/tests/unified/create-index.yml | 4 ---- source/transactions/tests/unified/delete.yml | 4 ---- .../tests/unified/error-labels-blockConnection.yml | 4 ---- .../transactions/tests/unified/error-labels-errorLabels.yml | 4 ---- source/transactions/tests/unified/error-labels.yml | 4 ---- source/transactions/tests/unified/errors-client.yml | 4 ---- source/transactions/tests/unified/findOneAndDelete.yml | 4 ---- source/transactions/tests/unified/findOneAndReplace.yml | 4 ---- source/transactions/tests/unified/findOneAndUpdate.yml | 4 ---- .../tests/unified/mongos-recovery-token-errorLabels.yml | 4 ---- source/transactions/tests/unified/mongos-recovery-token.yml | 4 ---- .../tests/unified/retryable-abort-errorLabels.yml | 4 ---- .../retryable-commit-errorLabels-forbid_serverless.yml | 4 ---- 17 files changed, 68 deletions(-) diff --git a/source/transactions/tests/unified/abort.yml b/source/transactions/tests/unified/abort.yml index 017275dcbc..194846c92f 100644 --- a/source/transactions/tests/unified/abort.yml +++ b/source/transactions/tests/unified/abort.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/bulk.yml b/source/transactions/tests/unified/bulk.yml index 32cd3d1407..5f686498b4 100644 --- a/source/transactions/tests/unified/bulk.yml +++ b/source/transactions/tests/unified/bulk.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/count.yml b/source/transactions/tests/unified/count.yml index 52b89e9377..c78d5b2ae3 100644 --- a/source/transactions/tests/unified/count.yml +++ b/source/transactions/tests/unified/count.yml @@ -35,10 +35,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/create-collection.yml b/source/transactions/tests/unified/create-collection.yml index 77c37b6bb4..f795716865 100644 --- a/source/transactions/tests/unified/create-collection.yml +++ b/source/transactions/tests/unified/create-collection.yml @@ -31,10 +31,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/create-index.yml b/source/transactions/tests/unified/create-index.yml index 4c1b45826b..4465d0922e 100644 --- a/source/transactions/tests/unified/create-index.yml +++ b/source/transactions/tests/unified/create-index.yml @@ -31,10 +31,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/delete.yml b/source/transactions/tests/unified/delete.yml index d7536d9f8f..49bbf16137 100644 --- a/source/transactions/tests/unified/delete.yml +++ b/source/transactions/tests/unified/delete.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/error-labels-blockConnection.yml b/source/transactions/tests/unified/error-labels-blockConnection.yml index 303f29b0f5..7fed7fc92b 100644 --- a/source/transactions/tests/unified/error-labels-blockConnection.yml +++ b/source/transactions/tests/unified/error-labels-blockConnection.yml @@ -39,10 +39,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/error-labels-errorLabels.yml b/source/transactions/tests/unified/error-labels-errorLabels.yml index 3a8836af1e..4af816549d 100644 --- a/source/transactions/tests/unified/error-labels-errorLabels.yml +++ b/source/transactions/tests/unified/error-labels-errorLabels.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/error-labels.yml b/source/transactions/tests/unified/error-labels.yml index 80507ec844..6eb8d7d75e 100644 --- a/source/transactions/tests/unified/error-labels.yml +++ b/source/transactions/tests/unified/error-labels.yml @@ -37,10 +37,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/errors-client.yml b/source/transactions/tests/unified/errors-client.yml index 7f51bf3871..d3f451b98c 100644 --- a/source/transactions/tests/unified/errors-client.yml +++ b/source/transactions/tests/unified/errors-client.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/findOneAndDelete.yml b/source/transactions/tests/unified/findOneAndDelete.yml index ec7c6cdcfd..446318970f 100644 --- a/source/transactions/tests/unified/findOneAndDelete.yml +++ b/source/transactions/tests/unified/findOneAndDelete.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 7c215e95e7..2b4a9920d6 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 392b114389..1865cabb0d 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -34,10 +34,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index 2db5756f01..b711106da6 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -32,10 +32,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 90a9c81688..916e5ecf84 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -32,10 +32,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.yml b/source/transactions/tests/unified/retryable-abort-errorLabels.yml index 59e9544bc2..8a4ddf994a 100644 --- a/source/transactions/tests/unified/retryable-abort-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.yml @@ -31,10 +31,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml index 54326eeecb..c6daafcff8 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml @@ -39,10 +39,6 @@ createEntities: session: id: &session0 session0 client: *client0 - - - session: - id: &session1 session1 - client: *client0 initialData: - From 4974021684a9ac801e761a37c4ac0e7d98158fba Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 13:37:12 -0500 Subject: [PATCH 49/55] Consolidate forbid_serverless using test-level runOnRequirements These files were originally split off in DRIVERS-2713 since the legacy format only allowed top-level requirements. --- ...e-commit-errorLabels-forbid_serverless.yml | 213 ---------- .../unified/retryable-commit-errorLabels.yml | 174 +++++++- .../retryable-commit-forbid_serverless.yml | 370 ------------------ .../tests/unified/retryable-commit.yml | 332 +++++++++++++++- 4 files changed, 504 insertions(+), 585 deletions(-) delete mode 100644 source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml delete mode 100644 source/transactions/tests/unified/retryable-commit-forbid_serverless.yml diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml deleted file mode 100644 index c6daafcff8..0000000000 --- a/source/transactions/tests/unified/retryable-commit-errorLabels-forbid_serverless.yml +++ /dev/null @@ -1,213 +0,0 @@ -description: retryable-commit-errorLabels-forbid_serverless - -schemaVersion: '1.4' - -runOnRequirements: - - - minServerVersion: 4.3.1 # failCommand errorLabels option - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: forbid - topologies: - - replicaset - - sharded - - load-balanced - -createEntities: - - - client: - id: &client0 client0 - useMultipleMongoses: false - observeEvents: - - commandStartedEvent - - - database: - id: &database0 database0 - client: *client0 - databaseName: &database_name transaction-tests - - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection_name test - - - session: - id: &session0 session0 - client: *client0 - -initialData: - - - collectionName: *collection_name - databaseName: *database_name - documents: [] - -tests: - - - description: 'commitTransaction succeeds after InterruptedAtShutdown' - operations: - - - object: testRunner - name: failPoint - arguments: - client: *client0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: - - commitTransaction - errorCode: 11600 - errorLabels: - - RetryableWriteError - closeConnection: false - - - object: *session0 - name: startTransaction - - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 1 } - expectResult: - $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - - - object: *session0 - name: commitTransaction - expectEvents: - - - client: *client0 - events: - - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 1 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: - w: majority - wtimeout: 10000 - commandName: commitTransaction - databaseName: admin - outcome: - - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } - - - description: 'commitTransaction succeeds after ShutdownInProgress' - operations: - - - object: testRunner - name: failPoint - arguments: - client: *client0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: - - commitTransaction - errorCode: 91 - errorLabels: - - RetryableWriteError - closeConnection: false - - - object: *session0 - name: startTransaction - - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 1 } - expectResult: - $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - - - object: *session0 - name: commitTransaction - expectEvents: - - - client: *client0 - events: - - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 1 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: - w: majority - wtimeout: 10000 - commandName: commitTransaction - databaseName: admin - outcome: - - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.yml b/source/transactions/tests/unified/retryable-commit-errorLabels.yml index b70828f625..a29f565160 100644 --- a/source/transactions/tests/unified/retryable-commit-errorLabels.yml +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.yml @@ -1,6 +1,6 @@ description: retryable-commit-errorLabels -schemaVersion: '1.3' +schemaVersion: '1.4' runOnRequirements: - @@ -1300,3 +1300,175 @@ tests: databaseName: *database_name documents: - { _id: 1 } + - + description: 'commitTransaction succeeds after InterruptedAtShutdown' + # Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). + runOnRequirements: + - serverless: forbid + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: + - commitTransaction + errorCode: 11600 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 1 } + expectResult: + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 1 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + # commitTransaction applies w:majority on retries + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } + - + description: 'commitTransaction succeeds after ShutdownInProgress' + # Fail points using state change errors (e.g. InterruptedAtShutdown, + # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). + runOnRequirements: + - serverless: forbid + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: + - commitTransaction + errorCode: 91 + errorLabels: + - RetryableWriteError + closeConnection: false + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 1 } + expectResult: + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 1 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + # commitTransaction applies w:majority on retries + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml b/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml deleted file mode 100644 index 9b45cc71f7..0000000000 --- a/source/transactions/tests/unified/retryable-commit-forbid_serverless.yml +++ /dev/null @@ -1,370 +0,0 @@ -description: retryable-commit-forbid_serverless - -schemaVersion: '1.4' - -runOnRequirements: - - - minServerVersion: '4.0' - topologies: - - replicaset - - - minServerVersion: 4.1.8 - # This file contains tests originally found in retryable-commit.yml that - # are incompatible with serverless: - # - # * Failing commitTransaction with closeConnection:true may abort the - # transaction (CLOUDP-202309). - # * Fail points using state change errors (e.g. InterruptedAtShutdown, - # ShutdownInProgress) may remain enabled indefinitely (CLOUDP-84573). - serverless: forbid - topologies: - - sharded - - load-balanced - -createEntities: - - - client: - id: &client0 client0 - useMultipleMongoses: false - observeEvents: - - commandStartedEvent - - - database: - id: &database0 database0 - client: *client0 - databaseName: &database_name transaction-tests - - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection_name test - - - session: - id: &session0 session0 - client: *client0 - # Define a second set of entities for a retryWrites=false client - - - client: - id: &client1 client1 - useMultipleMongoses: false - uriOptions: - retryWrites: false - observeEvents: - - commandStartedEvent - - - database: - id: &database1 database1 - client: *client1 - databaseName: *database_name - - - collection: - id: &collection1 collection1 - database: *database1 - collectionName: *collection_name - - - session: - id: &session1 session1 - client: *client1 - -initialData: - - - collectionName: *collection_name - databaseName: *database_name - documents: [] - -tests: - - - description: 'commitTransaction fails after two errors' - operations: - - - object: testRunner - name: failPoint - arguments: - client: *client1 - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: - - commitTransaction - closeConnection: true - - - object: *session1 - name: startTransaction - - - object: *collection1 - name: insertOne - arguments: - session: *session1 - document: { _id: 1 } - expectResult: - $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - # First call to commit fails after a single retry attempt. - - - object: *session1 - name: commitTransaction - expectError: - errorLabelsContain: - - RetryableWriteError - - UnknownTransactionCommitResult - errorLabelsOmit: - - TransientTransactionError - # Second call to commit succeeds because the failpoint was disabled. - - - object: *session1 - name: commitTransaction - expectEvents: - - - client: *client1 - events: - - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 1 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: - w: majority - wtimeout: 10000 - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: - w: majority - wtimeout: 10000 - commandName: commitTransaction - databaseName: admin - outcome: - - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } - - - description: 'commitTransaction applies majority write concern on retries' - operations: - - - object: testRunner - name: failPoint - arguments: - client: *client1 - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: - - commitTransaction - closeConnection: true - - - object: *session1 - name: startTransaction - arguments: - writeConcern: - w: 2 - journal: true - wtimeoutMS: 5000 - - - object: *collection1 - name: insertOne - arguments: - session: *session1 - document: { _id: 1 } - expectResult: - $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - # First call to commit fails after a single retry attempt. - - - object: *session1 - name: commitTransaction - expectError: - errorLabelsContain: - - RetryableWriteError - - UnknownTransactionCommitResult - errorLabelsOmit: - - TransientTransactionError - # Second call to commit succeeds because the failpoint was disabled. - - - object: *session1 - name: commitTransaction - expectEvents: - - - client: *client1 - events: - - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 1 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: - w: 2 - j: true - wtimeout: 5000 - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: - w: majority - j: true - wtimeout: 5000 - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session1 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: - w: majority - j: true - wtimeout: 5000 - commandName: commitTransaction - databaseName: admin - outcome: - - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } - - - description: 'commitTransaction succeeds after connection error' - operations: - - - object: testRunner - name: failPoint - arguments: - client: *client0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: - - commitTransaction - closeConnection: true - - - object: *session0 - name: startTransaction - - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 1 } - expectResult: - $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } - - - object: *session0 - name: commitTransaction - expectEvents: - - - client: *client0 - events: - - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 1 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: commitTransaction - databaseName: admin - - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - # commitTransaction applies w:majority on retries - writeConcern: - w: majority - wtimeout: 10000 - commandName: commitTransaction - databaseName: admin - outcome: - - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } diff --git a/source/transactions/tests/unified/retryable-commit.yml b/source/transactions/tests/unified/retryable-commit.yml index 2e0605641e..916944065a 100644 --- a/source/transactions/tests/unified/retryable-commit.yml +++ b/source/transactions/tests/unified/retryable-commit.yml @@ -1,6 +1,6 @@ description: retryable-commit -schemaVersion: '1.3' +schemaVersion: '1.4' runOnRequirements: - @@ -34,6 +34,29 @@ createEntities: session: id: &session0 session0 client: *client0 + # Define a second set of entities for a retryWrites=false client + - + client: + id: &client1 client1 + useMultipleMongoses: false + uriOptions: + retryWrites: false + observeEvents: + - commandStartedEvent + - + database: + id: &database1 database1 + client: *client1 + databaseName: *database_name + - + collection: + id: &collection1 collection1 + database: *database1 + collectionName: *collection_name + - + session: + id: &session1 session1 + client: *client1 initialData: - @@ -189,3 +212,310 @@ tests: databaseName: *database_name documents: - { _id: 1 } + - + description: 'commitTransaction fails after two errors' + # Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + runOnRequirements: + - serverless: forbid + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client1 + failPoint: + configureFailPoint: failCommand + mode: { times: 2 } + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session1 + name: startTransaction + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: { _id: 1 } + expectResult: + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } + # First call to commit fails after a single retry attempt. + - + object: *session1 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + # Second call to commit succeeds because the failpoint was disabled. + - + object: *session1 + name: commitTransaction + expectEvents: + - + client: *client1 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 1 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + # commitTransaction applies w:majority on retries + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } + - + description: 'commitTransaction applies majority write concern on retries' + # Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + runOnRequirements: + - serverless: forbid + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client1 + failPoint: + configureFailPoint: failCommand + mode: { times: 2 } + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session1 + name: startTransaction + arguments: + writeConcern: + w: 2 + journal: true + wtimeoutMS: 5000 + - + object: *collection1 + name: insertOne + arguments: + session: *session1 + document: { _id: 1 } + expectResult: + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } + # First call to commit fails after a single retry attempt. + - + object: *session1 + name: commitTransaction + expectError: + errorLabelsContain: + - RetryableWriteError + - UnknownTransactionCommitResult + errorLabelsOmit: + - TransientTransactionError + # Second call to commit succeeds because the failpoint was disabled. + - + object: *session1 + name: commitTransaction + expectEvents: + - + client: *client1 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 1 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: + w: 2 + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + # commitTransaction applies w:majority on retries + writeConcern: + w: majority + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session1 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: + w: majority + j: true + wtimeout: 5000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } + - + description: 'commitTransaction succeeds after connection error' + # Failing commitTransaction with closeConnection:true may abort the + # transaction (CLOUDP-202309). + runOnRequirements: + - serverless: forbid + operations: + - + object: testRunner + name: failPoint + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: + - commitTransaction + closeConnection: true + - + object: *session0 + name: startTransaction + - + object: *collection0 + name: insertOne + arguments: + session: *session0 + document: { _id: 1 } + expectResult: + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } + - + object: *session0 + name: commitTransaction + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + insert: *collection_name + documents: + - { _id: 1 } + ordered: true + readConcern: { $$exists: false } + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: true + autocommit: false + writeConcern: { $$exists: false } + commandName: insert + databaseName: *database_name + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + writeConcern: { $$exists: false } + commandName: commitTransaction + databaseName: admin + - + commandStartedEvent: + command: + commitTransaction: 1 + lsid: { $$sessionLsid: *session0 } + txnNumber: { $numberLong: '1' } + startTransaction: { $$exists: false } + autocommit: false + # commitTransaction applies w:majority on retries + writeConcern: + w: majority + wtimeout: 10000 + commandName: commitTransaction + databaseName: admin + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - { _id: 1 } From 881845b025b15166380c6968edb83e25dc14ab1d Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 14:46:45 -0500 Subject: [PATCH 50/55] Use int|long for all getMore cursor ID type checking --- source/transactions/tests/unified/reads.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index 0dd3b0064d..cf61e7bd17 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -209,7 +209,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -236,7 +236,7 @@ tests: commandStartedEvent: command: getMore: - $$type: long + $$type: [ int, long ] collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } From d6838fa0377ce441b11b6f0adeead953d889e87d Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 14:48:38 -0500 Subject: [PATCH 51/55] Consolidate $$type --- .../tests/unified/read-concern.yml | 24 +++++++------------ source/transactions/tests/unified/reads.yml | 12 ++++------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/source/transactions/tests/unified/read-concern.yml b/source/transactions/tests/unified/read-concern.yml index 6d572544bd..3eff32a0dc 100644 --- a/source/transactions/tests/unified/read-concern.yml +++ b/source/transactions/tests/unified/read-concern.yml @@ -161,8 +161,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -187,8 +186,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -242,8 +240,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -271,8 +268,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -447,8 +443,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -473,8 +468,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -515,8 +509,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -544,8 +537,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } diff --git a/source/transactions/tests/unified/reads.yml b/source/transactions/tests/unified/reads.yml index cf61e7bd17..66d7e2f79d 100644 --- a/source/transactions/tests/unified/reads.yml +++ b/source/transactions/tests/unified/reads.yml @@ -125,8 +125,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -149,8 +148,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -208,8 +206,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } @@ -235,8 +232,7 @@ tests: - commandStartedEvent: command: - getMore: - $$type: [ int, long ] + getMore: { $$type: [ int, long ] } collection: *collection_name batchSize: 3 lsid: { $$sessionLsid: *session0 } From 492be89a1a41f9ae7cad4c2387daacbc0e848b4c Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 12 Feb 2024 10:10:43 -0500 Subject: [PATCH 52/55] Use lowercase read preference mode strings --- source/transactions/tests/unified/read-pref.yml | 10 +++++----- source/transactions/tests/unified/run-command.yml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/transactions/tests/unified/read-pref.yml b/source/transactions/tests/unified/read-pref.yml index 5afe5fd97e..5217fea471 100644 --- a/source/transactions/tests/unified/read-pref.yml +++ b/source/transactions/tests/unified/read-pref.yml @@ -120,7 +120,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Primary + mode: primary - object: *collection0 name: insertMany @@ -182,7 +182,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Secondary + mode: secondary - object: *collection0 name: insertMany @@ -246,7 +246,7 @@ tests: name: startTransaction arguments: readPreference: - mode: PrimaryPreferred + mode: primaryPreferred - object: *collection0 name: insertMany @@ -310,7 +310,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Nearest + mode: nearest - object: *collection0 name: insertMany @@ -374,7 +374,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Secondary + mode: secondary - object: *collection0 name: insertOne diff --git a/source/transactions/tests/unified/run-command.yml b/source/transactions/tests/unified/run-command.yml index 18b4e41841..b9e1033d4c 100644 --- a/source/transactions/tests/unified/run-command.yml +++ b/source/transactions/tests/unified/run-command.yml @@ -118,7 +118,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Primary + mode: primary - object: *database1 name: runCommand @@ -179,7 +179,7 @@ tests: documents: - { _id: 1 } readPreference: - mode: Primary + mode: primary commandName: insert expectResult: 'n': 1 @@ -229,7 +229,7 @@ tests: command: find: *collection_name readPreference: - mode: Secondary + mode: secondary commandName: find expectError: errorContains: 'read preference in a transaction must be primary' @@ -241,7 +241,7 @@ tests: name: startTransaction arguments: readPreference: - mode: Secondary + mode: secondary - object: *database0 name: runCommand From 19d47851ed50f7dd4ed4e18bda25b3d65850289d Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Feb 2024 11:30:00 -0500 Subject: [PATCH 53/55] Generate JSON files --- source/transactions/tests/unified/abort.json | 828 +++ source/transactions/tests/unified/bulk.json | 652 +++ .../tests/unified/causal-consistency.json | 426 ++ source/transactions/tests/unified/commit.json | 1234 ++++ source/transactions/tests/unified/count.json | 177 + .../tests/unified/create-collection.json | 282 + .../tests/unified/create-index.json | 313 + source/transactions/tests/unified/delete.json | 425 ++ .../unified/error-labels-blockConnection.json | 235 + .../unified/error-labels-errorLabels.json | 423 ++ .../tests/unified/error-labels.json | 2264 +++++++ .../tests/unified/errors-client.json | 142 + source/transactions/tests/unified/errors.json | 285 + .../tests/unified/findOneAndDelete.json | 317 + .../tests/unified/findOneAndReplace.json | 352 ++ .../tests/unified/findOneAndUpdate.json | 538 ++ source/transactions/tests/unified/insert.json | 895 +++ .../transactions/tests/unified/isolation.json | 281 + .../tests/unified/mongos-pin-auto.json | 5181 +++++++++++++++++ .../mongos-recovery-token-errorLabels.json | 212 + .../tests/unified/mongos-recovery-token.json | 552 ++ .../tests/unified/pin-mongos.json | 1443 +++++ .../tests/unified/read-concern.json | 1924 ++++++ .../transactions/tests/unified/read-pref.json | 728 +++ source/transactions/tests/unified/reads.json | 706 +++ .../unified/retryable-abort-errorLabels.json | 2436 ++++++++ .../tests/unified/retryable-abort.json | 600 ++ .../unified/retryable-commit-errorLabels.json | 2564 ++++++++ .../tests/unified/retryable-commit.json | 868 +++ .../tests/unified/retryable-writes.json | 468 ++ .../tests/unified/run-command.json | 421 ++ .../unified/transaction-options-repl.json | 267 + .../tests/unified/transaction-options.json | 2081 +++++++ source/transactions/tests/unified/update.json | 565 ++ .../tests/unified/write-concern.json | 1584 +++++ 35 files changed, 32669 insertions(+) create mode 100644 source/transactions/tests/unified/abort.json create mode 100644 source/transactions/tests/unified/bulk.json create mode 100644 source/transactions/tests/unified/causal-consistency.json create mode 100644 source/transactions/tests/unified/commit.json create mode 100644 source/transactions/tests/unified/count.json create mode 100644 source/transactions/tests/unified/create-collection.json create mode 100644 source/transactions/tests/unified/create-index.json create mode 100644 source/transactions/tests/unified/delete.json create mode 100644 source/transactions/tests/unified/error-labels-blockConnection.json create mode 100644 source/transactions/tests/unified/error-labels-errorLabels.json create mode 100644 source/transactions/tests/unified/error-labels.json create mode 100644 source/transactions/tests/unified/errors-client.json create mode 100644 source/transactions/tests/unified/errors.json create mode 100644 source/transactions/tests/unified/findOneAndDelete.json create mode 100644 source/transactions/tests/unified/findOneAndReplace.json create mode 100644 source/transactions/tests/unified/findOneAndUpdate.json create mode 100644 source/transactions/tests/unified/insert.json create mode 100644 source/transactions/tests/unified/isolation.json create mode 100644 source/transactions/tests/unified/mongos-pin-auto.json create mode 100644 source/transactions/tests/unified/mongos-recovery-token-errorLabels.json create mode 100644 source/transactions/tests/unified/mongos-recovery-token.json create mode 100644 source/transactions/tests/unified/pin-mongos.json create mode 100644 source/transactions/tests/unified/read-concern.json create mode 100644 source/transactions/tests/unified/read-pref.json create mode 100644 source/transactions/tests/unified/reads.json create mode 100644 source/transactions/tests/unified/retryable-abort-errorLabels.json create mode 100644 source/transactions/tests/unified/retryable-abort.json create mode 100644 source/transactions/tests/unified/retryable-commit-errorLabels.json create mode 100644 source/transactions/tests/unified/retryable-commit.json create mode 100644 source/transactions/tests/unified/retryable-writes.json create mode 100644 source/transactions/tests/unified/run-command.json create mode 100644 source/transactions/tests/unified/transaction-options-repl.json create mode 100644 source/transactions/tests/unified/transaction-options.json create mode 100644 source/transactions/tests/unified/update.json create mode 100644 source/transactions/tests/unified/write-concern.json diff --git a/source/transactions/tests/unified/abort.json b/source/transactions/tests/unified/abort.json new file mode 100644 index 0000000000..c151a7d0c6 --- /dev/null +++ b/source/transactions/tests/unified/abort.json @@ -0,0 +1,828 @@ +{ + "description": "abort", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "abort", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "implicit abort", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "endSession" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "two aborts", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "session0", + "name": "abortTransaction", + "expectError": { + "errorContains": "cannot call abortTransaction twice" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abort without start", + "operations": [ + { + "object": "session0", + "name": "abortTransaction", + "expectError": { + "errorContains": "no transaction started" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abort directly after no-op commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "abortTransaction", + "expectError": { + "errorContains": "Cannot call abortTransaction after calling commitTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abort directly after commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "abortTransaction", + "expectError": { + "errorContains": "Cannot call abortTransaction after calling commitTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "abort ignores TransactionAborted", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError", + "UnknownTransactionCommitResult" + ], + "errorContains": "E11000" + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorCodeName": "NoSuchTransaction", + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abort does not apply writeConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": 10 + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/bulk.json b/source/transactions/tests/unified/bulk.json new file mode 100644 index 0000000000..ece162518f --- /dev/null +++ b/source/transactions/tests/unified/bulk.json @@ -0,0 +1,652 @@ +{ + "description": "bulk", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "bulk", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "session": "session0", + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 1 + } + } + } + }, + { + "updateOne": { + "filter": { + "_id": 2 + }, + "update": { + "$set": { + "x": 2 + } + }, + "upsert": true + } + }, + { + "insertOne": { + "document": { + "_id": 3 + } + } + }, + { + "insertOne": { + "document": { + "_id": 4 + } + } + }, + { + "insertOne": { + "document": { + "_id": 5 + } + } + }, + { + "insertOne": { + "document": { + "_id": 6 + } + } + }, + { + "insertOne": { + "document": { + "_id": 7 + } + } + }, + { + "replaceOne": { + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + } + } + }, + { + "replaceOne": { + "filter": { + "_id": 2 + }, + "replacement": { + "y": 2 + } + } + }, + { + "deleteOne": { + "filter": { + "_id": 3 + } + } + }, + { + "deleteOne": { + "filter": { + "_id": 4 + } + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$gte": 2 + } + }, + "update": { + "$set": { + "z": 1 + } + } + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 6 + } + } + } + } + ] + }, + "expectResult": { + "deletedCount": 4, + "insertedCount": 6, + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7 + } + }, + "matchedCount": 7, + "modifiedCount": 7, + "upsertedCount": 1, + "upsertedIds": { + "2": 2 + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$set": { + "x": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 2 + }, + "u": { + "$set": { + "x": 2 + } + }, + "upsert": true, + "multi": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + }, + { + "_id": 6 + }, + { + "_id": 7 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "y": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 2 + }, + "u": { + "y": 2 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 3 + }, + "limit": 1 + }, + { + "q": { + "_id": 4 + }, + "limit": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": { + "$gte": 2 + } + }, + "u": { + "$set": { + "z": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": { + "$gte": 6 + } + }, + "limit": 0 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1, + "y": 1 + }, + { + "_id": 2, + "y": 2, + "z": 1 + }, + { + "_id": 5, + "z": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/causal-consistency.json b/source/transactions/tests/unified/causal-consistency.json new file mode 100644 index 0000000000..52a6cb8180 --- /dev/null +++ b/source/transactions/tests/unified/causal-consistency.json @@ -0,0 +1,426 @@ +{ + "description": "causal-consistency", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "replicaset" + ] + }, + { + "minServerVersion": "4.1.8", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "session": { + "id": "session_no_cc", + "client": "client0", + "sessionOptions": { + "causalConsistency": false + } + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1, + "count": 0 + } + ] + } + ], + "tests": [ + { + "description": "causal consistency", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "count": 1 + } + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "count": 1 + } + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "count": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$$exists": false + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "count": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1, + "count": 2 + } + ] + } + ] + }, + { + "description": "causal consistency disabled", + "operations": [ + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session_no_cc", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session_no_cc", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session_no_cc", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "count": 1 + } + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "session_no_cc", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session_no_cc" + }, + "txnNumber": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "count": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session_no_cc" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session_no_cc" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1, + "count": 1 + }, + { + "_id": 2 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/commit.json b/source/transactions/tests/unified/commit.json new file mode 100644 index 0000000000..ab778d8df2 --- /dev/null +++ b/source/transactions/tests/unified/commit.json @@ -0,0 +1,1234 @@ +{ + "description": "commit", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "rerun commit after empty transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "multiple commits in a row", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "write concern error on commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": 10 + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commit without start", + "operations": [ + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorContains": "no transaction started" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "commit after no-op abort", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorContains": "Cannot call commitTransaction after calling abortTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "commit after abort", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorContains": "Cannot call commitTransaction after calling abortTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "multiple commits after empty transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "reset session state commit", + "operations": [ + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorContains": "no transaction started" + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$$exists": false + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "reset session state abort", + "operations": [ + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction", + "expectError": { + "errorContains": "no transaction started" + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$$exists": false + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 2 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/count.json b/source/transactions/tests/unified/count.json new file mode 100644 index 0000000000..404b06beb6 --- /dev/null +++ b/source/transactions/tests/unified/count.json @@ -0,0 +1,177 @@ +{ + "description": "count", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.0.2", + "topologies": [ + "replicaset" + ] + }, + { + "minServerVersion": "4.1.8", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "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": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ], + "tests": [ + { + "description": "count", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "count", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorCodeName": "OperationNotSupportedInTransaction", + "errorLabelsOmit": [ + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "count": "test", + "query": { + "_id": 1 + }, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "count", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/create-collection.json b/source/transactions/tests/unified/create-collection.json new file mode 100644 index 0000000000..e190088b3b --- /dev/null +++ b/source/transactions/tests/unified/create-collection.json @@ -0,0 +1,282 @@ +{ + "description": "create-collection", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "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": "explicitly create collection using create command", + "operations": [ + { + "object": "database0", + "name": "dropCollection", + "arguments": { + "collection": "test" + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database0", + "name": "createCollection", + "arguments": { + "session": "session0", + "collection": "test" + } + }, + { + "object": "testRunner", + "name": "assertCollectionNotExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertCollectionExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "drop": "test", + "writeConcern": { + "$$exists": false + } + }, + "commandName": "drop", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "create": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "create", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "implicitly create collection using insert", + "operations": [ + { + "object": "database0", + "name": "dropCollection", + "arguments": { + "collection": "test" + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "testRunner", + "name": "assertCollectionNotExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertCollectionExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "drop": "test", + "writeConcern": { + "$$exists": false + } + }, + "commandName": "drop", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/create-index.json b/source/transactions/tests/unified/create-index.json new file mode 100644 index 0000000000..98d6e11547 --- /dev/null +++ b/source/transactions/tests/unified/create-index.json @@ -0,0 +1,313 @@ +{ + "description": "create-index", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "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": "create index on a non-existing collection", + "operations": [ + { + "object": "database0", + "name": "dropCollection", + "arguments": { + "collection": "test" + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "createIndex", + "arguments": { + "session": "session0", + "name": "t_1", + "keys": { + "x": 1 + } + } + }, + { + "object": "testRunner", + "name": "assertIndexNotExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test", + "indexName": "t_1" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertIndexExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test", + "indexName": "t_1" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "drop": "test", + "writeConcern": { + "$$exists": false + } + }, + "commandName": "drop", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "createIndexes": "test", + "indexes": [ + { + "name": "t_1", + "key": { + "x": 1 + } + } + ], + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "createIndexes", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "create index on a collection created within the same transaction", + "operations": [ + { + "object": "database0", + "name": "dropCollection", + "arguments": { + "collection": "test" + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database0", + "name": "createCollection", + "arguments": { + "session": "session0", + "collection": "test" + } + }, + { + "object": "collection0", + "name": "createIndex", + "arguments": { + "session": "session0", + "name": "t_1", + "keys": { + "x": 1 + } + } + }, + { + "object": "testRunner", + "name": "assertIndexNotExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test", + "indexName": "t_1" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertIndexExists", + "arguments": { + "databaseName": "transaction-tests", + "collectionName": "test", + "indexName": "t_1" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "drop": "test", + "writeConcern": { + "$$exists": false + } + }, + "commandName": "drop", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "create": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "create", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "createIndexes": "test", + "indexes": [ + { + "name": "t_1", + "key": { + "x": 1 + } + } + ], + "lsid": { + "$$sessionLsid": "session0" + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "createIndexes", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/delete.json b/source/transactions/tests/unified/delete.json new file mode 100644 index 0000000000..4c1cae0a4e --- /dev/null +++ b/source/transactions/tests/unified/delete.json @@ -0,0 +1,425 @@ +{ + "description": "delete", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + } + ] + } + ], + "tests": [ + { + "description": "delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$lte": 3 + } + } + }, + "expectResult": { + "deletedCount": 2 + } + }, + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": { + "$lte": 3 + } + }, + "limit": 0 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 4 + }, + "limit": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 5 + } + ] + } + ] + }, + { + "description": "collection writeConcern ignored for delete", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection_wc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection_wc_majority", + "name": "deleteOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "collection_wc_majority", + "name": "deleteMany", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$lte": 3 + } + } + }, + "expectResult": { + "deletedCount": 2 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": { + "$lte": 3 + } + }, + "limit": 0 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/error-labels-blockConnection.json b/source/transactions/tests/unified/error-labels-blockConnection.json new file mode 100644 index 0000000000..8da04d1005 --- /dev/null +++ b/source/transactions/tests/unified/error-labels-blockConnection.json @@ -0,0 +1,235 @@ +{ + "description": "error-labels-blockConnection", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "uriOptions": { + "socketTimeoutMS": 100 + }, + "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": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "blockConnection": true, + "blockTimeMS": 150 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/error-labels-errorLabels.json b/source/transactions/tests/unified/error-labels-errorLabels.json new file mode 100644 index 0000000000..1f95ad3419 --- /dev/null +++ b/source/transactions/tests/unified/error-labels-errorLabels.json @@ -0,0 +1,423 @@ +{ + "description": "error-labels-errorLabels", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1", + "serverless": "forbid", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "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": "add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 11602, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/error-labels.json b/source/transactions/tests/unified/error-labels.json new file mode 100644 index 0000000000..be8df10ed3 --- /dev/null +++ b/source/transactions/tests/unified/error-labels.json @@ -0,0 +1,2264 @@ +{ + "description": "error-labels", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "replicaset" + ] + }, + { + "minServerVersion": "4.1.8", + "serverless": "forbid", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "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": "DuplicateKey errors do not contain transient label", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "session": "session0", + "documents": [ + { + "_id": 1 + }, + { + "_id": 1 + } + ] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError", + "UnknownTransactionCommitResult" + ], + "errorContains": "E11000" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + }, + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "NotWritablePrimary errors contain transient label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 10107 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "WriteConflict errors contain transient label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 112 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "NoSuchTransaction errors contain transient label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 251 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "NoSuchTransaction errors on commit contain transient label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 251 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 4 + }, + "data": { + "failCommands": [ + "insert", + "find", + "aggregate", + "distinct" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "session": "session0" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "session": "session0" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": {}, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 64, + "errmsg": "multiple errors reported" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 64, + "codeName": "WriteConcernFailed", + "errmsg": "waiting for replication timed out", + "errInfo": { + "wtimeout": true + } + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 100, + "errmsg": "Not enough data-bearing nodes" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 79, + "errmsg": "No write concern mode named 'blah' found in replica set configuration" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteConcern", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorCode": 50 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "maxTimeMS": 60000, + "session": "session0" + }, + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError", + "UnknownTransactionCommitResult", + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": {}, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "autocommit": false, + "maxTimeMS": 60000 + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "add UnknownTransactionCommitResult label to MaxTimeMSExpired", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 50 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + }, + "maxCommitTimeMS": 60000 + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + }, + "maxTimeMS": 60000 + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "maxTimeMS": 60000 + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 50, + "errmsg": "operation exceeded time limit" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + }, + "maxCommitTimeMS": 60000 + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + }, + "maxTimeMS": 60000 + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "maxTimeMS": 60000 + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/errors-client.json b/source/transactions/tests/unified/errors-client.json new file mode 100644 index 0000000000..00f1497c2d --- /dev/null +++ b/source/transactions/tests/unified/errors-client.json @@ -0,0 +1,142 @@ +{ + "description": "errors-client", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "Client side error in command starting transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "x": 1 + } + }, + "expectError": { + "isError": true + } + }, + { + "object": "testRunner", + "name": "assertSessionTransactionState", + "arguments": { + "session": "session0", + "state": "starting" + } + } + ] + }, + { + "description": "Client side error when transaction is in progress", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "x": 1 + } + }, + "expectError": { + "isError": true + } + }, + { + "object": "testRunner", + "name": "assertSessionTransactionState", + "arguments": { + "session": "session0", + "state": "in_progress" + } + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/errors.json b/source/transactions/tests/unified/errors.json new file mode 100644 index 0000000000..94a9cac207 --- /dev/null +++ b/source/transactions/tests/unified/errors.json @@ -0,0 +1,285 @@ +{ + "description": "errors", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "session": { + "id": "session1", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "start insert start", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "expectError": { + "isClientError": true, + "errorContains": "transaction already in progress" + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ] + }, + { + "description": "start twice", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "startTransaction", + "expectError": { + "isClientError": true, + "errorContains": "transaction already in progress" + } + } + ] + }, + { + "description": "commit and start twice", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session0", + "name": "startTransaction", + "expectError": { + "isClientError": true, + "errorContains": "transaction already in progress" + } + } + ] + }, + { + "description": "write conflict commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorCodeName": "WriteConflict", + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorCodeName": "NoSuchTransaction", + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + } + ] + }, + { + "description": "write conflict abort", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorCodeName": "WriteConflict", + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "abortTransaction" + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/findOneAndDelete.json b/source/transactions/tests/unified/findOneAndDelete.json new file mode 100644 index 0000000000..7db9c872af --- /dev/null +++ b/source/transactions/tests/unified/findOneAndDelete.json @@ -0,0 +1,317 @@ +{ + "description": "findOneAndDelete", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "findOneAndDelete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + } + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "remove": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 4 + }, + "remove": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "collection writeConcern ignored for findOneAndDelete", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection_wc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection_wc_majority", + "name": "findOneAndDelete", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + } + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "remove": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/findOneAndReplace.json b/source/transactions/tests/unified/findOneAndReplace.json new file mode 100644 index 0000000000..d9248244b3 --- /dev/null +++ b/source/transactions/tests/unified/findOneAndReplace.json @@ -0,0 +1,352 @@ +{ + "description": "findOneAndReplace", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "findOneAndReplace", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "replacement": { + "x": 1 + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + }, + "replacement": { + "x": 1 + }, + "upsert": true, + "returnDocument": "After" + }, + "expectResult": { + "_id": 4, + "x": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "x": 1 + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 4 + }, + "update": { + "x": 1 + }, + "new": true, + "upsert": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3, + "x": 1 + }, + { + "_id": 4, + "x": 1 + } + ] + } + ] + }, + { + "description": "collection writeConcern ignored for findOneAndReplace", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection_wc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection_wc_majority", + "name": "findOneAndReplace", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "replacement": { + "x": 1 + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "x": 1 + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/findOneAndUpdate.json b/source/transactions/tests/unified/findOneAndUpdate.json new file mode 100644 index 0000000000..34a40bb570 --- /dev/null +++ b/source/transactions/tests/unified/findOneAndUpdate.json @@ -0,0 +1,538 @@ +{ + "description": "findOneAndUpdate", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "findOneAndUpdate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "upsert": true, + "returnDocument": "After" + }, + "expectResult": { + "_id": 4, + "x": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3, + "x": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3, + "x": 2 + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 4 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": true, + "upsert": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3, + "x": 2 + }, + { + "_id": 4, + "x": 1 + } + ] + } + ] + }, + { + "description": "collection writeConcern ignored for findOneAndUpdate", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection_wc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection_wc_majority", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 3 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 3 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/insert.json b/source/transactions/tests/unified/insert.json new file mode 100644 index 0000000000..9a80d8bf4b --- /dev/null +++ b/source/transactions/tests/unified/insert.json @@ -0,0 +1,895 @@ +{ + "description": "insert", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "session": { + "id": "session1", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 2, + "1": 3 + } + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 4 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 5 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 5 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 5 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + } + ] + } + ] + }, + { + "description": "insert with session1", + "operations": [ + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "session": "session1" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 2, + "1": 3 + } + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 4 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 4 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ] + }, + { + "description": "collection writeConcern without transaction", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection_wc_majority", + "database": "database1", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + }, + { + "session": { + "id": "session2", + "client": "client1" + } + } + ] + } + }, + { + "object": "collection_wc_majority", + "name": "insertOne", + "arguments": { + "session": "session2", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session2" + }, + "txnNumber": { + "$$exists": false + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + }, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "collection writeConcern ignored for insert", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection_wc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection_wc_majority", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection_wc_majority", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 2, + "1": 3 + } + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + }, + { + "_id": 3 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/isolation.json b/source/transactions/tests/unified/isolation.json new file mode 100644 index 0000000000..5d0a0139fb --- /dev/null +++ b/source/transactions/tests/unified/isolation.json @@ -0,0 +1,281 @@ +{ + "description": "isolation", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "session": { + "id": "session1", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "one transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectResult": [ + { + "_id": 1 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectResult": [] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 1 + } + }, + "expectResult": [] + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectResult": [ + { + "_id": 1 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 1 + } + }, + "expectResult": [ + { + "_id": 1 + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "two transactions", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectResult": [ + { + "_id": 1 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectResult": [] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 1 + } + }, + "expectResult": [] + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectResult": [] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 1 + } + }, + "expectResult": [ + { + "_id": 1 + } + ] + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/mongos-pin-auto.json b/source/transactions/tests/unified/mongos-pin-auto.json new file mode 100644 index 0000000000..be685ea838 --- /dev/null +++ b/source/transactions/tests/unified/mongos-pin-auto.json @@ -0,0 +1,5181 @@ +{ + "description": "mongos-pin-auto", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.1.8", + "topologies": [ + "sharded", + "load-balanced" + ], + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "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": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ], + "tests": [ + { + "description": "remain pinned after non-transient Interrupted error on insertOne", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11601 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError", + "UnknownTransactionCommitResult" + ], + "errorCodeName": "Interrupted" + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ] + }, + { + "description": "unpin after transient error within a transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on insertOne insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on insertMany insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "insertMany", + "object": "collection0", + "arguments": { + "session": "session0", + "documents": [ + { + "_id": 4 + }, + { + "_id": 5 + } + ] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on updateOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on replaceOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on updateMany update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + }, + "update": { + "$set": { + "z": 1 + } + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on deleteOne delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "deleteOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on deleteMany delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "deleteMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "findOneAndDelete", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "findOneAndUpdate", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "findOneAndReplace", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on bulkWrite insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on bulkWrite update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 1 + } + } + } + } + ] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on bulkWrite delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on find find", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on countDocuments aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "countDocuments", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": {} + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on aggregate aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "session": "session0", + "pipeline": [] + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on distinct distinct", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "distinct" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "distinct", + "object": "collection0", + "arguments": { + "session": "session0", + "fieldName": "_id", + "filter": {} + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient Interrupted error on runCommand insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11601 + } + } + } + }, + { + "name": "runCommand", + "object": "database0", + "arguments": { + "session": "session0", + "commandName": "insert", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + } + }, + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on insertOne insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on insertOne insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on insertMany insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "insertMany", + "object": "collection0", + "arguments": { + "session": "session0", + "documents": [ + { + "_id": 4 + }, + { + "_id": 5 + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on insertMany insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "insertMany", + "object": "collection0", + "arguments": { + "session": "session0", + "documents": [ + { + "_id": 4 + }, + { + "_id": 5 + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on updateOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "closeConnection": true + } + } + } + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on updateOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on replaceOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "closeConnection": true + } + } + } + }, + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on replaceOne update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on updateMany update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "closeConnection": true + } + } + } + }, + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + }, + "update": { + "$set": { + "z": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on updateMany update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + }, + "update": { + "$set": { + "z": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on deleteOne delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "closeConnection": true + } + } + } + }, + { + "name": "deleteOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on deleteOne delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "deleteOne", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on deleteMany delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "closeConnection": true + } + } + } + }, + { + "name": "deleteMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on deleteMany delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "deleteMany", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 1 + } + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on findOneAndDelete findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "closeConnection": true + } + } + } + }, + { + "name": "findOneAndDelete", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "findOneAndDelete", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on findOneAndUpdate findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "closeConnection": true + } + } + } + }, + { + "name": "findOneAndUpdate", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "findOneAndUpdate", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on findOneAndReplace findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "closeConnection": true + } + } + } + }, + { + "name": "findOneAndReplace", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "findOneAndReplace", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + }, + "replacement": { + "y": 1 + }, + "returnDocument": "Before" + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on bulkWrite insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on bulkWrite insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on bulkWrite update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "closeConnection": true + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 1 + } + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on bulkWrite update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 1 + } + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on bulkWrite delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "closeConnection": true + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on bulkWrite delete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "session": "session0", + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on find find", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "closeConnection": true + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on find find", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on countDocuments aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "closeConnection": true + } + } + } + }, + { + "name": "countDocuments", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": {} + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on countDocuments aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "countDocuments", + "object": "collection0", + "arguments": { + "session": "session0", + "filter": {} + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on aggregate aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "closeConnection": true + } + } + } + }, + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "session": "session0", + "pipeline": [] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on aggregate aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "session": "session0", + "pipeline": [] + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on distinct distinct", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "distinct" + ], + "closeConnection": true + } + } + } + }, + { + "name": "distinct", + "object": "collection0", + "arguments": { + "session": "session0", + "fieldName": "_id", + "filter": {} + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on distinct distinct", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "distinct" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "distinct", + "object": "collection0", + "arguments": { + "session": "session0", + "fieldName": "_id", + "filter": {} + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient connection error on runCommand insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "runCommand", + "object": "database0", + "arguments": { + "session": "session0", + "commandName": "insert", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient ShutdownInProgress error on runCommand insert", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "name": "targetedFailPoint", + "object": "testRunner", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 91 + } + } + } + }, + { + "name": "runCommand", + "object": "database0", + "arguments": { + "session": "session0", + "commandName": "insert", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "testRunner", + "name": "assertSessionUnpinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json new file mode 100644 index 0000000000..fd7a829939 --- /dev/null +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json @@ -0,0 +1,212 @@ +{ + "description": "mongos-recovery-token-errorLabels", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1", + "serverless": "forbid", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "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": "commitTransaction retry succeeds on new mongos", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/mongos-recovery-token.json b/source/transactions/tests/unified/mongos-recovery-token.json new file mode 100644 index 0000000000..ae1c1a91f9 --- /dev/null +++ b/source/transactions/tests/unified/mongos-recovery-token.json @@ -0,0 +1,552 @@ +{ + "description": "mongos-recovery-token", + "schemaVersion": "1.9", + "runOnRequirements": [ + { + "minServerVersion": "4.1.8", + "serverless": "forbid", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "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": "commitTransaction explicit retries include recoveryToken", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction retry fails on new mongos", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": true, + "uriOptions": { + "heartbeatFrequencyMS": 30000 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 7 + }, + "data": { + "failCommands": [ + "commitTransaction", + "isMaster", + "hello" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ], + "errorCodeName": "NoSuchTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction sends recoveryToken", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/pin-mongos.json b/source/transactions/tests/unified/pin-mongos.json new file mode 100644 index 0000000000..fe268cd5f6 --- /dev/null +++ b/source/transactions/tests/unified/pin-mongos.json @@ -0,0 +1,1443 @@ +{ + "description": "pin-mongos", + "schemaVersion": "1.9", + "runOnRequirements": [ + { + "minServerVersion": "4.1.8", + "serverless": "forbid", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "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": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ], + "tests": [ + { + "description": "countDocuments", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "distinct", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2 + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "find", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": { + "_id": 2 + }, + "session": "session0" + }, + "expectResult": [ + { + "_id": 2 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "insertOne", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 4 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 4 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 5 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 5 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 6 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 6 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 7 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 7 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 8 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 8 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 9 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 9 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 10 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 10 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + }, + { + "_id": 6 + }, + { + "_id": 7 + }, + { + "_id": 8 + }, + { + "_id": 9 + }, + { + "_id": 10 + } + ] + } + ] + }, + { + "description": "mixed read write operations", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": 3 + }, + "session": "session0" + }, + "expectResult": 1 + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 4 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 4 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 5 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 5 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 6 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 6 + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 7 + }, + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 7 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + }, + { + "_id": 6 + }, + { + "_id": 7 + } + ] + } + ] + }, + { + "description": "multiple commits", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 3, + "1": 4 + } + } + } + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "remain pinned after non-transient error on commit", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 3, + "1": 4 + } + } + } + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 51 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "TransientTransactionError" + ], + "errorCode": 51 + } + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "testRunner", + "name": "assertSessionPinned", + "arguments": { + "session": "session0" + } + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "unpin after transient error within a transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unpin after transient error within a transaction and commit", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": true, + "uriOptions": { + "heartbeatFrequencyMS": 30000 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "testRunner", + "name": "targetedFailPoint", + "arguments": { + "session": "session1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 7 + }, + "data": { + "failCommands": [ + "insert", + "isMaster", + "hello" + ], + "closeConnection": true + } + } + } + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 4 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ] + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ], + "errorLabelsOmit": [ + "UnknownTransactionCommitResult" + ], + "errorCodeName": "NoSuchTransaction" + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + }, + "recoveryToken": { + "$$exists": true + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/read-concern.json b/source/transactions/tests/unified/read-concern.json new file mode 100644 index 0000000000..b3bd967c09 --- /dev/null +++ b/source/transactions/tests/unified/read-concern.json @@ -0,0 +1,1924 @@ +{ + "description": "read-concern", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "database": { + "id": "database_rc_majority", + "client": "client0", + "databaseName": "transaction-tests", + "databaseOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "collection": { + "id": "collection_rc_majority", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ], + "tests": [ + { + "description": "only first countDocuments includes readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + } + } + }, + { + "object": "collection_rc_majority", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": { + "$gte": 2 + } + }, + "session": "session0" + }, + "expectResult": 3 + }, + { + "object": "collection_rc_majority", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": { + "$gte": 2 + } + }, + "session": "session0" + }, + "expectResult": 3 + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gte": 2 + } + } + }, + { + "$group": { + "_id": 1, + "n": { + "$sum": 1 + } + } + } + ], + "cursor": {}, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "level": "majority" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gte": 2 + } + } + }, + { + "$group": { + "_id": 1, + "n": { + "$sum": 1 + } + } + } + ], + "cursor": {}, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "only first find includes readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + } + } + }, + { + "object": "collection_rc_majority", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rc_majority", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "level": "majority" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "only first aggregate includes readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + } + } + }, + { + "object": "collection_rc_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rc_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "level": "majority" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "only first distinct includes readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + } + } + }, + { + "object": "collection_rc_majority", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2, + 3, + 4 + ] + }, + { + "object": "collection_rc_majority", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2, + 3, + 4 + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "level": "majority" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "only first runCommand includes readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + } + } + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "commandName": "find" + } + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "commandName": "find" + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "level": "majority" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "countDocuments ignores collection readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_rc_majority", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": { + "$gte": 2 + } + }, + "session": "session0" + }, + "expectResult": 3 + }, + { + "object": "collection_rc_majority", + "name": "countDocuments", + "arguments": { + "filter": { + "_id": { + "$gte": 2 + } + }, + "session": "session0" + }, + "expectResult": 3 + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gte": 2 + } + } + }, + { + "$group": { + "_id": 1, + "n": { + "$sum": 1 + } + } + } + ], + "cursor": {}, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gte": 2 + } + } + }, + { + "$group": { + "_id": 1, + "n": { + "$sum": 1 + } + } + } + ], + "cursor": {}, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "find ignores collection readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_rc_majority", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rc_majority", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "aggregate ignores collection readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_rc_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rc_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "distinct ignores collection readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_rc_majority", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2, + 3, + 4 + ] + }, + { + "object": "collection_rc_majority", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2, + 3, + 4 + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "runCommand ignores database readConcern", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database_rc_majority", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "commandName": "find" + } + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "commandName": "find" + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/read-pref.json b/source/transactions/tests/unified/read-pref.json new file mode 100644 index 0000000000..eda00bd10d --- /dev/null +++ b/source/transactions/tests/unified/read-pref.json @@ -0,0 +1,728 @@ +{ + "description": "read-pref", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "collection": { + "id": "collection_rp_primary", + "database": "database0", + "collectionName": "test" + } + }, + { + "collection": { + "id": "collection_rp_secondary", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "default readPreference", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2, + "2": 3, + "3": 4 + } + } + } + } + }, + { + "object": "collection_rp_secondary", + "name": "aggregate", + "arguments": { + "session": "session0", + "pipeline": [ + { + "$match": { + "_id": 1 + } + }, + { + "$count": "count" + } + ] + }, + "expectResult": [ + { + "count": 1 + } + ] + }, + { + "object": "collection_rp_secondary", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rp_secondary", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "primary readPreference", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "primary" + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2, + "2": 3, + "3": 4 + } + } + } + } + }, + { + "object": "collection_rp_secondary", + "name": "aggregate", + "arguments": { + "session": "session0", + "pipeline": [ + { + "$match": { + "_id": 1 + } + }, + { + "$count": "count" + } + ] + }, + "expectResult": [ + { + "count": 1 + } + ] + }, + { + "object": "collection_rp_secondary", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection_rp_secondary", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "secondary readPreference", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "secondary" + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2, + "2": 3, + "3": 4 + } + } + } + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "session": "session0", + "pipeline": [ + { + "$match": { + "_id": 1 + } + }, + { + "$count": "count" + } + ] + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "primaryPreferred readPreference", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "primaryPreferred" + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2, + "2": 3, + "3": 4 + } + } + } + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "session": "session0", + "pipeline": [ + { + "$match": { + "_id": 1 + } + }, + { + "$count": "count" + } + ] + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "nearest readPreference", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "nearest" + } + } + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2, + "2": 3, + "3": 4 + } + } + } + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "session": "session0", + "pipeline": [ + { + "$match": { + "_id": 1 + } + }, + { + "$count": "count" + } + ] + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "collection_rp_primary", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "secondary write only", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "secondary" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/reads.json b/source/transactions/tests/unified/reads.json new file mode 100644 index 0000000000..52e8457634 --- /dev/null +++ b/source/transactions/tests/unified/reads.json @@ -0,0 +1,706 @@ +{ + "description": "reads", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ], + "tests": [ + { + "description": "collection readConcern without transaction", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + } + ] + } + }, + { + "object": "collection1", + "name": "find", + "arguments": { + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "readConcern": { + "level": "majority" + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$$exists": false + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + } + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "find", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection0", + "name": "find", + "arguments": { + "batchSize": 3, + "filter": {}, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "find", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "aggregate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "batchSize": 3, + "session": "session0" + }, + "expectResult": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "test", + "pipeline": [ + { + "$project": { + "_id": 1 + } + } + ], + "cursor": { + "batchSize": 3 + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "aggregate", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "test", + "batchSize": 3, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false + }, + "commandName": "getMore", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + }, + { + "description": "distinct", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "_id", + "filter": {}, + "session": "session0" + }, + "expectResult": [ + 1, + 2, + 3, + 4 + ] + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "distinct": "test", + "key": "_id", + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "distinct", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "readConcern": { + "$$exists": false + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/retryable-abort-errorLabels.json b/source/transactions/tests/unified/retryable-abort-errorLabels.json new file mode 100644 index 0000000000..77a1b03eb0 --- /dev/null +++ b/source/transactions/tests/unified/retryable-abort-errorLabels.json @@ -0,0 +1,2436 @@ +{ + "description": "retryable-abort-errorLabels", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "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": "abortTransaction only retries once with RetryableWriteError from server", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 112, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction does not retry without RetryableWriteError label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 11600, + "errorLabels": [] + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after NotWritablePrimary", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 10107, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after NotPrimaryOrSecondary", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 13436, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after NotPrimaryNoSecondaryOk", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 13435, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after InterruptedDueToReplStateChange", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 11602, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after InterruptedAtShutdown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 11600, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after PrimarySteppedDown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 189, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after ShutdownInProgress", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 91, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after HostNotFound", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 7, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after HostUnreachable", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 6, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after SocketException", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 9001, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after NetworkTimeout", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 89, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after WriteConcernError InterruptedAtShutdown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 11600, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 11602, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after WriteConcernError PrimarySteppedDown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 189, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after WriteConcernError ShutdownInProgress", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/retryable-abort.json b/source/transactions/tests/unified/retryable-abort.json new file mode 100644 index 0000000000..381cfa91f8 --- /dev/null +++ b/source/transactions/tests/unified/retryable-abort.json @@ -0,0 +1,600 @@ +{ + "description": "retryable-abort", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "abortTransaction only performs a single retry", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction does not retry after Interrupted", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 11601, + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction does not retry after WriteConcernError Interrupted", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "writeConcernError": { + "code": 11601, + "errmsg": "operation was interrupted" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "abortTransaction succeeds after connection error", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/retryable-commit-errorLabels.json b/source/transactions/tests/unified/retryable-commit-errorLabels.json new file mode 100644 index 0000000000..d3ce8b148e --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit-errorLabels.json @@ -0,0 +1,2564 @@ +{ + "description": "retryable-commit-errorLabels", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ] + } + ], + "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" + } + }, + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "commitTransaction does not retry error without RetryableWriteError label", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 11600, + "errorLabels": [] + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError" + ] + } + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "commitTransaction retries once with RetryableWriteError from server", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 112, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after NotWritablePrimary", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 10107, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after NotPrimaryOrSecondary", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 13436, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after NotPrimaryNoSecondaryOk", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 13435, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after InterruptedDueToReplStateChange", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 11602, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after PrimarySteppedDown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 189, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after HostNotFound", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 7, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after HostUnreachable", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 6, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after SocketException", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 9001, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after NetworkTimeout", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 89, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after WriteConcernError InterruptedAtShutdown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 11600, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 11602, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after WriteConcernError PrimarySteppedDown", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 189, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after WriteConcernError ShutdownInProgress", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorLabels": [ + "RetryableWriteError" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after InterruptedAtShutdown", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 11600, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after ShutdownInProgress", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 91, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/retryable-commit.json b/source/transactions/tests/unified/retryable-commit.json new file mode 100644 index 0000000000..b794c1c55c --- /dev/null +++ b/source/transactions/tests/unified/retryable-commit.json @@ -0,0 +1,868 @@ +{ + "description": "retryable-commit", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "commitTransaction fails after Interrupted", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 11601, + "closeConnection": false + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorCodeName": "Interrupted", + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "writeConcernError": { + "code": 100, + "errmsg": "Not enough data-bearing nodes" + } + } + } + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction", + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction fails after two errors", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction applies majority write concern on retries", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client1", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": 2, + "journal": true, + "wtimeoutMS": 5000 + } + } + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction", + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError", + "UnknownTransactionCommitResult" + ], + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": 2, + "j": true, + "wtimeout": 5000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "j": true, + "wtimeout": 5000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "j": true, + "wtimeout": 5000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commitTransaction succeeds after connection error", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority", + "wtimeout": 10000 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/retryable-writes.json b/source/transactions/tests/unified/retryable-writes.json new file mode 100644 index 0000000000..c196e68622 --- /dev/null +++ b/source/transactions/tests/unified/retryable-writes.json @@ -0,0 +1,468 @@ +{ + "description": "retryable-writes", + "schemaVersion": "1.3", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "increment txnNumber", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 3 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 3 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + }, + { + "object": "collection0", + "name": "insertMany", + "arguments": { + "documents": [ + { + "_id": 4 + }, + { + "_id": 5 + } + ], + "session": "session0" + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 4, + "1": 5 + } + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 3 + } + ], + "ordered": true, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "3" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 4 + }, + { + "_id": 5 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "4" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 4 + }, + { + "_id": 5 + } + ] + } + ] + }, + { + "description": "writes are not retried", + "operations": [ + { + "object": "testRunner", + "name": "failPoint", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectError": { + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/run-command.json b/source/transactions/tests/unified/run-command.json new file mode 100644 index 0000000000..7bd420ef74 --- /dev/null +++ b/source/transactions/tests/unified/run-command.json @@ -0,0 +1,421 @@ +{ + "description": "run-command", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "run command with default read preference", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + }, + "expectResult": { + "n": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "run command with secondary read preference in client option and primary read preference in transaction options", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readPreference": "secondary" + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "primary" + } + } + }, + { + "object": "database1", + "name": "runCommand", + "arguments": { + "session": "session1", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + }, + "expectResult": { + "n": 1 + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "run command with explicit primary read preference", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ] + }, + "readPreference": { + "mode": "primary" + }, + "commandName": "insert" + }, + "expectResult": { + "n": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + }, + { + "description": "run command fails with explicit secondary read preference", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "readPreference": { + "mode": "secondary" + }, + "commandName": "find" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + } + ] + }, + { + "description": "run command fails with secondary read preference from transaction options", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "secondary" + } + } + }, + { + "object": "database0", + "name": "runCommand", + "arguments": { + "session": "session0", + "command": { + "find": "test" + }, + "commandName": "find" + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/transaction-options-repl.json b/source/transactions/tests/unified/transaction-options-repl.json new file mode 100644 index 0000000000..dc2cb77582 --- /dev/null +++ b/source/transactions/tests/unified/transaction-options-repl.json @@ -0,0 +1,267 @@ +{ + "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 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/transaction-options.json b/source/transactions/tests/unified/transaction-options.json new file mode 100644 index 0000000000..78e4c8207b --- /dev/null +++ b/source/transactions/tests/unified/transaction-options.json @@ -0,0 +1,2081 @@ +{ + "description": "transaction-options", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "no transaction options set", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "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 + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 2 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "2" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "transaction options inherited from client", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readConcernLevel": "local", + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "level": "local" + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": 1 + }, + "maxTimeMS": { + "$$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": "local", + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": 1 + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "transaction options inherited from defaultTransactionOptions", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "session": { + "id": "session1", + "client": "client0", + "sessionOptions": { + "defaultTransactionOptions": { + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "w": 1 + }, + "maxCommitTimeMS": 60000 + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "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": "majority" + }, + "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": { + "w": 1 + }, + "maxTimeMS": 60000 + }, + "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": "majority", + "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": { + "w": 1 + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "startTransaction options override defaults", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readConcernLevel": "local", + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1", + "sessionOptions": { + "defaultTransactionOptions": { + "readConcern": { + "level": "snapshot" + }, + "writeConcern": { + "w": 1 + }, + "maxCommitTimeMS": 30000 + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "w": "majority" + }, + "maxCommitTimeMS": 60000 + } + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": "majority" + }, + "maxTimeMS": 60000 + }, + "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": "majority", + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": "majority" + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "defaultTransactionOptions override client options", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readConcernLevel": "local", + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1", + "sessionOptions": { + "defaultTransactionOptions": { + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "w": "majority" + }, + "maxCommitTimeMS": 60000 + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "level": "majority" + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": "majority" + }, + "maxTimeMS": 60000 + }, + "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": "majority", + "afterClusterTime": { + "$$exists": true + } + }, + "writeConcern": { + "$$exists": false + }, + "maxTimeMS": { + "$$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": { + "w": "majority" + }, + "maxTimeMS": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "readConcern local in defaultTransactionOptions", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "w": 1 + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1", + "sessionOptions": { + "defaultTransactionOptions": { + "readConcern": { + "level": "local" + } + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session1", + "name": "commitTransaction" + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 2 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 2 + } + } + } + }, + { + "object": "session1", + "name": "abortTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "level": "local" + }, + "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": { + "w": 1 + } + }, + "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": "local", + "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": { + "w": 1 + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "client writeConcern ignored for bulk", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "w": "majority" + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": 1 + } + } + }, + { + "object": "collection1", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + } + ], + "session": "session1" + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 1, + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": 1 + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "readPreference inherited from client", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readPreference": "secondary" + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection1", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "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" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "readPreference inherited from defaultTransactionOptions", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readPreference": "primary" + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1", + "sessionOptions": { + "defaultTransactionOptions": { + "readPreference": { + "mode": "secondary" + } + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction" + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection1", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "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" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "startTransaction overrides readPreference", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "readPreference": "primary" + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database1", + "client": "client1", + "databaseName": "transaction-tests" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test" + } + }, + { + "session": { + "id": "session1", + "client": "client1", + "sessionOptions": { + "defaultTransactionOptions": { + "readPreference": { + "mode": "primary" + } + } + } + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction", + "arguments": { + "readPreference": { + "mode": "secondary" + } + } + }, + { + "object": "collection1", + "name": "insertOne", + "arguments": { + "session": "session1", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "collection1", + "name": "find", + "arguments": { + "session": "session1", + "filter": { + "_id": 1 + } + }, + "expectError": { + "errorContains": "read preference in a transaction must be primary" + } + }, + { + "object": "session1", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client1", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session1" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "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" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/update.json b/source/transactions/tests/unified/update.json new file mode 100644 index 0000000000..8090fc9087 --- /dev/null +++ b/source/transactions/tests/unified/update.json @@ -0,0 +1,565 @@ +{ + "description": "update", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "update", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "upsert": true + }, + "expectResult": { + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 1, + "upsertedId": 4 + } + }, + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "session": "session0", + "filter": { + "x": 1 + }, + "replacement": { + "y": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 3 + } + }, + "update": { + "$set": { + "z": 1 + } + } + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 4 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "upsert": true, + "multi": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "x": 1 + }, + "u": { + "y": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": { + "$gte": 3 + } + }, + "u": { + "$set": { + "z": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3, + "z": 1 + }, + { + "_id": 4, + "y": 1, + "z": 1 + } + ] + } + ] + }, + { + "description": "collections writeConcern ignored for update", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": "majority" + } + } + } + } + ] + } + }, + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection1", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 4 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "upsert": true + }, + "expectResult": { + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 1, + "upsertedId": 4 + } + }, + { + "object": "collection1", + "name": "replaceOne", + "arguments": { + "session": "session0", + "filter": { + "x": 1 + }, + "replacement": { + "y": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "collection1", + "name": "updateMany", + "arguments": { + "session": "session0", + "filter": { + "_id": { + "$gte": 3 + } + }, + "update": { + "$set": { + "z": 1 + } + } + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 4 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "upsert": true, + "multi": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "readConcern": { + "$$exists": false + }, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "x": 1 + }, + "u": { + "y": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": { + "$gte": 3 + } + }, + "u": { + "$set": { + "z": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ] + } + ] +} diff --git a/source/transactions/tests/unified/write-concern.json b/source/transactions/tests/unified/write-concern.json new file mode 100644 index 0000000000..7acdd54066 --- /dev/null +++ b/source/transactions/tests/unified/write-concern.json @@ -0,0 +1,1584 @@ +{ + "description": "write-concern", + "schemaVersion": "1.9", + "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": "transaction-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + }, + { + "collection": { + "id": "collection_w0", + "database": "database0", + "collectionName": "test", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + } + ] + } + ], + "tests": [ + { + "description": "commit with majority", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + }, + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "commit with default", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + }, + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "abort with majority", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": "majority" + } + } + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "w": "majority" + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + } + ] + } + ] + }, + { + "description": "abort with default", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "abortTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "abortTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + } + ] + } + ] + }, + { + "description": "start with unacknowledged write concern", + "operations": [ + { + "object": "session0", + "name": "startTransaction", + "arguments": { + "writeConcern": { + "w": 0 + } + }, + "expectError": { + "isClientError": true, + "errorContains": "transactions do not support unacknowledged write concern" + } + } + ] + }, + { + "description": "start with implicit unacknowledged write concern", + "operations": [ + { + "object": "testRunner", + "name": "createEntities", + "arguments": { + "entities": [ + { + "client": { + "id": "client1", + "useMultipleMongoses": false, + "uriOptions": { + "w": 0 + } + } + }, + { + "session": { + "id": "session1", + "client": "client1" + } + } + ] + } + }, + { + "object": "session1", + "name": "startTransaction", + "expectError": { + "isClientError": true, + "errorContains": "transactions do not support unacknowledged write concern" + } + } + ] + }, + { + "description": "unacknowledged write concern coll insertOne", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + }, + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll insertMany", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "insertMany", + "arguments": { + "session": "session0", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + }, + "expectResult": { + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1, + "1": 2 + } + } + } + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "insert", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + }, + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll bulkWrite", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "bulkWrite", + "arguments": { + "session": "session0", + "requests": [ + { + "insertOne": { + "document": { + "_id": 1 + } + } + } + ] + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 1, + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "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": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0 + }, + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll deleteOne", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "deleteOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 0 + }, + "limit": 1 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "unacknowledged write concern coll deleteMany", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "deleteMany", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + } + }, + "expectResult": { + "deletedCount": 1 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "test", + "deletes": [ + { + "q": { + "_id": 0 + }, + "limit": 0 + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "delete", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "unacknowledged write concern coll updateOne", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "updateOne", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "upsert": true + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 0 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "upsert": true, + "multi": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0, + "x": 1 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll updateMany", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "updateMany", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "upsert": true + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 0 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "upsert": true + } + ], + "ordered": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "update", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0, + "x": 1 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll findOneAndDelete", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "findOneAndDelete", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + } + }, + "expectResult": { + "_id": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 0 + }, + "remove": true, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] + }, + { + "description": "unacknowledged write concern coll findOneAndReplace", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "findOneAndReplace", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + }, + "replacement": { + "x": 1 + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 0 + }, + "update": { + "x": 1 + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0, + "x": 1 + } + ] + } + ] + }, + { + "description": "unacknowledged write concern coll findOneAndUpdate", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection_w0", + "name": "findOneAndUpdate", + "arguments": { + "session": "session0", + "filter": { + "_id": 0 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "returnDocument": "Before" + }, + "expectResult": { + "_id": 0 + } + }, + { + "object": "session0", + "name": "commitTransaction" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "query": { + "_id": 0 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "new": false, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false, + "readConcern": { + "$$exists": false + }, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "findAndModify", + "databaseName": "transaction-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "commitTransaction": 1, + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": { + "$$exists": false + }, + "autocommit": false, + "writeConcern": { + "$$exists": false + } + }, + "commandName": "commitTransaction", + "databaseName": "admin" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ + { + "_id": 0, + "x": 1 + } + ] + } + ] + } + ] +} From 594454b4fb9f2020e1e1f1169b461f466390c037 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 12 Feb 2024 15:14:32 -0500 Subject: [PATCH 54/55] DRIVERS-2834: Prohibit LB topology for tests using targetedFailPoint --- .../tests/unified/mongos-pin-auto-tests.py | 4 +++- .../tests/unified/mongos-pin-auto.json | 3 +-- .../tests/unified/mongos-pin-auto.yml | 4 +++- .../mongos-recovery-token-errorLabels.json | 3 +-- .../mongos-recovery-token-errorLabels.yml | 6 +++--- .../tests/unified/mongos-recovery-token.json | 14 +++++++++++++ .../tests/unified/mongos-recovery-token.yml | 8 +++++++ .../tests/unified/mongos-unpin.json | 17 +++++++++++++-- .../tests/unified/mongos-unpin.yml | 17 +++++++++++++-- .../tests/unified/pin-mongos.json | 21 +++++++++++++++++++ .../transactions/tests/unified/pin-mongos.yml | 12 +++++++++++ .../unified-test-format.md | 16 ++++++++++++++ 12 files changed, 112 insertions(+), 13 deletions(-) diff --git a/source/transactions/tests/unified/mongos-pin-auto-tests.py b/source/transactions/tests/unified/mongos-pin-auto-tests.py index 0cf31f9e19..99a34b485d 100644 --- a/source/transactions/tests/unified/mongos-pin-auto-tests.py +++ b/source/transactions/tests/unified/mongos-pin-auto-tests.py @@ -20,7 +20,9 @@ runOnRequirements: - minServerVersion: "4.1.8" - topologies: [ sharded, load-balanced ] + # Note: tests utilize targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] # serverless proxy doesn't append error labels to errors in transactions # caused by failpoints (CLOUDP-88216) serverless: "forbid" diff --git a/source/transactions/tests/unified/mongos-pin-auto.json b/source/transactions/tests/unified/mongos-pin-auto.json index be685ea838..93eac8bb77 100644 --- a/source/transactions/tests/unified/mongos-pin-auto.json +++ b/source/transactions/tests/unified/mongos-pin-auto.json @@ -5,8 +5,7 @@ { "minServerVersion": "4.1.8", "topologies": [ - "sharded", - "load-balanced" + "sharded" ], "serverless": "forbid" } diff --git a/source/transactions/tests/unified/mongos-pin-auto.yml b/source/transactions/tests/unified/mongos-pin-auto.yml index 0f5979aafb..7a76347555 100644 --- a/source/transactions/tests/unified/mongos-pin-auto.yml +++ b/source/transactions/tests/unified/mongos-pin-auto.yml @@ -7,7 +7,9 @@ schemaVersion: '1.4' runOnRequirements: - minServerVersion: "4.1.8" - topologies: [ sharded, load-balanced ] + # Note: tests utilize targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] # serverless proxy doesn't append error labels to errors in transactions # caused by failpoints (CLOUDP-88216) serverless: "forbid" diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json index fd7a829939..13345c6a29 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.json @@ -6,8 +6,7 @@ "minServerVersion": "4.3.1", "serverless": "forbid", "topologies": [ - "sharded", - "load-balanced" + "sharded" ] } ], diff --git a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml index b711106da6..e93c89b6d6 100644 --- a/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml +++ b/source/transactions/tests/unified/mongos-recovery-token-errorLabels.yml @@ -7,9 +7,9 @@ runOnRequirements: minServerVersion: 4.3.1 # failCommand errorLabels option # serverless proxy doesn't use recovery tokens serverless: forbid - topologies: - - sharded - - load-balanced + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] createEntities: - diff --git a/source/transactions/tests/unified/mongos-recovery-token.json b/source/transactions/tests/unified/mongos-recovery-token.json index ae1c1a91f9..00909c4218 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.json +++ b/source/transactions/tests/unified/mongos-recovery-token.json @@ -214,6 +214,13 @@ }, { "description": "commitTransaction retry fails on new mongos", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "object": "testRunner", @@ -408,6 +415,13 @@ }, { "description": "abortTransaction sends recoveryToken", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "object": "session0", diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index 916e5ecf84..f8606f0782 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -132,6 +132,10 @@ tests: - { _id: 1 } - description: 'commitTransaction retry fails on new mongos' + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + runOnRequirements: + - topologies: [ sharded ] operations: - object: testRunner @@ -260,6 +264,10 @@ tests: documents: [] - description: 'abortTransaction sends recoveryToken' + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + runOnRequirements: + - topologies: [ sharded ] operations: - object: *session0 diff --git a/source/transactions/tests/unified/mongos-unpin.json b/source/transactions/tests/unified/mongos-unpin.json index 356f4fd9b8..4d1ebc87bc 100644 --- a/source/transactions/tests/unified/mongos-unpin.json +++ b/source/transactions/tests/unified/mongos-unpin.json @@ -52,7 +52,10 @@ "description": "unpin after TransientTransactionError error on commit", "runOnRequirements": [ { - "serverless": "forbid" + "serverless": "forbid", + "topologies": [ + "sharded" + ] } ], "operations": [ @@ -163,7 +166,10 @@ "description": "unpin after non-transient error on abort", "runOnRequirements": [ { - "serverless": "forbid" + "serverless": "forbid", + "topologies": [ + "sharded" + ] } ], "operations": [ @@ -233,6 +239,13 @@ }, { "description": "unpin after TransientTransactionError error on abort", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "name": "startTransaction", diff --git a/source/transactions/tests/unified/mongos-unpin.yml b/source/transactions/tests/unified/mongos-unpin.yml index 5f7e78e5e8..44844a1858 100644 --- a/source/transactions/tests/unified/mongos-unpin.yml +++ b/source/transactions/tests/unified/mongos-unpin.yml @@ -35,9 +35,13 @@ _yamlAnchors: tests: - description: unpin after TransientTransactionError error on commit runOnRequirements: + - # serverless proxy doesn't append error labels to errors in transactions # caused by failpoints (CLOUDP-88216) - - serverless: "forbid" + serverless: "forbid" + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] operations: - &startTransaction name: startTransaction @@ -87,9 +91,13 @@ tests: - description: unpin after non-transient error on abort runOnRequirements: + - # serverless proxy doesn't append error labels to errors in transactions # caused by failpoints (CLOUDP-88216) - - serverless: "forbid" + serverless: "forbid" + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] operations: - *startTransaction - *insertOne @@ -112,6 +120,11 @@ tests: - *abortTransaction - description: unpin after TransientTransactionError error on abort + runOnRequirements: + - + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + topologies: [ sharded ] operations: - *startTransaction - *insertOne diff --git a/source/transactions/tests/unified/pin-mongos.json b/source/transactions/tests/unified/pin-mongos.json index fe268cd5f6..5f2ecca5c1 100644 --- a/source/transactions/tests/unified/pin-mongos.json +++ b/source/transactions/tests/unified/pin-mongos.json @@ -936,6 +936,13 @@ }, { "description": "remain pinned after non-transient error on commit", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "object": "session0", @@ -1044,6 +1051,13 @@ }, { "description": "unpin after transient error within a transaction", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "object": "session0", @@ -1217,6 +1231,13 @@ }, { "description": "unpin after transient error within a transaction and commit", + "runOnRequirements": [ + { + "topologies": [ + "sharded" + ] + } + ], "operations": [ { "object": "testRunner", diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index a0b8a1b0a7..596dc2d00d 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -342,6 +342,10 @@ tests: - { _id: 4 } - description: 'remain pinned after non-transient error on commit' + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + runOnRequirements: + - topologies: [ sharded ] operations: - object: *session0 @@ -398,6 +402,10 @@ tests: - { _id: 4 } - description: 'unpin after transient error within a transaction' + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + runOnRequirements: + - topologies: [ sharded ] operations: - object: *session0 @@ -501,6 +509,10 @@ tests: # commitTransaction to prove the session was unpinned. - description: 'unpin after transient error within a transaction and commit' + # Note: test utilizes targetedFailPoint, which is incompatible with + # load-balanced and useMultipleMongoses:true + runOnRequirements: + - topologies: [ sharded ] operations: - object: testRunner diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index e10b9a8dd3..ff6d361444 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -1849,8 +1849,13 @@ The `targetedFailPoint` operation instructs the test runner to configure a fail The following arguments are supported: - `failPoint`: Required document. The `configureFailPoint` command to be executed. + - `session`: Required string. See [commonOptions_session](#commonOptions_session). + The client entity associated with this session SHOULD specify true for + [useMultipleMongoses](#entity_client_useMultipleMongoses). This is advised because targeted fail points are intended + to test mongos pinning, which warrants multiple mongoses. + The mongos on which to set the fail point is determined by the `session` argument (after resolution to a session entity). Test runners MUST error if the session is not pinned to a mongos server at the time this operation is executed. @@ -1862,6 +1867,11 @@ SHOULD use the internal MongoClient corresponding to the session's pinned server runners MUST create a new MongoClient that is directly connected to the session's pinned server for this operation. The new MongoClient instance MUST be closed once the command has finished executing. +A test utilizing `targetedFailPoint` SHOULD NOT be permitted execute on a load balancer (according to +[runOnRequirements](#runOnRequirements) or [test.runOnRequirements](#test_runOnRequirements)). This is advised because +the `configureFailPoint` command does not use the session directly, which means there is no guarantee that the load +balancer will direct the command to the intended mongos. + When executing this operation, the test runner MUST keep a record of both the fail point and pinned mongos server so that the fail point can be disabled on the same mongos server after the test. @@ -1881,6 +1891,9 @@ An example of this operation follows: closeConnection: true ``` +Since mongos pinning only applies when multiple mongoses are used, tests SHOULD NOT use `targetedFailPoint` unless the +session's MongoClient is configured with `useMultipleMongoses: true`. + #### assertSessionTransactionState The `assertSessionTransactionState` operation instructs the test runner to assert that the given session has a @@ -3298,6 +3311,9 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog +- 2024-02-12: Clarify that `targetedFailPoint` should only be used when + `useMultipleMongoses` is true and not on load-balanced topologies. + - 2024-02-06: Migrated from reStructuredText to Markdown. - 2024-01-17: **Schema version 1.19.**\ From 6ce87df77aea94ad49c80d4bdc9a09cc4a58e42a Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Tue, 13 Feb 2024 22:33:41 -0500 Subject: [PATCH 55/55] mdformat is very opinionated about wrap columns --- source/unified-test-format/unified-test-format.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index ff6d361444..ef7aa34bba 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -3311,8 +3311,8 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog -- 2024-02-12: Clarify that `targetedFailPoint` should only be used when - `useMultipleMongoses` is true and not on load-balanced topologies. +- 2024-02-12: Clarify that `targetedFailPoint` should only be used when `useMultipleMongoses` is true and not on + load-balanced topologies. - 2024-02-06: Migrated from reStructuredText to Markdown.