diff --git a/.evergreen/spec-patch/PYTHON-5668.patch b/.evergreen/spec-patch/PYTHON-5668.patch new file mode 100644 index 0000000000..d48b18fe65 --- /dev/null +++ b/.evergreen/spec-patch/PYTHON-5668.patch @@ -0,0 +1,1578 @@ +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 ++ } ++ ] ++} diff --git a/.evergreen/spec-patch/PYTHON-5759.patch b/.evergreen/spec-patch/PYTHON-5759.patch new file mode 100644 index 0000000000..3b19ed065e --- /dev/null +++ b/.evergreen/spec-patch/PYTHON-5759.patch @@ -0,0 +1,460 @@ +diff --git a/test/client-side-encryption/spec/unified/accessToken-azure.json b/test/client-side-encryption/spec/unified/accessToken-azure.json +new file mode 100644 +index 00000000..510d8795 +--- /dev/null ++++ b/test/client-side-encryption/spec/unified/accessToken-azure.json +@@ -0,0 +1,186 @@ ++{ ++ "description": "accessToken-azure", ++ "schemaVersion": "1.28", ++ "runOnRequirements": [ ++ { ++ "minServerVersion": "4.1.10", ++ "csfle": { ++ "minLibmongocryptVersion": "1.6.0" ++ } ++ } ++ ], ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client", ++ "autoEncryptOpts": { ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "azure": { ++ "accessToken": { ++ "$$placeholder": 1 ++ } ++ } ++ } ++ } ++ } ++ }, ++ { ++ "database": { ++ "id": "db", ++ "client": "client", ++ "databaseName": "db" ++ } ++ }, ++ { ++ "collection": { ++ "id": "coll", ++ "database": "db", ++ "collectionName": "coll" ++ } ++ }, ++ { ++ "clientEncryption": { ++ "id": "clientEncryption", ++ "clientEncryptionOpts": { ++ "keyVaultClient": "client", ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "azure": { ++ "accessToken": { ++ "$$placeholder": 1 ++ } ++ } ++ } ++ } ++ } ++ } ++ ], ++ "initialData": [ ++ { ++ "databaseName": "db", ++ "collectionName": "coll", ++ "documents": [], ++ "createOptions": { ++ "validator": { ++ "$jsonSchema": { ++ "properties": { ++ "secret": { ++ "encrypt": { ++ "keyId": [ ++ { ++ "$binary": { ++ "base64": "AZURE+AAAAAAAAAAAAAAAA==", ++ "subType": "04" ++ } ++ } ++ ], ++ "bsonType": "string", ++ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" ++ } ++ } ++ }, ++ "bsonType": "object" ++ } ++ } ++ } ++ }, ++ { ++ "databaseName": "keyvault", ++ "collectionName": "datakeys", ++ "documents": [ ++ { ++ "_id": { ++ "$binary": { ++ "base64": "AZURE+AAAAAAAAAAAAAAAA==", ++ "subType": "04" ++ } ++ }, ++ "keyAltNames": [ ++ "my-key" ++ ], ++ "keyMaterial": { ++ "$binary": { ++ "base64": "n+HWZ0ZSVOYA3cvQgP7inN4JSXfOH85IngmeQxRpQHjCCcqT3IFqEWNlrsVHiz3AELimHhX4HKqOLWMUeSIT6emUDDoQX9BAv8DR1+E1w4nGs/NyEneac78EYFkK3JysrFDOgl2ypCCTKAypkn9CkAx1if4cfgQE93LW4kczcyHdGiH36CIxrCDGv1UzAvERN5Qa47DVwsM6a+hWsF2AAAJVnF0wYLLJU07TuRHdMrrphPWXZsFgyV+lRqJ7DDpReKNO8nMPLV/mHqHBHGPGQiRdb9NoJo8CvokGz4+KE8oLwzKf6V24dtwZmRkrsDV4iOhvROAzz+Euo1ypSkL3mw==", ++ "subType": "00" ++ } ++ }, ++ "creationDate": { ++ "$date": { ++ "$numberLong": "1552949630483" ++ } ++ }, ++ "updateDate": { ++ "$date": { ++ "$numberLong": "1552949630483" ++ } ++ }, ++ "status": { ++ "$numberInt": "0" ++ }, ++ "masterKey": { ++ "provider": "azure", ++ "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", ++ "keyName": "key-name-csfle" ++ } ++ } ++ ] ++ } ++ ], ++ "tests": [ ++ { ++ "description": "Auto encrypt using access token Azure credentials", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "secret": "string0" ++ } ++ }, ++ "object": "coll" ++ } ++ ], ++ "outcome": [ ++ { ++ "documents": [ ++ { ++ "_id": 1, ++ "secret": { ++ "$binary": { ++ "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==", ++ "subType": "06" ++ } ++ } ++ } ++ ], ++ "collectionName": "coll", ++ "databaseName": "db" ++ } ++ ] ++ }, ++ { ++ "description": "Explicit encrypt using access token Azure credentials", ++ "operations": [ ++ { ++ "name": "encrypt", ++ "object": "clientEncryption", ++ "arguments": { ++ "value": "string0", ++ "opts": { ++ "keyAltName": "my-key", ++ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" ++ } ++ }, ++ "expectResult": { ++ "$binary": { ++ "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==", ++ "subType": "06" ++ } ++ } ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/client-side-encryption/spec/unified/accessToken-gcp.json b/test/client-side-encryption/spec/unified/accessToken-gcp.json +new file mode 100644 +index 00000000..f5cf8914 +--- /dev/null ++++ b/test/client-side-encryption/spec/unified/accessToken-gcp.json +@@ -0,0 +1,188 @@ ++{ ++ "description": "accessToken-gcp", ++ "schemaVersion": "1.28", ++ "runOnRequirements": [ ++ { ++ "minServerVersion": "4.1.10", ++ "csfle": { ++ "minLibmongocryptVersion": "1.6.0" ++ } ++ } ++ ], ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client", ++ "autoEncryptOpts": { ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "gcp": { ++ "accessToken": { ++ "$$placeholder": 1 ++ } ++ } ++ } ++ } ++ } ++ }, ++ { ++ "database": { ++ "id": "db", ++ "client": "client", ++ "databaseName": "db" ++ } ++ }, ++ { ++ "collection": { ++ "id": "coll", ++ "database": "db", ++ "collectionName": "coll" ++ } ++ }, ++ { ++ "clientEncryption": { ++ "id": "clientEncryption", ++ "clientEncryptionOpts": { ++ "keyVaultClient": "client", ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "gcp": { ++ "accessToken": { ++ "$$placeholder": 1 ++ } ++ } ++ } ++ } ++ } ++ } ++ ], ++ "initialData": [ ++ { ++ "databaseName": "db", ++ "collectionName": "coll", ++ "documents": [], ++ "createOptions": { ++ "validator": { ++ "$jsonSchema": { ++ "properties": { ++ "secret": { ++ "encrypt": { ++ "keyId": [ ++ { ++ "$binary": { ++ "base64": "GCP+AAAAAAAAAAAAAAAAAA==", ++ "subType": "04" ++ } ++ } ++ ], ++ "bsonType": "string", ++ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" ++ } ++ } ++ }, ++ "bsonType": "object" ++ } ++ } ++ } ++ }, ++ { ++ "databaseName": "keyvault", ++ "collectionName": "datakeys", ++ "documents": [ ++ { ++ "_id": { ++ "$binary": { ++ "base64": "GCP+AAAAAAAAAAAAAAAAAA==", ++ "subType": "04" ++ } ++ }, ++ "keyAltNames": [ ++ "my-key" ++ ], ++ "keyMaterial": { ++ "$binary": { ++ "base64": "CiQAIgLj0WyktnB4dfYHo5SLZ41K4ASQrjJUaSzl5vvVH0G12G0SiQEAjlV8XPlbnHDEDFbdTO4QIe8ER2/172U1ouLazG0ysDtFFIlSvWX5ZnZUrRMmp/R2aJkzLXEt/zf8Mn4Lfm+itnjgo5R9K4pmPNvvPKNZX5C16lrPT+aA+rd+zXFSmlMg3i5jnxvTdLHhg3G7Q/Uv1ZIJskKt95bzLoe0tUVzRWMYXLIEcohnQg==", ++ "subType": "00" ++ } ++ }, ++ "creationDate": { ++ "$date": { ++ "$numberLong": "1552949630483" ++ } ++ }, ++ "updateDate": { ++ "$date": { ++ "$numberLong": "1552949630483" ++ } ++ }, ++ "status": { ++ "$numberInt": "0" ++ }, ++ "masterKey": { ++ "provider": "gcp", ++ "projectId": "devprod-drivers", ++ "location": "global", ++ "keyRing": "key-ring-csfle", ++ "keyName": "key-name-csfle" ++ } ++ } ++ ] ++ } ++ ], ++ "tests": [ ++ { ++ "description": "Auto encrypt using access token GCP credentials", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "secret": "string0" ++ } ++ }, ++ "object": "coll" ++ } ++ ], ++ "outcome": [ ++ { ++ "documents": [ ++ { ++ "_id": 1, ++ "secret": { ++ "$binary": { ++ "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==", ++ "subType": "06" ++ } ++ } ++ } ++ ], ++ "collectionName": "coll", ++ "databaseName": "db" ++ } ++ ] ++ }, ++ { ++ "description": "Explicit encrypt using access token GCP credentials", ++ "operations": [ ++ { ++ "name": "encrypt", ++ "object": "clientEncryption", ++ "arguments": { ++ "value": "string0", ++ "opts": { ++ "keyAltName": "my-key", ++ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" ++ } ++ }, ++ "expectResult": { ++ "$binary": { ++ "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==", ++ "subType": "06" ++ } ++ } ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json +new file mode 100644 +index 00000000..8fe5c150 +--- /dev/null ++++ b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json +@@ -0,0 +1,31 @@ ++{ ++ "description": "clientEncryptionOpts-kmsProviders-azure-accessToken-type", ++ "schemaVersion": "1.28", ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client0" ++ } ++ }, ++ { ++ "clientEncryption": { ++ "id": "clientEncryption0", ++ "clientEncryptionOpts": { ++ "keyVaultClient": "client0", ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "azure": { ++ "accessToken": 0 ++ } ++ } ++ } ++ } ++ } ++ ], ++ "tests": [ ++ { ++ "description": "", ++ "operations": [] ++ } ++ ] ++} +diff --git a/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json +new file mode 100644 +index 00000000..2284e26c +--- /dev/null ++++ b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json +@@ -0,0 +1,31 @@ ++{ ++ "description": "clientEncryptionOpts-kmsProviders-gcp-accessToken-type", ++ "schemaVersion": "1.28", ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client0" ++ } ++ }, ++ { ++ "clientEncryption": { ++ "id": "clientEncryption0", ++ "clientEncryptionOpts": { ++ "keyVaultClient": "client0", ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "gcp": { ++ "accessToken": 0 ++ } ++ } ++ } ++ } ++ } ++ ], ++ "tests": [ ++ { ++ "description": "", ++ "operations": [] ++ } ++ ] ++}