From 0017da3d475a7795cb0577f4991b385992e51573 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 4 Oct 2023 12:59:01 -0400 Subject: [PATCH] PHPLIB-1228: Run legacy transaction tests on LB topologies (#1148) Synced with mongodb/specifications@38e65fc8e59fedea351d9393ae43d305cde6ce00 Skip select legacy transaction spec tests on load balancers (per libmongoc). This includes any tests that rely on session pinning, including those that use targetedFailPoint. * PHPLIB-1270: targetedFailPoint should assert that session is pinned --- tests/SpecTests/Operation.php | 1 + tests/SpecTests/TransactionsSpecTest.php | 74 ++ tests/SpecTests/transactions/abort.json | 3 +- tests/SpecTests/transactions/bulk.json | 3 +- .../transactions/causal-consistency.json | 3 +- tests/SpecTests/transactions/commit.json | 3 +- tests/SpecTests/transactions/count.json | 3 +- .../transactions/create-collection.json | 3 +- .../SpecTests/transactions/create-index.json | 3 +- tests/SpecTests/transactions/delete.json | 3 +- .../error-labels-blockConnection.json | 160 ++++ .../SpecTests/transactions/error-labels.json | 3 +- .../SpecTests/transactions/errors-client.json | 3 +- tests/SpecTests/transactions/errors.json | 3 +- .../transactions/findOneAndDelete.json | 3 +- .../transactions/findOneAndReplace.json | 3 +- .../transactions/findOneAndUpdate.json | 3 +- tests/SpecTests/transactions/insert.json | 3 +- tests/SpecTests/transactions/isolation.json | 3 +- .../transactions/mongos-pin-auto.json | 3 +- .../transactions/mongos-recovery-token.json | 3 +- tests/SpecTests/transactions/pin-mongos.json | 3 +- .../SpecTests/transactions/read-concern.json | 3 +- tests/SpecTests/transactions/read-pref.json | 3 +- tests/SpecTests/transactions/reads.json | 3 +- .../retryable-abort-errorLabels.json | 3 +- .../transactions/retryable-abort.json | 3 +- .../retryable-commit-errorLabels.json | 3 +- .../retryable-commit-forbid_serverless.json | 651 ++++++++++++++++ .../transactions/retryable-commit.json | 705 +----------------- .../transactions/retryable-writes.json | 3 +- tests/SpecTests/transactions/run-command.json | 3 +- .../transactions/transaction-options.json | 3 +- tests/SpecTests/transactions/update.json | 3 +- .../SpecTests/transactions/write-concern.json | 3 +- 35 files changed, 985 insertions(+), 696 deletions(-) create mode 100644 tests/SpecTests/transactions/error-labels-blockConnection.json create mode 100644 tests/SpecTests/transactions/retryable-commit-forbid_serverless.json diff --git a/tests/SpecTests/Operation.php b/tests/SpecTests/Operation.php index 9e7776d09..bb4e42935 100644 --- a/tests/SpecTests/Operation.php +++ b/tests/SpecTests/Operation.php @@ -638,6 +638,7 @@ private function executeForTestRunner(FunctionalTestCase $test, Context $context case 'targetedFailPoint': $test->assertInstanceOf(Session::class, $args['session']); + $test->assertInstanceOf(Server::class, $args['session']->getServer()); $test->configureFailPoint($this->arguments['failPoint'], $args['session']->getServer()); return null; diff --git a/tests/SpecTests/TransactionsSpecTest.php b/tests/SpecTests/TransactionsSpecTest.php index dc7680eea..49f5eb972 100644 --- a/tests/SpecTests/TransactionsSpecTest.php +++ b/tests/SpecTests/TransactionsSpecTest.php @@ -36,6 +36,76 @@ class TransactionsSpecTest extends FunctionalTestCase 'transactions/pin-mongos: unpin after transient error within a transaction and commit' => 'isMaster failpoints cannot be disabled', ]; + /** + * Any tests that rely on session pinning (including targetedFailPoint) must + * be skipped since libmongoc does not pin on load-balanced toplogies. */ + private static array $incompleteLoadBalancerTests = [ + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertOne' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient error within a transaction' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertOne insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertMany insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on updateOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on replaceOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on updateMany update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on find find' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on distinct distinct' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on runCommand insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on insertOne insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on insertOne insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on insertMany insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on insertMany insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on updateOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on updateOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on replaceOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on replaceOne update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on updateMany update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on updateMany update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on find find' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on find find' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on distinct distinct' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on distinct distinct' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient connection error on runCommand insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on runCommand insert' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-recovery-token: commitTransaction explicit retries include recoveryToken' => 'libmongoc omits recoveryToken for load-balanced topology (CDRIVER-4718)', + 'transactions/mongos-recovery-token: commitTransaction retry succeeds on new mongos' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-recovery-token: commitTransaction retry fails on new mongos' => 'libmongoc does not pin for load-balanced topology', + 'transactions/mongos-recovery-token: abortTransaction sends recoveryToken' => 'libmongoc does not pin for load-balanced topology', + 'transactions/pin-mongos: multiple commits' => 'libmongoc does not pin for load-balanced topology', + 'transactions/pin-mongos: remain pinned after non-transient error on commit' => 'libmongoc does not pin for load-balanced topology', + 'transactions/pin-mongos: unpin after transient error within a transaction' => 'libmongoc does not pin for load-balanced topology', + 'transactions/pin-mongos: unpin after transient error within a transaction and commit' => 'libmongoc does not pin for load-balanced topology', + ]; + public function setUp(): void { parent::setUp(); @@ -143,6 +213,10 @@ private function runTransactionTest(stdClass $test, ?array $runOn, array $data, $this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]); } + if ($this->isLoadBalanced() && isset(self::$incompleteLoadBalancerTests[$this->dataDescription()])) { + $this->markTestIncomplete(self::$incompleteLoadBalancerTests[$this->dataDescription()]); + } + if (isset($runOn)) { $this->checkServerRequirements($runOn); } diff --git a/tests/SpecTests/transactions/abort.json b/tests/SpecTests/transactions/abort.json index 3729a9829..2398e4871 100644 --- a/tests/SpecTests/transactions/abort.json +++ b/tests/SpecTests/transactions/abort.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/bulk.json b/tests/SpecTests/transactions/bulk.json index 8a9793b8b..8ed78649f 100644 --- a/tests/SpecTests/transactions/bulk.json +++ b/tests/SpecTests/transactions/bulk.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/causal-consistency.json b/tests/SpecTests/transactions/causal-consistency.json index 0e81bf2ff..46b4ba839 100644 --- a/tests/SpecTests/transactions/causal-consistency.json +++ b/tests/SpecTests/transactions/causal-consistency.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/commit.json b/tests/SpecTests/transactions/commit.json index faa39a65f..d55a6b611 100644 --- a/tests/SpecTests/transactions/commit.json +++ b/tests/SpecTests/transactions/commit.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/count.json b/tests/SpecTests/transactions/count.json index 169296416..357bc252d 100644 --- a/tests/SpecTests/transactions/count.json +++ b/tests/SpecTests/transactions/count.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/create-collection.json b/tests/SpecTests/transactions/create-collection.json index 9071c59c4..d65159d02 100644 --- a/tests/SpecTests/transactions/create-collection.json +++ b/tests/SpecTests/transactions/create-collection.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.4", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/create-index.json b/tests/SpecTests/transactions/create-index.json index 2ff09c928..cd0d75d0b 100644 --- a/tests/SpecTests/transactions/create-index.json +++ b/tests/SpecTests/transactions/create-index.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.4", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/delete.json b/tests/SpecTests/transactions/delete.json index 65b832703..2e2149453 100644 --- a/tests/SpecTests/transactions/delete.json +++ b/tests/SpecTests/transactions/delete.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/error-labels-blockConnection.json b/tests/SpecTests/transactions/error-labels-blockConnection.json new file mode 100644 index 000000000..848f56fa3 --- /dev/null +++ b/tests/SpecTests/transactions/error-labels-blockConnection.json @@ -0,0 +1,160 @@ +{ + "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/tests/SpecTests/transactions/error-labels.json b/tests/SpecTests/transactions/error-labels.json index 0be19c731..17b40579e 100644 --- a/tests/SpecTests/transactions/error-labels.json +++ b/tests/SpecTests/transactions/error-labels.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ], "serverless": "forbid" } diff --git a/tests/SpecTests/transactions/errors-client.json b/tests/SpecTests/transactions/errors-client.json index 15fae96fe..d163e91ec 100644 --- a/tests/SpecTests/transactions/errors-client.json +++ b/tests/SpecTests/transactions/errors-client.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/errors.json b/tests/SpecTests/transactions/errors.json index 5fc4905e8..356e3eec0 100644 --- a/tests/SpecTests/transactions/errors.json +++ b/tests/SpecTests/transactions/errors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/findOneAndDelete.json b/tests/SpecTests/transactions/findOneAndDelete.json index d82657a9f..e7aab710d 100644 --- a/tests/SpecTests/transactions/findOneAndDelete.json +++ b/tests/SpecTests/transactions/findOneAndDelete.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/findOneAndReplace.json b/tests/SpecTests/transactions/findOneAndReplace.json index 7a54ca343..595b5c58b 100644 --- a/tests/SpecTests/transactions/findOneAndReplace.json +++ b/tests/SpecTests/transactions/findOneAndReplace.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/findOneAndUpdate.json b/tests/SpecTests/transactions/findOneAndUpdate.json index 7af54ba80..8044f0476 100644 --- a/tests/SpecTests/transactions/findOneAndUpdate.json +++ b/tests/SpecTests/transactions/findOneAndUpdate.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/insert.json b/tests/SpecTests/transactions/insert.json index f26e7c2a7..2f29d4fa3 100644 --- a/tests/SpecTests/transactions/insert.json +++ b/tests/SpecTests/transactions/insert.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/isolation.json b/tests/SpecTests/transactions/isolation.json index f16b28a5e..fc3378147 100644 --- a/tests/SpecTests/transactions/isolation.json +++ b/tests/SpecTests/transactions/isolation.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/mongos-pin-auto.json b/tests/SpecTests/transactions/mongos-pin-auto.json index 037f212f4..36965dcb7 100644 --- a/tests/SpecTests/transactions/mongos-pin-auto.json +++ b/tests/SpecTests/transactions/mongos-pin-auto.json @@ -3,7 +3,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ], "serverless": "forbid" } diff --git a/tests/SpecTests/transactions/mongos-recovery-token.json b/tests/SpecTests/transactions/mongos-recovery-token.json index da4e9861d..c111d466b 100644 --- a/tests/SpecTests/transactions/mongos-recovery-token.json +++ b/tests/SpecTests/transactions/mongos-recovery-token.json @@ -3,7 +3,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ], "serverless": "forbid" } diff --git a/tests/SpecTests/transactions/pin-mongos.json b/tests/SpecTests/transactions/pin-mongos.json index 485a3d932..6e1d143d5 100644 --- a/tests/SpecTests/transactions/pin-mongos.json +++ b/tests/SpecTests/transactions/pin-mongos.json @@ -3,7 +3,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ], "serverless": "forbid" } diff --git a/tests/SpecTests/transactions/read-concern.json b/tests/SpecTests/transactions/read-concern.json index dd9243e2f..99495ddc4 100644 --- a/tests/SpecTests/transactions/read-concern.json +++ b/tests/SpecTests/transactions/read-concern.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/read-pref.json b/tests/SpecTests/transactions/read-pref.json index bf1f1970e..f06a72246 100644 --- a/tests/SpecTests/transactions/read-pref.json +++ b/tests/SpecTests/transactions/read-pref.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/reads.json b/tests/SpecTests/transactions/reads.json index 9fc587f48..ce9353a66 100644 --- a/tests/SpecTests/transactions/reads.json +++ b/tests/SpecTests/transactions/reads.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/retryable-abort-errorLabels.json b/tests/SpecTests/transactions/retryable-abort-errorLabels.json index 1110ce2c3..efeca7a5c 100644 --- a/tests/SpecTests/transactions/retryable-abort-errorLabels.json +++ b/tests/SpecTests/transactions/retryable-abort-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/retryable-abort.json b/tests/SpecTests/transactions/retryable-abort.json index 13cc7c88f..ca45db82c 100644 --- a/tests/SpecTests/transactions/retryable-abort.json +++ b/tests/SpecTests/transactions/retryable-abort.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/retryable-commit-errorLabels.json b/tests/SpecTests/transactions/retryable-commit-errorLabels.json index e0818f237..583a7356d 100644 --- a/tests/SpecTests/transactions/retryable-commit-errorLabels.json +++ b/tests/SpecTests/transactions/retryable-commit-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/retryable-commit-forbid_serverless.json b/tests/SpecTests/transactions/retryable-commit-forbid_serverless.json new file mode 100644 index 000000000..a320bb065 --- /dev/null +++ b/tests/SpecTests/transactions/retryable-commit-forbid_serverless.json @@ -0,0 +1,651 @@ +{ + "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 + } + ] + } + } + }, + { + "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/tests/SpecTests/transactions/retryable-commit.json b/tests/SpecTests/transactions/retryable-commit.json index 49148c62d..aa051378b 100644 --- a/tests/SpecTests/transactions/retryable-commit.json +++ b/tests/SpecTests/transactions/retryable-commit.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], @@ -18,20 +19,18 @@ "data": [], "tests": [ { - "description": "commitTransaction fails after two errors", - "clientOptions": { - "retryWrites": false - }, + "description": "commitTransaction fails after Interrupted", "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 2 + "times": 1 }, "data": { "failCommands": [ "commitTransaction" ], - "closeConnection": true + "errorCode": 11601, + "closeConnection": false } }, "operations": [ @@ -56,18 +55,13 @@ "name": "commitTransaction", "object": "session0", "result": { - "errorLabelsContain": [ + "errorCodeName": "Interrupted", + "errorLabelsOmit": [ "RetryableWriteError", + "TransientTransactionError", "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" ] } - }, - { - "name": "commitTransaction", - "object": "session0" } ], "expectations": [ @@ -109,71 +103,29 @@ "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 - } - ] + "data": [] } } }, { - "description": "commitTransaction applies majority write concern on retries", - "clientOptions": { - "retryWrites": false - }, + "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error", "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 2 + "times": 1 }, "data": { "failCommands": [ "commitTransaction" ], - "closeConnection": true + "writeConcernError": { + "code": 100, + "errmsg": "Not enough data-bearing nodes" + } } }, "operations": [ @@ -183,9 +135,7 @@ "arguments": { "options": { "writeConcern": { - "w": 2, - "j": true, - "wtimeout": 5000 + "w": "majority" } } } @@ -207,18 +157,12 @@ "name": "commitTransaction", "object": "session0", "result": { - "errorLabelsContain": [ + "errorLabelsOmit": [ "RetryableWriteError", + "TransientTransactionError", "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" ] } - }, - { - "name": "commitTransaction", - "object": "session0" } ], "expectations": [ @@ -256,49 +200,7 @@ "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 + "w": "majority" } }, "command_name": "commitTransaction", @@ -317,7 +219,7 @@ } }, { - "description": "commitTransaction fails after Interrupted", + "description": "commitTransaction succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -327,7 +229,10 @@ "failCommands": [ "commitTransaction" ], - "errorCode": 11601, + "errorCode": 10107, + "errorLabels": [ + "RetryableWriteError" + ], "closeConnection": false } }, @@ -351,15 +256,7 @@ }, { "name": "commitTransaction", - "object": "session0", - "result": { - "errorCodeName": "Interrupted", - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } + "object": "session0" } ], "expectations": [ @@ -401,91 +298,6 @@ "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": { @@ -498,7 +310,8 @@ "startTransaction": null, "autocommit": false, "writeConcern": { - "w": "majority" + "w": "majority", + "wtimeout": 10000 } }, "command_name": "commitTransaction", @@ -517,7 +330,7 @@ } }, { - "description": "commitTransaction succeeds after connection error", + "description": "commitTransaction succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -527,7 +340,11 @@ "failCommands": [ "commitTransaction" ], - "closeConnection": true + "errorCode": 13436, + "errorLabels": [ + "RetryableWriteError" + ], + "closeConnection": false } }, "operations": [ @@ -624,7 +441,7 @@ } }, { - "description": "commitTransaction succeeds after NotWritablePrimary", + "description": "commitTransaction succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -634,7 +451,7 @@ "failCommands": [ "commitTransaction" ], - "errorCode": 10107, + "errorCode": 13435, "errorLabels": [ "RetryableWriteError" ], @@ -735,7 +552,7 @@ } }, { - "description": "commitTransaction succeeds after NotPrimaryOrSecondary", + "description": "commitTransaction succeeds after InterruptedDueToReplStateChange", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -745,7 +562,7 @@ "failCommands": [ "commitTransaction" ], - "errorCode": 13436, + "errorCode": 11602, "errorLabels": [ "RetryableWriteError" ], @@ -846,340 +663,7 @@ } }, { - "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 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 PrimarySteppedDown", + "description": "commitTransaction succeeds after PrimarySteppedDown", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -1289,117 +773,6 @@ } } }, - { - "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 - } - ] - } - } - }, { "description": "commitTransaction succeeds after HostNotFound", "failPoint": { diff --git a/tests/SpecTests/transactions/retryable-writes.json b/tests/SpecTests/transactions/retryable-writes.json index c932893b5..93ad04ef8 100644 --- a/tests/SpecTests/transactions/retryable-writes.json +++ b/tests/SpecTests/transactions/retryable-writes.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/run-command.json b/tests/SpecTests/transactions/run-command.json index 2f2a3a881..2f36786b3 100644 --- a/tests/SpecTests/transactions/run-command.json +++ b/tests/SpecTests/transactions/run-command.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/transaction-options.json b/tests/SpecTests/transactions/transaction-options.json index 25d245dca..6bcfae9d3 100644 --- a/tests/SpecTests/transactions/transaction-options.json +++ b/tests/SpecTests/transactions/transaction-options.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/update.json b/tests/SpecTests/transactions/update.json index e33bf5b81..df2c480e5 100644 --- a/tests/SpecTests/transactions/update.json +++ b/tests/SpecTests/transactions/update.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/tests/SpecTests/transactions/write-concern.json b/tests/SpecTests/transactions/write-concern.json index 84b1ea365..5d17f741e 100644 --- a/tests/SpecTests/transactions/write-concern.json +++ b/tests/SpecTests/transactions/write-concern.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.8", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ],