diff --git a/src/operations/execute_operation.ts b/src/operations/execute_operation.ts index 514200b10f..6b74920aa6 100644 --- a/src/operations/execute_operation.ts +++ b/src/operations/execute_operation.ts @@ -389,12 +389,28 @@ async function executeOperationWithRetries< ); function canRetry(operation: AbstractOperation, error: MongoError) { - // always retryable + // SystemOverloadedError is retryable, but must respect retryReads/retryWrites settings + // Check topology options directly (not operation.canRetryRead/Write) because backpressure + // expands retry support beyond traditional retryable reads/writes + // NOTE: Unlike traditional retries, backpressure retries ARE allowed inside transactions if ( error.hasErrorLabel(MongoErrorLabel.SystemOverloadedError) && error.hasErrorLabel(MongoErrorLabel.RetryableError) ) { - return true; + // runCommand requires BOTH retryReads and retryWrites to be enabled (per spec step 2.4) + if (operation instanceof RunCommandOperation) { + return topology.s.options.retryReads && topology.s.options.retryWrites; + } + + // Write-stage aggregates ($out/$merge) require retryWrites + if (operation instanceof AggregateOperation && operation.hasWriteStage) { + return topology.s.options.retryWrites; + } + + // For other operations, check if retries are enabled based on operation type + const canRetryAsRead = hasReadAspect && topology.s.options.retryReads; + const canRetryAsWrite = hasWriteAspect && topology.s.options.retryWrites; + return canRetryAsRead || canRetryAsWrite; } // run command is only retryable if we get retryable overload errors diff --git a/test/integration/client-backpressure/client-backpressure.spec.test.ts b/test/integration/client-backpressure/client-backpressure.spec.test.ts index 9485c46a96..d3c2bd6e9b 100644 --- a/test/integration/client-backpressure/client-backpressure.spec.test.ts +++ b/test/integration/client-backpressure/client-backpressure.spec.test.ts @@ -4,6 +4,8 @@ import { type Test } from '../../tools/unified-spec-runner/schema'; const skippedTests = { 'collection.dropIndexes retries at most maxAttempts=5 times': + 'TODO(NODE-6517): dropIndexes squashes all errors other than ns not found', + 'collection.dropIndexes (write) does not retry if retryWrites=false': 'TODO(NODE-6517): dropIndexes squashes all errors other than ns not found' }; diff --git a/test/spec/client-backpressure/backpressure-retry-loop.json b/test/spec/client-backpressure/backpressure-retry-loop.json index 8c01020ca5..9121b21856 100644 --- a/test/spec/client-backpressure/backpressure-retry-loop.json +++ b/test/spec/client-backpressure/backpressure-retry-loop.json @@ -20,6 +20,9 @@ "commandStartedEvent", "commandSucceededEvent", "commandFailedEvent" + ], + "ignoreCommandMonitoringEvents": [ + "killCursors" ] } }, @@ -56,6 +59,68 @@ "database": "database", "collectionName": "coll" } + }, + { + "client": { + "id": "client_retryReads_false", + "useMultipleMongoses": false, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent" + ], + "ignoreCommandMonitoringEvents": [ + "killCursors" + ], + "uriOptions": { + "retryReads": false + } + } + }, + { + "database": { + "id": "database_retryReads_false", + "client": "client_retryReads_false", + "databaseName": "retryable-writes-tests" + } + }, + { + "collection": { + "id": "collection_retryReads_false", + "database": "database_retryReads_false", + "collectionName": "coll" + } + }, + { + "client": { + "id": "client_retryWrites_false", + "useMultipleMongoses": false, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent" + ], + "ignoreCommandMonitoringEvents": [ + "killCursors" + ], + "uriOptions": { + "retryWrites": false + } + } + }, + { + "database": { + "id": "database_retryWrites_false", + "client": "client_retryWrites_false", + "databaseName": "retryable-writes-tests" + } + }, + { + "collection": { + "id": "collection_retryWrites_false", + "database": "database_retryWrites_false", + "collectionName": "coll" + } } ], "initialData": [ @@ -151,6 +216,62 @@ } ] }, + { + "description": "client.listDatabases (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "listDatabases" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listDatabases", + "object": "client_retryReads_false", + "arguments": { + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "listDatabases" + } + }, + { + "commandFailedEvent": { + "commandName": "listDatabases" + } + } + ] + } + ] + }, { "description": "client.listDatabaseNames retries using operation loop", "operations": [ @@ -230,6 +351,59 @@ } ] }, + { + "description": "client.listDatabaseNames (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "listDatabases" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listDatabaseNames", + "object": "client_retryReads_false", + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "listDatabases" + } + }, + { + "commandFailedEvent": { + "commandName": "listDatabases" + } + } + ] + } + ] + }, { "description": "client.createChangeStream retries using operation loop", "operations": [ @@ -312,6 +486,62 @@ } ] }, + { + "description": "client.createChangeStream (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "createChangeStream", + "object": "client_retryReads_false", + "arguments": { + "pipeline": [] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + } + ] + } + ] + }, { "description": "client.clientBulkWrite retries using operation loop", "runOnRequirements": [ @@ -410,7 +640,78 @@ ] }, { - "description": "database.aggregate retries using operation loop", + "description": "client.clientBulkWrite (write) does not retry if retryWrites=false", + "runOnRequirements": [ + { + "minServerVersion": "8.0" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "bulkWrite" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "clientBulkWrite", + "object": "client_retryWrites_false", + "arguments": { + "models": [ + { + "insertOne": { + "namespace": "retryable-writes-tests.coll", + "document": { + "_id": 8, + "x": 88 + } + } + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "bulkWrite" + } + }, + { + "commandFailedEvent": { + "commandName": "bulkWrite" + } + } + ] + } + ] + }, + { + "description": "database.aggregate read retries using operation loop", "operations": [ { "name": "failPoint", @@ -499,7 +800,7 @@ ] }, { - "description": "database.listCollections retries using operation loop", + "description": "database.aggregate (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -509,11 +810,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "listCollections" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -525,55 +826,36 @@ } }, { - "name": "listCollections", - "object": "database", + "name": "aggregate", + "object": "database_retryReads_false", "arguments": { - "filter": {} - } - } - ], + "pipeline": [ + { + "$listLocalSessions": {} + }, + { + "$limit": 1 + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" + "commandName": "aggregate" } } ] @@ -581,7 +863,7 @@ ] }, { - "description": "database.listCollectionNames retries using operation loop", + "description": "database.listCollections retries using operation loop", "operations": [ { "name": "failPoint", @@ -607,7 +889,7 @@ } }, { - "name": "listCollectionNames", + "name": "listCollections", "object": "database", "arguments": { "filter": {} @@ -663,7 +945,7 @@ ] }, { - "description": "database.runCommand retries using operation loop", + "description": "database.listCollections (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -673,11 +955,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "ping" + "listCollections" ], "errorLabels": [ "RetryableError", @@ -689,58 +971,29 @@ } }, { - "name": "runCommand", - "object": "database", + "name": "listCollections", + "object": "database_retryReads_false", "arguments": { - "command": { - "ping": 1 - }, - "commandName": "ping" + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" + "commandName": "listCollections" } }, { "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandSucceededEvent": { - "commandName": "ping" + "commandName": "listCollections" } } ] @@ -748,7 +1001,7 @@ ] }, { - "description": "database.createChangeStream retries using operation loop", + "description": "database.listCollectionNames retries using operation loop", "operations": [ { "name": "failPoint", @@ -762,7 +1015,7 @@ }, "data": { "failCommands": [ - "aggregate" + "listCollections" ], "errorLabels": [ "RetryableError", @@ -774,10 +1027,10 @@ } }, { - "name": "createChangeStream", + "name": "listCollectionNames", "object": "database", "arguments": { - "pipeline": [] + "filter": {} } } ], @@ -787,42 +1040,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandSucceededEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } } ] @@ -830,7 +1083,7 @@ ] }, { - "description": "collection.aggregate retries using operation loop", + "description": "database.listCollectionNames (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -840,11 +1093,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "aggregate" + "listCollections" ], "errorLabels": [ "RetryableError", @@ -856,55 +1109,29 @@ } }, { - "name": "aggregate", - "object": "collection", + "name": "listCollectionNames", + "object": "database_retryReads_false", "arguments": { - "pipeline": [] + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } }, { "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" + "commandName": "listCollections" } } ] @@ -912,7 +1139,7 @@ ] }, { - "description": "collection.countDocuments retries using operation loop", + "description": "database.runCommand retries using operation loop", "operations": [ { "name": "failPoint", @@ -926,7 +1153,7 @@ }, "data": { "failCommands": [ - "aggregate" + "ping" ], "errorLabels": [ "RetryableError", @@ -938,10 +1165,13 @@ } }, { - "name": "countDocuments", - "object": "collection", + "name": "runCommand", + "object": "database", "arguments": { - "filter": {} + "command": { + "ping": 1 + }, + "commandName": "ping" } } ], @@ -951,42 +1181,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "ping" } }, { "commandSucceededEvent": { - "commandName": "aggregate" + "commandName": "ping" } } ] @@ -994,7 +1224,7 @@ ] }, { - "description": "collection.estimatedDocumentCount retries using operation loop", + "description": "database.runCommand (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1004,11 +1234,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "count" + "ping" ], "errorLabels": [ "RetryableError", @@ -1020,52 +1250,32 @@ } }, { - "name": "estimatedDocumentCount", - "object": "collection" + "name": "runCommand", + "object": "database_retryReads_false", + "arguments": { + "command": { + "ping": 1 + }, + "commandName": "ping" + }, + "expectError": { + "isError": true, + "isClientError": false + } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandSucceededEvent": { - "commandName": "count" + "commandName": "ping" } } ] @@ -1073,7 +1283,7 @@ ] }, { - "description": "collection.distinct retries using operation loop", + "description": "database.runCommand (write) does not retry if retryWrites=false", "operations": [ { "name": "failPoint", @@ -1083,11 +1293,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "distinct" + "ping" ], "errorLabels": [ "RetryableError", @@ -1099,56 +1309,32 @@ } }, { - "name": "distinct", - "object": "collection", + "name": "runCommand", + "object": "database_retryWrites_false", "arguments": { - "fieldName": "x", - "filter": {} + "command": { + "ping": 1 + }, + "commandName": "ping" + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryWrites_false", "events": [ { "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandSucceededEvent": { - "commandName": "distinct" + "commandName": "ping" } } ] @@ -1156,7 +1342,7 @@ ] }, { - "description": "collection.find retries using operation loop", + "description": "database.createChangeStream retries using operation loop", "operations": [ { "name": "failPoint", @@ -1170,7 +1356,7 @@ }, "data": { "failCommands": [ - "find" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1182,10 +1368,10 @@ } }, { - "name": "find", - "object": "collection", + "name": "createChangeStream", + "object": "database", "arguments": { - "filter": {} + "pipeline": [] } } ], @@ -1195,42 +1381,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandSucceededEvent": { - "commandName": "find" + "commandName": "aggregate" } } ] @@ -1238,7 +1424,7 @@ ] }, { - "description": "collection.findOne retries using operation loop", + "description": "database.createChangeStream (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1248,11 +1434,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "find" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1264,55 +1450,29 @@ } }, { - "name": "findOne", - "object": "collection", + "name": "createChangeStream", + "object": "database_retryReads_false", "arguments": { - "filter": {} + "pipeline": [] + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "commandName": "find" + "commandName": "aggregate" } } ] @@ -1320,7 +1480,7 @@ ] }, { - "description": "collection.listIndexes retries using operation loop", + "description": "collection.aggregate read retries using operation loop", "operations": [ { "name": "failPoint", @@ -1334,7 +1494,7 @@ }, "data": { "failCommands": [ - "listIndexes" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1346,8 +1506,11 @@ } }, { - "name": "listIndexes", - "object": "collection" + "name": "aggregate", + "object": "collection", + "arguments": { + "pipeline": [] + } } ], "expectEvents": [ @@ -1356,42 +1519,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandSucceededEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } } ] @@ -1399,7 +1562,7 @@ ] }, { - "description": "collection.listIndexNames retries using operation loop", + "description": "collection.aggregate (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1409,11 +1572,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "listIndexes" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1425,52 +1588,29 @@ } }, { - "name": "listIndexNames", - "object": "collection" + "name": "aggregate", + "object": "collection_retryReads_false", + "arguments": { + "pipeline": [] + }, + "expectError": { + "isError": true, + "isClientError": false + } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" + "commandName": "aggregate" } } ] @@ -1478,7 +1618,7 @@ ] }, { - "description": "collection.createChangeStream retries using operation loop", + "description": "collection.countDocuments retries using operation loop", "operations": [ { "name": "failPoint", @@ -1504,10 +1644,10 @@ } }, { - "name": "createChangeStream", + "name": "countDocuments", "object": "collection", "arguments": { - "pipeline": [] + "filter": {} } } ], @@ -1560,7 +1700,7 @@ ] }, { - "description": "collection.insertOne retries using operation loop", + "description": "collection.countDocuments (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1570,11 +1710,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "insert" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1586,58 +1726,29 @@ } }, { - "name": "insertOne", - "object": "collection", + "name": "countDocuments", + "object": "collection_retryReads_false", "arguments": { - "document": { - "_id": 2, - "x": 22 - } + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" + "commandName": "aggregate" } } ] @@ -1645,7 +1756,7 @@ ] }, { - "description": "collection.insertMany retries using operation loop", + "description": "collection.estimatedDocumentCount retries using operation loop", "operations": [ { "name": "failPoint", @@ -1659,7 +1770,7 @@ }, "data": { "failCommands": [ - "insert" + "count" ], "errorLabels": [ "RetryableError", @@ -1671,16 +1782,8 @@ } }, { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } + "name": "estimatedDocumentCount", + "object": "collection" } ], "expectEvents": [ @@ -1689,42 +1792,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "count" } }, { "commandSucceededEvent": { - "commandName": "insert" + "commandName": "count" } } ] @@ -1732,7 +1835,7 @@ ] }, { - "description": "collection.deleteOne retries using operation loop", + "description": "collection.estimatedDocumentCount (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1742,11 +1845,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "delete" + "count" ], "errorLabels": [ "RetryableError", @@ -1758,55 +1861,26 @@ } }, { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} + "name": "estimatedDocumentCount", + "object": "collection_retryReads_false", + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" + "commandName": "count" } } ] @@ -1814,7 +1888,7 @@ ] }, { - "description": "collection.deleteMany retries using operation loop", + "description": "collection.distinct retries using operation loop", "operations": [ { "name": "failPoint", @@ -1828,7 +1902,7 @@ }, "data": { "failCommands": [ - "delete" + "distinct" ], "errorLabels": [ "RetryableError", @@ -1840,9 +1914,10 @@ } }, { - "name": "deleteMany", + "name": "distinct", "object": "collection", "arguments": { + "fieldName": "x", "filter": {} } } @@ -1853,42 +1928,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "distinct" } }, { "commandSucceededEvent": { - "commandName": "delete" + "commandName": "distinct" } } ] @@ -1896,7 +1971,7 @@ ] }, { - "description": "collection.replaceOne retries using operation loop", + "description": "collection.distinct (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1906,11 +1981,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "update" + "distinct" ], "errorLabels": [ "RetryableError", @@ -1922,58 +1997,30 @@ } }, { - "name": "replaceOne", - "object": "collection", + "name": "distinct", + "object": "collection_retryReads_false", "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } + "fieldName": "x", + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" + "commandName": "distinct" } } ] @@ -1981,7 +2028,7 @@ ] }, { - "description": "collection.updateOne retries using operation loop", + "description": "collection.find retries using operation loop", "operations": [ { "name": "failPoint", @@ -1995,7 +2042,7 @@ }, "data": { "failCommands": [ - "update" + "find" ], "errorLabels": [ "RetryableError", @@ -2007,15 +2054,10 @@ } }, { - "name": "updateOne", + "name": "find", "object": "collection", "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } + "filter": {} } } ], @@ -2025,42 +2067,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandSucceededEvent": { - "commandName": "update" + "commandName": "find" } } ] @@ -2068,7 +2110,7 @@ ] }, { - "description": "collection.updateMany retries using operation loop", + "description": "collection.find (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -2078,11 +2120,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "update" + "find" ], "errorLabels": [ "RetryableError", @@ -2094,60 +2136,29 @@ } }, { - "name": "updateMany", - "object": "collection", + "name": "find", + "object": "collection_retryReads_false", "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" + "commandName": "find" } } ] @@ -2155,7 +2166,7 @@ ] }, { - "description": "collection.findOneAndDelete retries using operation loop", + "description": "collection.findOne retries using operation loop", "operations": [ { "name": "failPoint", @@ -2169,7 +2180,7 @@ }, "data": { "failCommands": [ - "findAndModify" + "find" ], "errorLabels": [ "RetryableError", @@ -2181,7 +2192,7 @@ } }, { - "name": "findOneAndDelete", + "name": "findOne", "object": "collection", "arguments": { "filter": {} @@ -2194,42 +2205,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "find" } } ] @@ -2237,7 +2248,7 @@ ] }, { - "description": "collection.findOneAndReplace retries using operation loop", + "description": "collection.findOne (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -2247,11 +2258,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "findAndModify" + "find" ], "errorLabels": [ "RetryableError", @@ -2263,58 +2274,2169 @@ } }, { - "name": "findOneAndReplace", - "object": "collection", + "name": "findOne", + "object": "collection_retryReads_false", "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "find" } - }, + } + ] + } + ] + }, + { + "description": "collection.listIndexes retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "listIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listIndexes", + "object": "collection" + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "listIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.listIndexes (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "listIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listIndexes", + "object": "collection_retryReads_false", + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.listIndexNames retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "listIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listIndexNames", + "object": "collection" + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "listIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.listIndexNames (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "listIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "listIndexNames", + "object": "collection_retryReads_false", + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "listIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "listIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.createChangeStream retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection", + "arguments": { + "pipeline": [] + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandSucceededEvent": { + "commandName": "aggregate" + } + } + ] + } + ] + }, + { + "description": "collection.createChangeStream (read) does not retry if retryReads=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "aggregate" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection_retryReads_false", + "arguments": { + "pipeline": [] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryReads_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + } + ] + } + ] + }, + { + "description": "collection.insertOne retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "insertOne", + "object": "collection", + "arguments": { + "document": { + "_id": 2, + "x": 22 + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandSucceededEvent": { + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.insertOne (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "insertOne", + "object": "collection_retryWrites_false", + "arguments": { + "document": { + "_id": 2, + "x": 22 + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.insertMany retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "insertMany", + "object": "collection", + "arguments": { + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandSucceededEvent": { + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.insertMany (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "insertMany", + "object": "collection_retryWrites_false", + "arguments": { + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.deleteOne retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "deleteOne", + "object": "collection", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandSucceededEvent": { + "commandName": "delete" + } + } + ] + } + ] + }, + { + "description": "collection.deleteOne (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "deleteOne", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + } + ] + } + ] + }, + { + "description": "collection.deleteMany retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "deleteMany", + "object": "collection", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + }, + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandSucceededEvent": { + "commandName": "delete" + } + } + ] + } + ] + }, + { + "description": "collection.deleteMany (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "delete" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "deleteMany", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "delete" + } + }, + { + "commandFailedEvent": { + "commandName": "delete" + } + } + ] + } + ] + }, + { + "description": "collection.replaceOne retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "replaceOne", + "object": "collection", + "arguments": { + "filter": {}, + "replacement": { + "x": 22 + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandSucceededEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.replaceOne (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "replaceOne", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {}, + "replacement": { + "x": 22 + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.updateOne retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "updateOne", + "object": "collection", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandSucceededEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.updateOne (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "updateOne", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.updateMany retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "updateMany", + "object": "collection", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + }, + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandSucceededEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.updateMany (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "update" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "updateMany", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "update" + } + }, + { + "commandFailedEvent": { + "commandName": "update" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndDelete retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndDelete", + "object": "collection", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandSucceededEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndDelete (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndDelete", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {} + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndReplace retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndReplace", + "object": "collection", + "arguments": { + "filter": {}, + "replacement": { + "x": 22 + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandSucceededEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndReplace (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndReplace", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {}, + "replacement": { + "x": 22 + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndUpdate retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndUpdate", + "object": "collection", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandSucceededEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.findOneAndUpdate (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "findAndModify" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "findOneAndUpdate", + "object": "collection_retryWrites_false", + "arguments": { + "filter": {}, + "update": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "findAndModify" + } + }, + { + "commandFailedEvent": { + "commandName": "findAndModify" + } + } + ] + } + ] + }, + { + "description": "collection.bulkWrite retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 2, + "x": 22 + } + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" } }, { "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.bulkWrite (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "bulkWrite", + "object": "collection_retryWrites_false", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 2, + "x": 22 + } + } + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "collection.createIndex retries using operation loop", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "createIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 11 + }, + "name": "x_11" + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "createIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.createIndex (write) does not retry if retryWrites=false", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "createIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "createIndex", + "object": "collection_retryWrites_false", + "arguments": { + "keys": { + "x": 11 + }, + "name": "x_11" + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "createIndexes" } } ] @@ -2322,8 +4444,18 @@ ] }, { - "description": "collection.findOneAndUpdate retries using operation loop", + "description": "collection.dropIndex retries using operation loop", "operations": [ + { + "name": "createIndex", + "object": "retryable-writes-tests", + "arguments": { + "keys": { + "x": 11 + }, + "name": "x_11" + } + }, { "name": "failPoint", "object": "testRunner", @@ -2336,7 +4468,7 @@ }, "data": { "failCommands": [ - "findAndModify" + "dropIndexes" ], "errorLabels": [ "RetryableError", @@ -2348,15 +4480,10 @@ } }, { - "name": "findOneAndUpdate", + "name": "dropIndex", "object": "collection", "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } + "name": "x_11" } } ], @@ -2366,42 +4493,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } }, { "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "dropIndexes" } } ] @@ -2409,8 +4536,18 @@ ] }, { - "description": "collection.bulkWrite retries using operation loop", + "description": "collection.dropIndex (write) does not retry if retryWrites=false", "operations": [ + { + "name": "createIndex", + "object": "retryable-writes-tests", + "arguments": { + "keys": { + "x": 11 + }, + "name": "x_11" + } + }, { "name": "failPoint", "object": "testRunner", @@ -2419,11 +4556,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "insert" + "dropIndexes" ], "errorLabels": [ "RetryableError", @@ -2435,64 +4572,29 @@ } }, { - "name": "bulkWrite", - "object": "collection", + "name": "dropIndex", + "object": "collection_retryWrites_false", "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] + "name": "x_11" + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryWrites_false", "events": [ { "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" + "commandName": "dropIndexes" } } ] @@ -2500,7 +4602,7 @@ ] }, { - "description": "collection.createIndex retries using operation loop", + "description": "collection.dropIndexes retries using operation loop", "operations": [ { "name": "failPoint", @@ -2514,7 +4616,7 @@ }, "data": { "failCommands": [ - "createIndexes" + "dropIndexes" ], "errorLabels": [ "RetryableError", @@ -2526,14 +4628,8 @@ } }, { - "name": "createIndex", - "object": "collection", - "arguments": { - "keys": { - "x": 11 - }, - "name": "x_11" - } + "name": "dropIndexes", + "object": "collection" } ], "expectEvents": [ @@ -2542,42 +4638,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } }, { "commandSucceededEvent": { - "commandName": "createIndexes" + "commandName": "dropIndexes" } } ] @@ -2585,18 +4681,61 @@ ] }, { - "description": "collection.dropIndex retries using operation loop", + "description": "collection.dropIndexes (write) does not retry if retryWrites=false", "operations": [ { - "name": "createIndex", - "object": "retryable-writes-tests", + "name": "failPoint", + "object": "testRunner", "arguments": { - "keys": { - "x": 11 - }, - "name": "x_11" + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "dropIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } } }, + { + "name": "dropIndexes", + "object": "collection_retryWrites_false", + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client_retryWrites_false", + "events": [ + { + "commandStartedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "dropIndexes" + } + } + ] + } + ] + }, + { + "description": "collection.aggregate write retries using operation loop", + "operations": [ { "name": "failPoint", "object": "testRunner", @@ -2609,7 +4748,7 @@ }, "data": { "failCommands": [ - "dropIndexes" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -2621,10 +4760,14 @@ } }, { - "name": "dropIndex", + "name": "aggregate", "object": "collection", "arguments": { - "name": "x_11" + "pipeline": [ + { + "$out": "output" + } + ] } } ], @@ -2634,42 +4777,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandSucceededEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } } ] @@ -2677,7 +4820,7 @@ ] }, { - "description": "collection.dropIndexes retries using operation loop", + "description": "collection.aggregate (write) does not retry if retryWrites=false", "operations": [ { "name": "failPoint", @@ -2687,11 +4830,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "dropIndexes" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -2703,52 +4846,33 @@ } }, { - "name": "dropIndexes", - "object": "collection" + "name": "aggregate", + "object": "collection_retryWrites_false", + "arguments": { + "pipeline": [ + { + "$out": "output" + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryWrites_false", "events": [ { "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "dropIndexes" + "commandName": "aggregate" } } ] diff --git a/test/spec/client-backpressure/backpressure-retry-loop.yml b/test/spec/client-backpressure/backpressure-retry-loop.yml index eda57d4979..ea14aee329 100644 --- a/test/spec/client-backpressure/backpressure-retry-loop.yml +++ b/test/spec/client-backpressure/backpressure-retry-loop.yml @@ -13,6 +13,7 @@ createEntities: id: &client client useMultipleMongoses: false observeEvents: [commandStartedEvent, commandSucceededEvent, commandFailedEvent] + ignoreCommandMonitoringEvents: [killCursors] - client: id: &internal_client internal_client @@ -32,12 +33,48 @@ createEntities: id: &database database client: *client databaseName: *database_name - + - collection: id: &collection collection database: *database collectionName: *collection_name + - client: + id: &client_retryReads_false client_retryReads_false + useMultipleMongoses: false + observeEvents: [commandStartedEvent, commandSucceededEvent, commandFailedEvent] + ignoreCommandMonitoringEvents: [killCursors] + uriOptions: + retryReads: false + + - database: + id: &database_retryReads_false database_retryReads_false + client: *client_retryReads_false + databaseName: *database_name + + - collection: + id: &collection_retryReads_false collection_retryReads_false + database: *database_retryReads_false + collectionName: *collection_name + + - client: + id: &client_retryWrites_false client_retryWrites_false + useMultipleMongoses: false + observeEvents: [commandStartedEvent, commandSucceededEvent, commandFailedEvent] + ignoreCommandMonitoringEvents: [killCursors] + uriOptions: + retryWrites: false + + - database: + id: &database_retryWrites_false database_retryWrites_false + client: *client_retryWrites_false + databaseName: *database_name + + - collection: + id: &collection_retryWrites_false collection_retryWrites_false + database: *database_retryWrites_false + collectionName: *collection_name + initialData: - collectionName: *collection_name databaseName: *database_name @@ -46,7 +83,7 @@ initialData: _yamlAnchors: bulWriteInsertNamespace: &client_bulk_write_ns retryable-writes-tests.coll -tests: +tests: - description: 'client.listDatabases retries using operation loop' operations: - name: failPoint @@ -60,7 +97,7 @@ tests: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listDatabases object: *client arguments: @@ -85,6 +122,36 @@ tests: commandName: listDatabases - commandSucceededEvent: commandName: listDatabases + - description: 'client.listDatabases (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listDatabases] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listDatabases + object: *client_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listDatabases + - commandFailedEvent: + commandName: listDatabases + - description: 'client.listDatabaseNames retries using operation loop' operations: @@ -99,7 +166,7 @@ tests: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listDatabaseNames object: *client @@ -122,6 +189,34 @@ tests: commandName: listDatabases - commandSucceededEvent: commandName: listDatabases + - description: 'client.listDatabaseNames (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listDatabases] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listDatabaseNames + object: *client_retryReads_false + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listDatabases + - commandFailedEvent: + commandName: listDatabases + - description: 'client.createChangeStream retries using operation loop' operations: @@ -136,7 +231,7 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createChangeStream object: *client arguments: @@ -161,6 +256,36 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate + - description: 'client.createChangeStream (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: createChangeStream + object: *client_retryReads_false + arguments: + pipeline: [] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - description: 'client.clientBulkWrite retries using operation loop' runOnRequirements: @@ -177,7 +302,7 @@ tests: failCommands: [bulkWrite] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: clientBulkWrite object: *client arguments: @@ -205,8 +330,43 @@ tests: commandName: bulkWrite - commandSucceededEvent: commandName: bulkWrite + - description: 'client.clientBulkWrite (write) does not retry if retryWrites=false' + runOnRequirements: + - minServerVersion: '8.0' # client bulk write added to server in 8.0 + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [bulkWrite] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: clientBulkWrite + object: *client_retryWrites_false + arguments: + models: + - insertOne: + namespace: *client_bulk_write_ns + document: { _id: 8, x: 88 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: bulkWrite + - commandFailedEvent: + commandName: bulkWrite + - - description: 'database.aggregate retries using operation loop' + - description: 'database.aggregate read retries using operation loop' operations: - name: failPoint object: testRunner @@ -219,7 +379,7 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: aggregate object: *database arguments: @@ -244,6 +404,36 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate + - description: 'database.aggregate (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *database_retryReads_false + arguments: + pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - description: 'database.listCollections retries using operation loop' operations: @@ -258,7 +448,7 @@ tests: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listCollections object: *database arguments: @@ -283,6 +473,36 @@ tests: commandName: listCollections - commandSucceededEvent: commandName: listCollections + - description: 'database.listCollections (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listCollections] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listCollections + object: *database_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listCollections + - commandFailedEvent: + commandName: listCollections + - description: 'database.listCollectionNames retries using operation loop' operations: @@ -297,7 +517,7 @@ tests: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listCollectionNames object: *database arguments: @@ -322,6 +542,36 @@ tests: commandName: listCollections - commandSucceededEvent: commandName: listCollections + - description: 'database.listCollectionNames (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listCollections] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listCollectionNames + object: *database_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listCollections + - commandFailedEvent: + commandName: listCollections + - description: 'database.runCommand retries using operation loop' operations: @@ -336,7 +586,7 @@ tests: failCommands: [ping] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: runCommand object: *database arguments: @@ -362,8 +612,7 @@ tests: commandName: ping - commandSucceededEvent: commandName: ping - - - description: 'database.createChangeStream retries using operation loop' + - description: 'database.runCommand (read) does not retry if retryReads=false' operations: - name: failPoint object: testRunner @@ -371,38 +620,61 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 1 } data: - failCommands: [aggregate] + failCommands: [ping] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - - name: createChangeStream - object: *database + + - name: runCommand + object: *database_retryReads_false arguments: - pipeline: [] + command: { ping: 1 } + commandName: ping + expectError: + isError: true + isClientError: false expectEvents: - - client: *client + - client: *client_retryReads_false events: - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate + commandName: ping - commandFailedEvent: - commandName: aggregate + commandName: ping + - description: 'database.runCommand (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ping] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: runCommand + object: *database_retryWrites_false + arguments: + command: { ping: 1 } + commandName: ping + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: - commandStartedEvent: - commandName: aggregate + commandName: ping - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandSucceededEvent: - commandName: aggregate + commandName: ping + - - description: 'collection.aggregate retries using operation loop' + - description: 'database.createChangeStream retries using operation loop' operations: - name: failPoint object: testRunner @@ -415,9 +687,9 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - - name: aggregate - object: *collection + + - name: createChangeStream + object: *database arguments: pipeline: [] @@ -440,8 +712,7 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate - - - description: 'collection.countDocuments retries using operation loop' + - description: 'database.createChangeStream (read) does not retry if retryReads=false' operations: - name: failPoint object: testRunner @@ -449,18 +720,49 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 1 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - - name: countDocuments - object: *collection - arguments: - filter: {} - expectEvents: + - name: createChangeStream + object: *database_retryReads_false + arguments: + pipeline: [] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + + + - description: 'collection.aggregate read retries using operation loop' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 3 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *collection + arguments: + pipeline: [] + + expectEvents: - client: *client events: - commandStartedEvent: @@ -479,6 +781,105 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate + - description: 'collection.aggregate (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *collection_retryReads_false + arguments: + pipeline: [] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + + + - description: 'collection.countDocuments retries using operation loop' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 3 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: countDocuments + object: *collection + arguments: + filter: {} + + expectEvents: + - client: *client + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - description: 'collection.countDocuments (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: countDocuments + object: *collection_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - description: 'collection.estimatedDocumentCount retries using operation loop' operations: @@ -493,7 +894,7 @@ tests: failCommands: [count] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: estimatedDocumentCount object: *collection @@ -516,6 +917,34 @@ tests: commandName: count - commandSucceededEvent: commandName: count + - description: 'collection.estimatedDocumentCount (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [count] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: estimatedDocumentCount + object: *collection_retryReads_false + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: count + - commandFailedEvent: + commandName: count + - description: 'collection.distinct retries using operation loop' operations: @@ -530,7 +959,7 @@ tests: failCommands: [distinct] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: distinct object: *collection arguments: @@ -556,6 +985,37 @@ tests: commandName: distinct - commandSucceededEvent: commandName: distinct + - description: 'collection.distinct (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [distinct] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: distinct + object: *collection_retryReads_false + arguments: + fieldName: x + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: distinct + - commandFailedEvent: + commandName: distinct + - description: 'collection.find retries using operation loop' operations: @@ -570,7 +1030,7 @@ tests: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: find object: *collection arguments: @@ -595,6 +1055,36 @@ tests: commandName: find - commandSucceededEvent: commandName: find + - description: 'collection.find (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [find] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: find + object: *collection_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: find + - commandFailedEvent: + commandName: find + - description: 'collection.findOne retries using operation loop' operations: @@ -609,7 +1099,7 @@ tests: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOne object: *collection arguments: @@ -634,6 +1124,36 @@ tests: commandName: find - commandSucceededEvent: commandName: find + - description: 'collection.findOne (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [find] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: findOne + object: *collection_retryReads_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: find + - commandFailedEvent: + commandName: find + - description: 'collection.listIndexes retries using operation loop' operations: @@ -648,7 +1168,7 @@ tests: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listIndexes object: *collection @@ -671,6 +1191,34 @@ tests: commandName: listIndexes - commandSucceededEvent: commandName: listIndexes + - description: 'collection.listIndexes (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listIndexes] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listIndexes + object: *collection_retryReads_false + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listIndexes + - commandFailedEvent: + commandName: listIndexes + - description: 'collection.listIndexNames retries using operation loop' operations: @@ -685,7 +1233,7 @@ tests: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listIndexNames object: *collection @@ -708,6 +1256,34 @@ tests: commandName: listIndexes - commandSucceededEvent: commandName: listIndexes + - description: 'collection.listIndexNames (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [listIndexes] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: listIndexNames + object: *collection_retryReads_false + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: listIndexes + - commandFailedEvent: + commandName: listIndexes + - description: 'collection.createChangeStream retries using operation loop' operations: @@ -722,7 +1298,7 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createChangeStream object: *collection arguments: @@ -747,6 +1323,36 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate + - description: 'collection.createChangeStream (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: createChangeStream + object: *collection_retryReads_false + arguments: + pipeline: [] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - description: 'collection.insertOne retries using operation loop' operations: @@ -761,7 +1367,7 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: insertOne object: *collection arguments: @@ -786,6 +1392,36 @@ tests: commandName: insert - commandSucceededEvent: commandName: insert + - description: 'collection.insertOne (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [insert] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: insertOne + object: *collection_retryWrites_false + arguments: + document: { _id: 2, x: 22 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: insert + - commandFailedEvent: + commandName: insert + - description: 'collection.insertMany retries using operation loop' operations: @@ -800,7 +1436,7 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: insertMany object: *collection arguments: @@ -826,6 +1462,37 @@ tests: commandName: insert - commandSucceededEvent: commandName: insert + - description: 'collection.insertMany (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [insert] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: insertMany + object: *collection_retryWrites_false + arguments: + documents: + - { _id: 2, x: 22 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: insert + - commandFailedEvent: + commandName: insert + - description: 'collection.deleteOne retries using operation loop' operations: @@ -840,7 +1507,7 @@ tests: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: deleteOne object: *collection arguments: @@ -865,6 +1532,36 @@ tests: commandName: delete - commandSucceededEvent: commandName: delete + - description: 'collection.deleteOne (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [delete] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: deleteOne + object: *collection_retryWrites_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: delete + - commandFailedEvent: + commandName: delete + - description: 'collection.deleteMany retries using operation loop' operations: @@ -879,7 +1576,7 @@ tests: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: deleteMany object: *collection arguments: @@ -904,6 +1601,36 @@ tests: commandName: delete - commandSucceededEvent: commandName: delete + - description: 'collection.deleteMany (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [delete] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: deleteMany + object: *collection_retryWrites_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: delete + - commandFailedEvent: + commandName: delete + - description: 'collection.replaceOne retries using operation loop' operations: @@ -918,7 +1645,7 @@ tests: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: replaceOne object: *collection arguments: @@ -944,6 +1671,37 @@ tests: commandName: update - commandSucceededEvent: commandName: update + - description: 'collection.replaceOne (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [update] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: replaceOne + object: *collection_retryWrites_false + arguments: + filter: {} + replacement: { x: 22 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: update + - commandFailedEvent: + commandName: update + - description: 'collection.updateOne retries using operation loop' operations: @@ -958,8 +1716,79 @@ tests: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - - name: updateOne + + - name: updateOne + object: *collection + arguments: + filter: {} + update: { $set: { x: 22 } } + + expectEvents: + - client: *client + events: + - commandStartedEvent: + commandName: update + - commandFailedEvent: + commandName: update + - commandStartedEvent: + commandName: update + - commandFailedEvent: + commandName: update + - commandStartedEvent: + commandName: update + - commandFailedEvent: + commandName: update + - commandStartedEvent: + commandName: update + - commandSucceededEvent: + commandName: update + - description: 'collection.updateOne (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [update] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: updateOne + object: *collection_retryWrites_false + arguments: + filter: {} + update: { $set: { x: 22 } } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: update + - commandFailedEvent: + commandName: update + + + - description: 'collection.updateMany retries using operation loop' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 3 } + data: + failCommands: [update] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: updateMany object: *collection arguments: filter: {} @@ -984,8 +1813,7 @@ tests: commandName: update - commandSucceededEvent: commandName: update - - - description: 'collection.updateMany retries using operation loop' + - description: 'collection.updateMany (write) does not retry if retryWrites=false' operations: - name: failPoint object: testRunner @@ -993,37 +1821,29 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 1 } data: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: updateMany - object: *collection + object: *collection_retryWrites_false arguments: filter: {} update: { $set: { x: 22 } } + expectError: + isError: true + isClientError: false expectEvents: - - client: *client + - client: *client_retryWrites_false events: - commandStartedEvent: commandName: update - commandFailedEvent: commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - commandName: update + - description: 'collection.findOneAndDelete retries using operation loop' operations: @@ -1038,7 +1858,7 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndDelete object: *collection arguments: @@ -1063,6 +1883,36 @@ tests: commandName: findAndModify - commandSucceededEvent: commandName: findAndModify + - description: 'collection.findOneAndDelete (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [findAndModify] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: findOneAndDelete + object: *collection_retryWrites_false + arguments: + filter: {} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: findAndModify + - commandFailedEvent: + commandName: findAndModify + - description: 'collection.findOneAndReplace retries using operation loop' operations: @@ -1077,7 +1927,7 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndReplace object: *collection arguments: @@ -1103,6 +1953,37 @@ tests: commandName: findAndModify - commandSucceededEvent: commandName: findAndModify + - description: 'collection.findOneAndReplace (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [findAndModify] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: findOneAndReplace + object: *collection_retryWrites_false + arguments: + filter: {} + replacement: { x: 22 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: findAndModify + - commandFailedEvent: + commandName: findAndModify + - description: 'collection.findOneAndUpdate retries using operation loop' operations: @@ -1117,7 +1998,7 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndUpdate object: *collection arguments: @@ -1143,6 +2024,37 @@ tests: commandName: findAndModify - commandSucceededEvent: commandName: findAndModify + - description: 'collection.findOneAndUpdate (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [findAndModify] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: findOneAndUpdate + object: *collection_retryWrites_false + arguments: + filter: {} + update: { $set: { x: 22 } } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: findAndModify + - commandFailedEvent: + commandName: findAndModify + - description: 'collection.bulkWrite retries using operation loop' operations: @@ -1157,7 +2069,7 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: bulkWrite object: *collection arguments: @@ -1184,6 +2096,38 @@ tests: commandName: insert - commandSucceededEvent: commandName: insert + - description: 'collection.bulkWrite (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [insert] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: bulkWrite + object: *collection_retryWrites_false + arguments: + requests: + - insertOne: + document: { _id: 2, x: 22 } + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: insert + - commandFailedEvent: + commandName: insert + - description: 'collection.createIndex retries using operation loop' operations: @@ -1198,7 +2142,7 @@ tests: failCommands: [createIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createIndex object: *collection arguments: @@ -1224,6 +2168,37 @@ tests: commandName: createIndexes - commandSucceededEvent: commandName: createIndexes + - description: 'collection.createIndex (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [createIndexes] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: createIndex + object: *collection_retryWrites_false + arguments: + keys: { x: 11 } + name: "x_11" + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: createIndexes + - commandFailedEvent: + commandName: createIndexes + - description: 'collection.dropIndex retries using operation loop' operations: @@ -1243,7 +2218,7 @@ tests: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: dropIndex object: *collection arguments: @@ -1268,6 +2243,41 @@ tests: commandName: dropIndexes - commandSucceededEvent: commandName: dropIndexes + - description: 'collection.dropIndex (write) does not retry if retryWrites=false' + operations: + - name: createIndex + object: *internal_collection + arguments: + keys: { x: 11 } + name: "x_11" + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [dropIndexes] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: dropIndex + object: *collection_retryWrites_false + arguments: + name: "x_11" + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: dropIndexes + - commandFailedEvent: + commandName: dropIndexes + - description: 'collection.dropIndexes retries using operation loop' operations: @@ -1282,7 +2292,7 @@ tests: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: dropIndexes object: *collection @@ -1305,3 +2315,99 @@ tests: commandName: dropIndexes - commandSucceededEvent: commandName: dropIndexes + - description: 'collection.dropIndexes (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [dropIndexes] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: dropIndexes + object: *collection_retryWrites_false + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: dropIndexes + - commandFailedEvent: + commandName: dropIndexes + + + - description: 'collection.aggregate write retries using operation loop' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 3 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *collection + arguments: + pipeline: [{$out: "output"}] + + expectEvents: + - client: *client + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - description: 'collection.aggregate (write) does not retry if retryWrites=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *collection_retryWrites_false + arguments: + pipeline: [{$out: "output"}] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate diff --git a/test/spec/client-backpressure/backpressure-retry-max-attempts.json b/test/spec/client-backpressure/backpressure-retry-max-attempts.json index efde542621..ed2352ca83 100644 --- a/test/spec/client-backpressure/backpressure-retry-max-attempts.json +++ b/test/spec/client-backpressure/backpressure-retry-max-attempts.json @@ -20,6 +20,9 @@ "commandStartedEvent", "commandSucceededEvent", "commandFailedEvent" + ], + "ignoreCommandMonitoringEvents": [ + "killCursors" ] } }, @@ -493,7 +496,7 @@ ] }, { - "description": "database.aggregate retries at most maxAttempts=5 times", + "description": "database.aggregate read retries at most maxAttempts=5 times", "operations": [ { "name": "failPoint", @@ -1023,7 +1026,7 @@ ] }, { - "description": "collection.aggregate retries at most maxAttempts=5 times", + "description": "collection.aggregate read retries at most maxAttempts=5 times", "operations": [ { "name": "failPoint", @@ -3443,6 +3446,114 @@ ] } ] + }, + { + "description": "collection.aggregate write retries at most maxAttempts=5 times", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "fail_point_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": "alwaysOn", + "data": { + "failCommands": [ + "aggregate" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "aggregate", + "object": "collection", + "arguments": { + "pipeline": [ + { + "$out": "output" + } + ] + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandFailedEvent": { + "commandName": "aggregate" + } + } + ] + } + ] } ] } diff --git a/test/spec/client-backpressure/backpressure-retry-max-attempts.yml b/test/spec/client-backpressure/backpressure-retry-max-attempts.yml index 39e4859368..ec7b5e49dc 100644 --- a/test/spec/client-backpressure/backpressure-retry-max-attempts.yml +++ b/test/spec/client-backpressure/backpressure-retry-max-attempts.yml @@ -14,6 +14,7 @@ createEntities: id: &client client useMultipleMongoses: false observeEvents: [commandStartedEvent, commandSucceededEvent, commandFailedEvent] + ignoreCommandMonitoringEvents: [killCursors] - client: id: &fail_point_client fail_point_client @@ -39,7 +40,7 @@ initialData: - { _id: 1, x: 11 } - { _id: 2, x: 22 } -tests: +tests: - description: 'client.listDatabases retries at most maxAttempts=5 times' operations: - name: failPoint @@ -53,19 +54,19 @@ tests: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listDatabases object: *client arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listDatabases @@ -105,17 +106,17 @@ tests: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listDatabaseNames object: *client - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listDatabases @@ -155,19 +156,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createChangeStream object: *client arguments: pipeline: [] - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -209,7 +210,7 @@ tests: failCommands: [bulkWrite] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: clientBulkWrite object: *client arguments: @@ -217,14 +218,14 @@ tests: - insertOne: namespace: *client_bulk_write_ns document: { _id: 8, x: 88 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: bulkWrite @@ -251,7 +252,7 @@ tests: - commandFailedEvent: commandName: bulkWrite - - description: 'database.aggregate retries at most maxAttempts=5 times' + - description: 'database.aggregate read retries at most maxAttempts=5 times' operations: - name: failPoint object: testRunner @@ -264,19 +265,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: aggregate object: *database arguments: pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ] - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -316,19 +317,19 @@ tests: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listCollections object: *database arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listCollections @@ -368,19 +369,19 @@ tests: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listCollectionNames object: *database arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listCollections @@ -420,20 +421,20 @@ tests: failCommands: [ping] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: runCommand object: *database arguments: command: { ping: 1 } commandName: ping - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: ping @@ -473,19 +474,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createChangeStream object: *database arguments: pipeline: [] - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -512,7 +513,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'collection.aggregate retries at most maxAttempts=5 times' + - description: 'collection.aggregate read retries at most maxAttempts=5 times' operations: - name: failPoint object: testRunner @@ -525,19 +526,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: aggregate object: *collection arguments: pipeline: [] - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -577,19 +578,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: countDocuments object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -629,17 +630,17 @@ tests: failCommands: [count] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: estimatedDocumentCount object: *collection - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: count @@ -679,20 +680,20 @@ tests: failCommands: [distinct] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: distinct object: *collection arguments: fieldName: x filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: distinct @@ -732,19 +733,19 @@ tests: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: find object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: find @@ -784,19 +785,19 @@ tests: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOne object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: find @@ -836,17 +837,17 @@ tests: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listIndexes object: *collection - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listIndexes @@ -886,17 +887,17 @@ tests: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: listIndexNames object: *collection - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: listIndexes @@ -936,19 +937,19 @@ tests: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createChangeStream object: *collection arguments: pipeline: [] - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: aggregate @@ -988,19 +989,19 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: insertOne object: *collection arguments: document: { _id: 2, x: 22 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: insert @@ -1040,20 +1041,20 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: insertMany object: *collection arguments: documents: - { _id: 2, x: 22 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: insert @@ -1093,19 +1094,19 @@ tests: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: deleteOne object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: delete @@ -1145,19 +1146,19 @@ tests: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: deleteMany object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: delete @@ -1197,20 +1198,20 @@ tests: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: replaceOne object: *collection arguments: filter: {} replacement: { x: 22 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: update @@ -1250,20 +1251,20 @@ tests: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: updateOne object: *collection arguments: filter: {} update: { $set: { x: 22 } } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: update @@ -1303,20 +1304,20 @@ tests: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: updateMany object: *collection arguments: filter: {} update: { $set: { x: 22 } } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: update @@ -1356,19 +1357,19 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndDelete object: *collection arguments: filter: {} - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: findAndModify @@ -1408,20 +1409,20 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndReplace object: *collection arguments: filter: {} replacement: { x: 22 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: findAndModify @@ -1461,20 +1462,20 @@ tests: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: findOneAndUpdate object: *collection arguments: filter: {} update: { $set: { x: 22 } } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: findAndModify @@ -1514,21 +1515,21 @@ tests: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: bulkWrite object: *collection arguments: requests: - insertOne: document: { _id: 2, x: 22 } - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: insert @@ -1568,20 +1569,20 @@ tests: failCommands: [createIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: createIndex object: *collection arguments: keys: { x: 11 } name: "x_11" - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: createIndexes @@ -1621,19 +1622,19 @@ tests: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: dropIndex object: *collection arguments: name: "x_11" - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: dropIndexes @@ -1673,17 +1674,17 @@ tests: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - + - name: dropIndexes object: *collection - expectError: + expectError: isError: true isClientError: false expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: + # we expect 6 pairs of command started and succeeded events: # 1 initial attempt and 5 retries. - commandStartedEvent: commandName: dropIndexes @@ -1709,3 +1710,55 @@ tests: commandName: dropIndexes - commandFailedEvent: commandName: dropIndexes + + - description: 'collection.aggregate write retries at most maxAttempts=5 times' + operations: + - name: failPoint + object: testRunner + arguments: + client: *fail_point_client + failPoint: + configureFailPoint: failCommand + mode: alwaysOn + data: + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: aggregate + object: *collection + arguments: + pipeline: [{$out: "output"}] + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client + events: + # we expect 6 pairs of command started and succeeded events: + # 1 initial attempt and 5 retries. + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate + - commandStartedEvent: + commandName: aggregate + - commandFailedEvent: + commandName: aggregate