Co-authored-by: Cloud User <ec2-user@ip-10-128-20-15.ec2.internal> Co-authored-by: Iris Ho <iris.ho@mongodb.com>
1579 lines
41 KiB
Diff
1579 lines
41 KiB
Diff
diff --git a/test/transactions/unified/backpressure-retryable-abort.json b/test/transactions/unified/backpressure-retryable-abort.json
|
|
new file mode 100644
|
|
index 00000000..53fc9c6f
|
|
--- /dev/null
|
|
+++ b/test/transactions/unified/backpressure-retryable-abort.json
|
|
@@ -0,0 +1,357 @@
|
|
+{
|
|
+ "description": "backpressure-retryable-abort",
|
|
+ "schemaVersion": "1.3",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "minServerVersion": "4.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": "abortTransaction retries if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": {
|
|
+ "times": 2
|
|
+ },
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "abortTransaction"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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 is retried maxAttempts=5 times if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": "alwaysOn",
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "abortTransaction"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "outcome": [
|
|
+ {
|
|
+ "collectionName": "test",
|
|
+ "databaseName": "transaction-tests",
|
|
+ "documents": []
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/test/transactions/unified/backpressure-retryable-commit.json b/test/transactions/unified/backpressure-retryable-commit.json
|
|
new file mode 100644
|
|
index 00000000..ae873561
|
|
--- /dev/null
|
|
+++ b/test/transactions/unified/backpressure-retryable-commit.json
|
|
@@ -0,0 +1,374 @@
|
|
+{
|
|
+ "description": "backpressure-retryable-commit",
|
|
+ "schemaVersion": "1.4",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "minServerVersion": "4.4",
|
|
+ "topologies": [
|
|
+ "sharded",
|
|
+ "replicaset",
|
|
+ "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": "commitTransaction retries if backpressure labels are added",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "serverless": "forbid"
|
|
+ }
|
|
+ ],
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": {
|
|
+ "times": 2
|
|
+ },
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "commitTransaction"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "commitTransaction",
|
|
+ "databaseName": "admin"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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": "commitTransaction is retried maxAttempts=5 times if backpressure labels are added",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "serverless": "forbid"
|
|
+ }
|
|
+ ],
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": "alwaysOn",
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "commitTransaction"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 1
|
|
+ }
|
|
+ },
|
|
+ "expectResult": {
|
|
+ "$$unsetOrMatches": {
|
|
+ "insertedId": {
|
|
+ "$$unsetOrMatches": 1
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "commitTransaction",
|
|
+ "expectError": {
|
|
+ "isError": true
|
|
+ }
|
|
+ }
|
|
+ ],
|
|
+ "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": {
|
|
+ "commandName": "commitTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "commitTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "commitTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "commitTransaction"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "commitTransaction"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "outcome": [
|
|
+ {
|
|
+ "collectionName": "test",
|
|
+ "databaseName": "transaction-tests",
|
|
+ "documents": []
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/test/transactions/unified/backpressure-retryable-reads.json b/test/transactions/unified/backpressure-retryable-reads.json
|
|
new file mode 100644
|
|
index 00000000..73176283
|
|
--- /dev/null
|
|
+++ b/test/transactions/unified/backpressure-retryable-reads.json
|
|
@@ -0,0 +1,328 @@
|
|
+{
|
|
+ "description": "backpressure-retryable-reads",
|
|
+ "schemaVersion": "1.3",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "minServerVersion": "4.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": "reads are retried if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 1
|
|
+ }
|
|
+ },
|
|
+ "expectResult": {
|
|
+ "$$unsetOrMatches": {
|
|
+ "insertedId": {
|
|
+ "$$unsetOrMatches": 1
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": {
|
|
+ "times": 1
|
|
+ },
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "find"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "find",
|
|
+ "arguments": {
|
|
+ "filter": {},
|
|
+ "session": "session0"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "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": {
|
|
+ "find": "test",
|
|
+ "readConcern": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "lsid": {
|
|
+ "$$sessionLsid": "session0"
|
|
+ },
|
|
+ "txnNumber": {
|
|
+ "$numberLong": "1"
|
|
+ },
|
|
+ "autocommit": false,
|
|
+ "writeConcern": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "find",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "find": "test",
|
|
+ "readConcern": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "lsid": {
|
|
+ "$$sessionLsid": "session0"
|
|
+ },
|
|
+ "txnNumber": {
|
|
+ "$numberLong": "1"
|
|
+ },
|
|
+ "autocommit": false,
|
|
+ "writeConcern": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "find",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "abortTransaction": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "lsid": {
|
|
+ "$$sessionLsid": "session0"
|
|
+ },
|
|
+ "txnNumber": {
|
|
+ "$numberLong": "1"
|
|
+ },
|
|
+ "startTransaction": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "autocommit": false,
|
|
+ "writeConcern": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "commitTransaction",
|
|
+ "databaseName": "admin"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "description": "reads are retried maxAttempts=5 times if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 1
|
|
+ }
|
|
+ },
|
|
+ "expectResult": {
|
|
+ "$$unsetOrMatches": {
|
|
+ "insertedId": {
|
|
+ "$$unsetOrMatches": 1
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": "alwaysOn",
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "find"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "find",
|
|
+ "arguments": {
|
|
+ "filter": {},
|
|
+ "session": "session0"
|
|
+ },
|
|
+ "expectError": {
|
|
+ "isError": true
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "abortTransaction"
|
|
+ }
|
|
+ ],
|
|
+ "expectEvents": [
|
|
+ {
|
|
+ "client": "client0",
|
|
+ "events": [
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "find"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/test/transactions/unified/backpressure-retryable-writes.json b/test/transactions/unified/backpressure-retryable-writes.json
|
|
new file mode 100644
|
|
index 00000000..eea0e6b5
|
|
--- /dev/null
|
|
+++ b/test/transactions/unified/backpressure-retryable-writes.json
|
|
@@ -0,0 +1,454 @@
|
|
+{
|
|
+ "description": "backpressure-retryable-writes",
|
|
+ "schemaVersion": "1.3",
|
|
+ "runOnRequirements": [
|
|
+ {
|
|
+ "minServerVersion": "4.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": "writes are retried if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 1
|
|
+ }
|
|
+ },
|
|
+ "expectResult": {
|
|
+ "$$unsetOrMatches": {
|
|
+ "insertedId": {
|
|
+ "$$unsetOrMatches": 1
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": {
|
|
+ "times": 1
|
|
+ },
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "insert"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 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": {
|
|
+ "insert": "test",
|
|
+ "documents": [
|
|
+ {
|
|
+ "_id": 2
|
|
+ }
|
|
+ ],
|
|
+ "ordered": true,
|
|
+ "readConcern": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "lsid": {
|
|
+ "$$sessionLsid": "session0"
|
|
+ },
|
|
+ "txnNumber": {
|
|
+ "$numberLong": "1"
|
|
+ },
|
|
+ "autocommit": false,
|
|
+ "writeConcern": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "insert",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "insert": "test",
|
|
+ "documents": [
|
|
+ {
|
|
+ "_id": 2
|
|
+ }
|
|
+ ],
|
|
+ "ordered": true,
|
|
+ "readConcern": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "lsid": {
|
|
+ "$$sessionLsid": "session0"
|
|
+ },
|
|
+ "txnNumber": {
|
|
+ "$numberLong": "1"
|
|
+ },
|
|
+ "autocommit": false,
|
|
+ "writeConcern": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "insert",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "abortTransaction": {
|
|
+ "$$exists": false
|
|
+ },
|
|
+ "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
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "description": "writes are retried maxAttempts=5 times if backpressure labels are added",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 1
|
|
+ }
|
|
+ },
|
|
+ "expectResult": {
|
|
+ "$$unsetOrMatches": {
|
|
+ "insertedId": {
|
|
+ "$$unsetOrMatches": 1
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": "alwaysOn",
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "insert"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 2
|
|
+ }
|
|
+ },
|
|
+ "expectError": {
|
|
+ "isError": true
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "abortTransaction"
|
|
+ }
|
|
+ ],
|
|
+ "expectEvents": [
|
|
+ {
|
|
+ "client": "client0",
|
|
+ "events": [
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "insert"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "commandName": "abortTransaction"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "outcome": [
|
|
+ {
|
|
+ "collectionName": "test",
|
|
+ "databaseName": "transaction-tests",
|
|
+ "documents": []
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "description": "retry succeeds if backpressure labels are added to the first operation in a transaction",
|
|
+ "operations": [
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "startTransaction"
|
|
+ },
|
|
+ {
|
|
+ "object": "testRunner",
|
|
+ "name": "failPoint",
|
|
+ "arguments": {
|
|
+ "client": "client0",
|
|
+ "failPoint": {
|
|
+ "configureFailPoint": "failCommand",
|
|
+ "mode": {
|
|
+ "times": 1
|
|
+ },
|
|
+ "data": {
|
|
+ "failCommands": [
|
|
+ "insert"
|
|
+ ],
|
|
+ "errorLabels": [
|
|
+ "RetryableError",
|
|
+ "SystemOverloadedError"
|
|
+ ],
|
|
+ "errorCode": 112
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "collection0",
|
|
+ "name": "insertOne",
|
|
+ "arguments": {
|
|
+ "session": "session0",
|
|
+ "document": {
|
|
+ "_id": 2
|
|
+ }
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "object": "session0",
|
|
+ "name": "abortTransaction"
|
|
+ }
|
|
+ ],
|
|
+ "expectEvents": [
|
|
+ {
|
|
+ "client": "client0",
|
|
+ "events": [
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "startTransaction": true
|
|
+ },
|
|
+ "commandName": "insert",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "startTransaction": true
|
|
+ },
|
|
+ "commandName": "insert",
|
|
+ "databaseName": "transaction-tests"
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "commandStartedEvent": {
|
|
+ "command": {
|
|
+ "startTransaction": {
|
|
+ "$$exists": false
|
|
+ }
|
|
+ },
|
|
+ "commandName": "abortTransaction",
|
|
+ "databaseName": "admin"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "outcome": [
|
|
+ {
|
|
+ "collectionName": "test",
|
|
+ "databaseName": "transaction-tests",
|
|
+ "documents": []
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git b/test/uri_options/client-backpressure-options.json a/test/uri_options/client-backpressure-options.json
|
|
new file mode 100644
|
|
index 00000000..3fcf2c86
|
|
--- /dev/null
|
|
+++ a/test/uri_options/client-backpressure-options.json
|
|
@@ -0,0 +1,35 @@
|
|
+{
|
|
+ "tests": [
|
|
+ {
|
|
+ "description": "adaptiveRetries=true is parsed correctly",
|
|
+ "uri": "mongodb://example.com/?adaptiveRetries=true",
|
|
+ "valid": true,
|
|
+ "warning": false,
|
|
+ "hosts": null,
|
|
+ "auth": null,
|
|
+ "options": {
|
|
+ "adaptiveRetries": true
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "description": "adaptiveRetries=false is parsed correctly",
|
|
+ "uri": "mongodb://example.com/?adaptiveRetries=false",
|
|
+ "valid": true,
|
|
+ "warning": false,
|
|
+ "hosts": null,
|
|
+ "auth": null,
|
|
+ "options": {
|
|
+ "adaptiveRetries": false
|
|
+ }
|
|
+ },
|
|
+ {
|
|
+ "description": "adaptiveRetries with invalid value causes a warning",
|
|
+ "uri": "mongodb://example.com/?adaptiveRetries=invalid",
|
|
+ "valid": true,
|
|
+ "warning": true,
|
|
+ "hosts": null,
|
|
+ "auth": null,
|
|
+ "options": null
|
|
+ }
|
|
+ ]
|
|
+}
|