diff --git a/source/client-backpressure/tests/backpressure-retry-loop.json b/source/client-backpressure/tests/backpressure-retry-loop.json index 6e64bfe619..f3717ca184 100644 --- a/source/client-backpressure/tests/backpressure-retry-loop.json +++ b/source/client-backpressure/tests/backpressure-retry-loop.json @@ -59,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": [ @@ -154,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": [ @@ -233,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": [ @@ -315,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": [ @@ -412,6 +639,77 @@ } ] }, + { + "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 retries using operation loop", "operations": [ @@ -502,7 +800,7 @@ ] }, { - "description": "database.listCollections retries using operation loop", + "description": "database.aggregate (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -512,11 +810,74 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "listCollections" + "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": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "listCollections" ], "errorLabels": [ "RetryableError", @@ -583,6 +944,62 @@ } ] }, + { + "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": [ @@ -665,6 +1082,62 @@ } ] }, + { + "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": [ @@ -751,7 +1224,7 @@ ] }, { - "description": "database.createChangeStream retries using operation loop", + "description": "database.runCommand (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -761,11 +1234,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "aggregate" + "ping" ], "errorLabels": [ "RetryableError", @@ -777,55 +1250,91 @@ } }, { - "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" + "commandName": "ping" } }, { "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "ping" } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" + } + ] + } + ] + }, + { + "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" } } ] @@ -833,7 +1342,7 @@ ] }, { - "description": "collection.aggregate retries using operation loop", + "description": "database.createChangeStream retries using operation loop", "operations": [ { "name": "failPoint", @@ -859,8 +1368,8 @@ } }, { - "name": "aggregate", - "object": "collection", + "name": "createChangeStream", + "object": "database", "arguments": { "pipeline": [] } @@ -915,7 +1424,7 @@ ] }, { - "description": "collection.countDocuments retries using operation loop", + "description": "database.createChangeStream (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -925,7 +1434,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ @@ -941,16 +1450,20 @@ } }, { - "name": "countDocuments", - "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": { @@ -961,43 +1474,13 @@ "commandFailedEvent": { "commandName": "aggregate" } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } } ] } ] }, { - "description": "collection.estimatedDocumentCount retries using operation loop", + "description": "collection.aggregate retries using operation loop", "operations": [ { "name": "failPoint", @@ -1011,7 +1494,7 @@ }, "data": { "failCommands": [ - "count" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1023,8 +1506,11 @@ } }, { - "name": "estimatedDocumentCount", - "object": "collection" + "name": "aggregate", + "object": "collection", + "arguments": { + "pipeline": [] + } } ], "expectEvents": [ @@ -1033,42 +1519,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "count" + "commandName": "aggregate" } }, { "commandSucceededEvent": { - "commandName": "count" + "commandName": "aggregate" } } ] @@ -1076,7 +1562,7 @@ ] }, { - "description": "collection.distinct retries using operation loop", + "description": "collection.aggregate (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1086,11 +1572,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "distinct" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1102,56 +1588,29 @@ } }, { - "name": "distinct", - "object": "collection", + "name": "aggregate", + "object": "collection_retryReads_false", "arguments": { - "fieldName": "x", - "filter": {} + "pipeline": [] + }, + "expectError": { + "isError": true, + "isClientError": false } } ], "expectEvents": [ { - "client": "client", + "client": "client_retryReads_false", "events": [ { "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandSucceededEvent": { - "commandName": "distinct" + "commandName": "aggregate" } } ] @@ -1159,7 +1618,7 @@ ] }, { - "description": "collection.find retries using operation loop", + "description": "collection.countDocuments retries using operation loop", "operations": [ { "name": "failPoint", @@ -1173,7 +1632,7 @@ }, "data": { "failCommands": [ - "find" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1185,7 +1644,7 @@ } }, { - "name": "find", + "name": "countDocuments", "object": "collection", "arguments": { "filter": {} @@ -1198,42 +1657,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" } } ] @@ -1241,7 +1700,7 @@ ] }, { - "description": "collection.findOne retries using operation loop", + "description": "collection.countDocuments (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1251,11 +1710,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "find" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -1267,55 +1726,29 @@ } }, { - "name": "findOne", - "object": "collection", + "name": "countDocuments", + "object": "collection_retryReads_false", "arguments": { "filter": {} + }, + "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" } } ] @@ -1323,7 +1756,7 @@ ] }, { - "description": "collection.listIndexes retries using operation loop", + "description": "collection.estimatedDocumentCount retries using operation loop", "operations": [ { "name": "failPoint", @@ -1337,7 +1770,7 @@ }, "data": { "failCommands": [ - "listIndexes" + "count" ], "errorLabels": [ "RetryableError", @@ -1349,7 +1782,7 @@ } }, { - "name": "listIndexes", + "name": "estimatedDocumentCount", "object": "collection" } ], @@ -1359,42 +1792,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandFailedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandStartedEvent": { - "commandName": "listIndexes" + "commandName": "count" } }, { "commandSucceededEvent": { - "commandName": "listIndexes" + "commandName": "count" } } ] @@ -1402,7 +1835,7 @@ ] }, { - "description": "collection.listIndexNames retries using operation loop", + "description": "collection.estimatedDocumentCount (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1412,11 +1845,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "listIndexes" + "count" ], "errorLabels": [ "RetryableError", @@ -1428,52 +1861,26 @@ } }, { - "name": "listIndexNames", - "object": "collection" + "name": "estimatedDocumentCount", + "object": "collection_retryReads_false", + "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": "count" } }, { "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" + "commandName": "count" } } ] @@ -1481,7 +1888,7 @@ ] }, { - "description": "collection.createChangeStream retries using operation loop", + "description": "collection.distinct retries using operation loop", "operations": [ { "name": "failPoint", @@ -1495,7 +1902,7 @@ }, "data": { "failCommands": [ - "aggregate" + "distinct" ], "errorLabels": [ "RetryableError", @@ -1507,10 +1914,11 @@ } }, { - "name": "createChangeStream", + "name": "distinct", "object": "collection", "arguments": { - "pipeline": [] + "fieldName": "x", + "filter": {} } } ], @@ -1520,42 +1928,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandFailedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandStartedEvent": { - "commandName": "aggregate" + "commandName": "distinct" } }, { "commandSucceededEvent": { - "commandName": "aggregate" + "commandName": "distinct" } } ] @@ -1563,7 +1971,7 @@ ] }, { - "description": "collection.insertOne retries using operation loop", + "description": "collection.distinct (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1573,11 +1981,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "insert" + "distinct" ], "errorLabels": [ "RetryableError", @@ -1589,58 +1997,30 @@ } }, { - "name": "insertOne", - "object": "collection", + "name": "distinct", + "object": "collection_retryReads_false", "arguments": { - "document": { - "_id": 2, - "x": 22 - } + "fieldName": "x", + "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": "distinct" } }, { "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" + "commandName": "distinct" } } ] @@ -1648,7 +2028,7 @@ ] }, { - "description": "collection.insertMany retries using operation loop", + "description": "collection.find retries using operation loop", "operations": [ { "name": "failPoint", @@ -1662,7 +2042,7 @@ }, "data": { "failCommands": [ - "insert" + "find" ], "errorLabels": [ "RetryableError", @@ -1674,15 +2054,10 @@ } }, { - "name": "insertMany", + "name": "find", "object": "collection", "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] + "filter": {} } } ], @@ -1692,42 +2067,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "insert" + "commandName": "find" } }, { "commandSucceededEvent": { - "commandName": "insert" + "commandName": "find" } } ] @@ -1735,7 +2110,7 @@ ] }, { - "description": "collection.deleteOne retries using operation loop", + "description": "collection.find (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1745,11 +2120,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "delete" + "find" ], "errorLabels": [ "RetryableError", @@ -1761,55 +2136,29 @@ } }, { - "name": "deleteOne", - "object": "collection", + "name": "find", + "object": "collection_retryReads_false", "arguments": { "filter": {} + }, + "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": "find" } }, { "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" + "commandName": "find" } } ] @@ -1817,7 +2166,7 @@ ] }, { - "description": "collection.deleteMany retries using operation loop", + "description": "collection.findOne retries using operation loop", "operations": [ { "name": "failPoint", @@ -1831,7 +2180,7 @@ }, "data": { "failCommands": [ - "delete" + "find" ], "errorLabels": [ "RetryableError", @@ -1843,7 +2192,7 @@ } }, { - "name": "deleteMany", + "name": "findOne", "object": "collection", "arguments": { "filter": {} @@ -1856,42 +2205,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandFailedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandStartedEvent": { - "commandName": "delete" + "commandName": "find" } }, { "commandSucceededEvent": { - "commandName": "delete" + "commandName": "find" } } ] @@ -1899,7 +2248,7 @@ ] }, { - "description": "collection.replaceOne retries using operation loop", + "description": "collection.findOne (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -1909,11 +2258,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "update" + "find" ], "errorLabels": [ "RetryableError", @@ -1925,58 +2274,29 @@ } }, { - "name": "replaceOne", - "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": "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" } } ] @@ -1984,7 +2304,7 @@ ] }, { - "description": "collection.updateOne retries using operation loop", + "description": "collection.listIndexes retries using operation loop", "operations": [ { "name": "failPoint", @@ -1998,7 +2318,7 @@ }, "data": { "failCommands": [ - "update" + "listIndexes" ], "errorLabels": [ "RetryableError", @@ -2010,16 +2330,8 @@ } }, { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } + "name": "listIndexes", + "object": "collection" } ], "expectEvents": [ @@ -2028,42 +2340,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "update" + "commandName": "listIndexes" } }, { "commandSucceededEvent": { - "commandName": "update" + "commandName": "listIndexes" } } ] @@ -2071,7 +2383,7 @@ ] }, { - "description": "collection.updateMany retries using operation loop", + "description": "collection.listIndexes (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -2081,11 +2393,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "update" + "listIndexes" ], "errorLabels": [ "RetryableError", @@ -2097,60 +2409,26 @@ } }, { - "name": "updateMany", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } + "name": "listIndexes", + "object": "collection_retryReads_false", + "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": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" + "commandName": "listIndexes" } } ] @@ -2158,7 +2436,7 @@ ] }, { - "description": "collection.findOneAndDelete retries using operation loop", + "description": "collection.listIndexNames retries using operation loop", "operations": [ { "name": "failPoint", @@ -2172,7 +2450,7 @@ }, "data": { "failCommands": [ - "findAndModify" + "listIndexes" ], "errorLabels": [ "RetryableError", @@ -2184,11 +2462,8 @@ } }, { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } + "name": "listIndexNames", + "object": "collection" } ], "expectEvents": [ @@ -2197,42 +2472,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } }, { "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } } ] @@ -2240,7 +2515,7 @@ ] }, { - "description": "collection.findOneAndReplace retries using operation loop", + "description": "collection.listIndexNames (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -2250,11 +2525,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "findAndModify" + "listIndexes" ], "errorLabels": [ "RetryableError", @@ -2266,58 +2541,26 @@ } }, { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } + "name": "listIndexNames", + "object": "collection_retryReads_false", + "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": "listIndexes" } }, { "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "listIndexes" } } ] @@ -2325,7 +2568,7 @@ ] }, { - "description": "collection.findOneAndUpdate retries using operation loop", + "description": "collection.createChangeStream retries using operation loop", "operations": [ { "name": "failPoint", @@ -2339,7 +2582,7 @@ }, "data": { "failCommands": [ - "findAndModify" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -2351,15 +2594,10 @@ } }, { - "name": "findOneAndUpdate", + "name": "createChangeStream", "object": "collection", "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } + "pipeline": [] } } ], @@ -2369,42 +2607,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandFailedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandStartedEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } }, { "commandSucceededEvent": { - "commandName": "findAndModify" + "commandName": "aggregate" } } ] @@ -2412,7 +2650,7 @@ ] }, { - "description": "collection.bulkWrite retries using operation loop", + "description": "collection.createChangeStream (read) does not retry if retryReads=false", "operations": [ { "name": "failPoint", @@ -2422,11 +2660,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "insert" + "aggregate" ], "errorLabels": [ "RetryableError", @@ -2438,64 +2676,29 @@ } }, { - "name": "bulkWrite", - "object": "collection", + "name": "createChangeStream", + "object": "collection_retryReads_false", "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] + "pipeline": [] + }, + "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" } } ] @@ -2503,7 +2706,7 @@ ] }, { - "description": "collection.createIndex retries using operation loop", + "description": "collection.insertOne retries using operation loop", "operations": [ { "name": "failPoint", @@ -2517,7 +2720,7 @@ }, "data": { "failCommands": [ - "createIndexes" + "insert" ], "errorLabels": [ "RetryableError", @@ -2529,13 +2732,13 @@ } }, { - "name": "createIndex", + "name": "insertOne", "object": "collection", "arguments": { - "keys": { - "x": 11 - }, - "name": "x_11" + "document": { + "_id": 2, + "x": 22 + } } } ], @@ -2545,42 +2748,42 @@ "events": [ { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandFailedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandStartedEvent": { - "commandName": "createIndexes" + "commandName": "insert" } }, { "commandSucceededEvent": { - "commandName": "createIndexes" + "commandName": "insert" } } ] @@ -2588,18 +2791,8 @@ ] }, { - "description": "collection.dropIndex retries using operation loop", + "description": "collection.insertOne (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", @@ -2608,11 +2801,11 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 1 }, "data": { "failCommands": [ - "dropIndexes" + "insert" ], "errorLabels": [ "RetryableError", @@ -2624,55 +2817,32 @@ } }, { - "name": "dropIndex", - "object": "collection", + "name": "insertOne", + "object": "collection_retryWrites_false", "arguments": { - "name": "x_11" + "document": { + "_id": 2, + "x": 22 + } + }, + "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": "insert" } }, { "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "dropIndexes" + "commandName": "insert" } } ] @@ -2680,7 +2850,7 @@ ] }, { - "description": "collection.dropIndexes retries using operation loop", + "description": "collection.insertMany retries using operation loop", "operations": [ { "name": "failPoint", @@ -2694,7 +2864,7 @@ }, "data": { "failCommands": [ - "dropIndexes" + "insert" ], "errorLabels": [ "RetryableError", @@ -2706,10 +2876,1762 @@ } }, { - "name": "dropIndexes", - "object": "collection" - } - ], + "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": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandFailedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "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": [ + { + "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" + } + } + ] + } + ] + }, + { + "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", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "dropIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "dropIndex", + "object": "collection", + "arguments": { + "name": "x_11" + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandFailedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandStartedEvent": { + "commandName": "dropIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "dropIndexes" + } + } + ] + } + ] + }, + { + "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", + "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": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "internal_client", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 3 + }, + "data": { + "failCommands": [ + "dropIndexes" + ], + "errorLabels": [ + "RetryableError", + "SystemOverloadedError" + ], + "errorCode": 2 + } + } + } + }, + { + "name": "dropIndexes", + "object": "collection" + } + ], "expectEvents": [ { "client": "client", @@ -2757,6 +4679,205 @@ ] } ] + }, + { + "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 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/source/client-backpressure/tests/backpressure-retry-loop.yml b/source/client-backpressure/tests/backpressure-retry-loop.yml index cbe43b416d..d29e17d707 100644 --- a/source/client-backpressure/tests/backpressure-retry-loop.yml +++ b/source/client-backpressure/tests/backpressure-retry-loop.yml @@ -39,6 +39,42 @@ createEntities: 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 @@ -86,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: @@ -123,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: @@ -162,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: @@ -206,6 +330,41 @@ 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' operations: @@ -245,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: @@ -284,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: @@ -323,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: @@ -363,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 @@ -372,38 +620,29 @@ 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 - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate + commandName: ping - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandSucceededEvent: - commandName: aggregate - - - description: 'collection.aggregate retries using operation loop' + commandName: ping + - description: 'database.runCommand (write) does not retry if retryWrites=false' operations: - name: failPoint object: testRunner @@ -411,38 +650,31 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 1 } data: - failCommands: [aggregate] + failCommands: [ping] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - name: aggregate - object: *collection + - name: runCommand + object: *database_retryWrites_false arguments: - pipeline: [] + command: { ping: 1 } + commandName: ping + expectError: + isError: true + isClientError: false expectEvents: - - client: *client + - client: *client_retryWrites_false events: - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate + commandName: ping - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandSucceededEvent: - commandName: aggregate + commandName: ping - - description: 'collection.countDocuments retries using operation loop' + + - description: 'database.createChangeStream retries using operation loop' operations: - name: failPoint object: testRunner @@ -456,10 +688,10 @@ tests: errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - name: countDocuments - object: *collection + - name: createChangeStream + object: *database arguments: - filter: {} + pipeline: [] expectEvents: - client: *client @@ -480,8 +712,7 @@ tests: commandName: aggregate - commandSucceededEvent: commandName: aggregate - - - description: 'collection.estimatedDocumentCount retries using operation loop' + - description: 'database.createChangeStream (read) does not retry if retryReads=false' operations: - name: failPoint object: testRunner @@ -489,9 +720,178 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 1 } data: - failCommands: [count] + failCommands: [aggregate] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - 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 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: + 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 (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: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 3 } + data: + failCommands: [count] errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 @@ -517,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: @@ -557,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: @@ -596,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: @@ -635,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: @@ -672,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: @@ -709,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: @@ -748,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: @@ -787,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: @@ -827,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: @@ -866,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: @@ -905,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: @@ -941,12 +1667,114 @@ tests: commandName: update - commandFailedEvent: commandName: update - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - 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.updateOne retries using operation loop' + + - description: 'collection.updateMany retries using operation loop' operations: - name: failPoint object: testRunner @@ -960,7 +1788,7 @@ tests: errorLabels: [RetryableError, SystemOverloadedError] errorCode: 2 - - name: updateOne + - name: updateMany object: *collection arguments: filter: {} @@ -985,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 @@ -994,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: @@ -1064,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: @@ -1104,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: @@ -1144,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: @@ -1185,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: @@ -1225,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: @@ -1269,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: @@ -1306,3 +2315,100 @@ 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 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/source/client-backpressure/tests/backpressure-retry-loop.yml.template b/source/client-backpressure/tests/backpressure-retry-loop.yml.template index f810ff7020..6d807b1a5d 100644 --- a/source/client-backpressure/tests/backpressure-retry-loop.yml.template +++ b/source/client-backpressure/tests/backpressure-retry-loop.yml.template @@ -39,6 +39,42 @@ createEntities: 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 @@ -99,4 +135,86 @@ tests: {% for operation in operations %} commandName: {{operation.command_name}} - commandSucceededEvent: commandName: {{operation.command_name}} + + {%- if operation.operation_type == 'read' or operation.operation_name == "runCommand" %} + - description: '{{operation.object}}.{{operation.operation_name}} (read) does not retry if retryReads=false' + operations: + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [{{operation.command_name}}] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: {{operation.operation_name}} + object: *{{operation.object}}_retryReads_false + {%- if operation.arguments|length > 0 %} + arguments: + {%- for arg in operation.arguments %} + {{arg}} + {%- endfor -%} + {%- endif %} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryReads_false + events: + - commandStartedEvent: + commandName: {{operation.command_name}} + - commandFailedEvent: + commandName: {{operation.command_name}} + {%- endif %} + + {%- if operation.operation_type == 'write' or operation.operation_name == "runCommand" %} + - description: '{{operation.object}}.{{operation.operation_name}} (write) does not retry if retryWrites=false' {%- if ((operation.operation_name == 'clientBulkWrite')) %} + runOnRequirements: + - minServerVersion: '8.0' # client bulk write added to server in 8.0 + {%- endif %} + operations: {%- if operation.operation_name == "dropIndex" %} + - name: createIndex + object: *internal_collection + arguments: + keys: { x: 11 } + name: "x_11" + {%- endif %} + - name: failPoint + object: testRunner + arguments: + client: *internal_client + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [{{operation.command_name}}] + errorLabels: [RetryableError, SystemOverloadedError] + errorCode: 2 + + - name: {{operation.operation_name}} + object: *{{operation.object}}_retryWrites_false + {%- if operation.arguments|length > 0 %} + arguments: + {%- for arg in operation.arguments %} + {{arg}} + {%- endfor -%} + {%- endif %} + expectError: + isError: true + isClientError: false + + expectEvents: + - client: *client_retryWrites_false + events: + - commandStartedEvent: + commandName: {{operation.command_name}} + - commandFailedEvent: + commandName: {{operation.command_name}} + {%- endif %} + {% endfor -%} diff --git a/source/client-backpressure/tests/backpressure-retry-max-attempts.json b/source/client-backpressure/tests/backpressure-retry-max-attempts.json index 37b610b857..1e6f46f076 100644 --- a/source/client-backpressure/tests/backpressure-retry-max-attempts.json +++ b/source/client-backpressure/tests/backpressure-retry-max-attempts.json @@ -3446,6 +3446,114 @@ ] } ] + }, + { + "description": "collection.aggregate 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/source/client-backpressure/tests/backpressure-retry-max-attempts.yml b/source/client-backpressure/tests/backpressure-retry-max-attempts.yml index 5ad5ec0b37..1cfabda6fd 100644 --- a/source/client-backpressure/tests/backpressure-retry-max-attempts.yml +++ b/source/client-backpressure/tests/backpressure-retry-max-attempts.yml @@ -1710,3 +1710,55 @@ tests: commandName: dropIndexes - commandFailedEvent: commandName: dropIndexes + + - description: 'collection.aggregate 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 diff --git a/source/etc/generate-backpressure-retryability-tests.py b/source/etc/generate-backpressure-retryability-tests.py index 3d8d914e1f..342ff80f3e 100644 --- a/source/etc/generate-backpressure-retryability-tests.py +++ b/source/etc/generate-backpressure-retryability-tests.py @@ -1,10 +1,9 @@ from collections import namedtuple from jinja2 import Template import os -import sys Operation = namedtuple( - 'Operation', ['operation_name', 'command_name', 'object', 'arguments']) + 'Operation', ['operation_name', 'command_name', 'object', 'arguments', 'operation_type']) CLIENT_BULK_WRITE_ARGUMENTS = '''models: - insertOne: @@ -12,10 +11,10 @@ document: { _id: 8, x: 88 }''' CLIENT_OPERATIONS = [ - Operation('listDatabases', 'listDatabases', 'client', ['filter: {}']), - Operation('listDatabaseNames', 'listDatabases', 'client', []), - Operation('createChangeStream', 'aggregate', 'client', ['pipeline: []']), - Operation('clientBulkWrite', 'bulkWrite', 'client', [CLIENT_BULK_WRITE_ARGUMENTS]) + Operation('listDatabases', 'listDatabases', 'client', ['filter: {}'], 'read'), + Operation('listDatabaseNames', 'listDatabases', 'client', [], 'read'), + Operation('createChangeStream', 'aggregate', 'client', ['pipeline: []'], 'read'), + Operation('clientBulkWrite', 'bulkWrite', 'client', [CLIENT_BULK_WRITE_ARGUMENTS], 'write') ] RUN_COMMAND_ARGUMENTS = '''command: { ping: 1 } @@ -23,13 +22,13 @@ DB_OPERATIONS = [ Operation('aggregate', 'aggregate', 'database', [ - 'pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ]']), + 'pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ]'], 'read'), Operation('listCollections', 'listCollections', - 'database', ['filter: {}']), + 'database', ['filter: {}'], 'read'), Operation('listCollectionNames', 'listCollections', - 'database', ['filter: {}']), # Optional. - Operation('runCommand', 'ping', 'database', [RUN_COMMAND_ARGUMENTS]), - Operation('createChangeStream', 'aggregate', 'database', ['pipeline: []']) + 'database', ['filter: {}'], 'read'), # Optional. + Operation('runCommand', 'ping', 'database', [RUN_COMMAND_ARGUMENTS], 'read'), + Operation('createChangeStream', 'aggregate', 'database', ['pipeline: []'], 'read') ] INSERT_MANY_ARGUMENTS = '''documents: @@ -40,43 +39,44 @@ document: { _id: 2, x: 22 }''' COLLECTION_READ_OPERATIONS = [ - Operation('aggregate', 'aggregate', 'collection', ['pipeline: []']), - # Operation('count', 'count', 'collection', ['filter: {}']), # Deprecated. - Operation('countDocuments', 'aggregate', 'collection', ['filter: {}']), - Operation('estimatedDocumentCount', 'count', 'collection', []), + Operation('aggregate', 'aggregate', 'collection', ['pipeline: []'], 'read'), + # Operation('count', 'count', 'collection', ['filter: {}'], 'read'), # Deprecated. + Operation('countDocuments', 'aggregate', 'collection', ['filter: {}'], 'read'), + Operation('estimatedDocumentCount', 'count', 'collection', [], 'read'), Operation('distinct', 'distinct', 'collection', - ['fieldName: x', 'filter: {}']), - Operation('find', 'find', 'collection', ['filter: {}']), - Operation('findOne', 'find', 'collection', ['filter: {}']), # Optional. - Operation('listIndexes', 'listIndexes', 'collection', []), - Operation('listIndexNames', 'listIndexes', 'collection', []), # Optional. + ['fieldName: x', 'filter: {}'], 'read'), + Operation('find', 'find', 'collection', ['filter: {}'], 'read'), + Operation('findOne', 'find', 'collection', ['filter: {}'], 'read'), # Optional. + Operation('listIndexes', 'listIndexes', 'collection', [], 'read'), + Operation('listIndexNames', 'listIndexes', 'collection', [], 'read'), # Optional. Operation('createChangeStream', 'aggregate', - 'collection', ['pipeline: []']), + 'collection', ['pipeline: []'], 'read'), ] COLLECTION_WRITE_OPERATIONS = [ Operation('insertOne', 'insert', 'collection', - ['document: { _id: 2, x: 22 }']), - Operation('insertMany', 'insert', 'collection', [INSERT_MANY_ARGUMENTS]), - Operation('deleteOne', 'delete', 'collection', ['filter: {}']), - Operation('deleteMany', 'delete', 'collection', ['filter: {}']), + ['document: { _id: 2, x: 22 }'], 'write'), + Operation('insertMany', 'insert', 'collection', [INSERT_MANY_ARGUMENTS], 'write'), + Operation('deleteOne', 'delete', 'collection', ['filter: {}'], 'write'), + Operation('deleteMany', 'delete', 'collection', ['filter: {}'], 'write'), Operation('replaceOne', 'update', 'collection', [ - 'filter: {}', 'replacement: { x: 22 }']), + 'filter: {}', 'replacement: { x: 22 }'], 'write'), Operation('updateOne', 'update', 'collection', [ - 'filter: {}', 'update: { $set: { x: 22 } }']), + 'filter: {}', 'update: { $set: { x: 22 } }'], 'write'), Operation('updateMany', 'update', 'collection', [ - 'filter: {}', 'update: { $set: { x: 22 } }']), + 'filter: {}', 'update: { $set: { x: 22 } }'], 'write'), Operation('findOneAndDelete', 'findAndModify', - 'collection', ['filter: {}']), + 'collection', ['filter: {}'], 'write'), Operation('findOneAndReplace', 'findAndModify', 'collection', - ['filter: {}', 'replacement: { x: 22 }']), + ['filter: {}', 'replacement: { x: 22 }'], 'write'), Operation('findOneAndUpdate', 'findAndModify', 'collection', - ['filter: {}', 'update: { $set: { x: 22 } }']), - Operation('bulkWrite', 'insert', 'collection', [BULK_WRITE_ARGUMENTS]), + ['filter: {}', 'update: { $set: { x: 22 } }'], 'write'), + Operation('bulkWrite', 'insert', 'collection', [BULK_WRITE_ARGUMENTS], 'write'), Operation('createIndex', 'createIndexes', 'collection', - ['keys: { x: 11 }', 'name: "x_11"']), - Operation('dropIndex', 'dropIndexes', 'collection', ['name: "x_11"']), - Operation('dropIndexes', 'dropIndexes', 'collection', []), + ['keys: { x: 11 }', 'name: "x_11"'], 'write'), + Operation('dropIndex', 'dropIndexes', 'collection', ['name: "x_11"'], 'write'), + Operation('dropIndexes', 'dropIndexes', 'collection', [], 'write'), + Operation('aggregate', 'aggregate', 'collection', ['pipeline: [{$out: "output"}]'], 'write'), ] COLLECTION_OPERATIONS = COLLECTION_READ_OPERATIONS + COLLECTION_WRITE_OPERATIONS @@ -122,4 +122,4 @@ def generate_max_attempts_tests(): tests_dir, OPERATIONS) generate_retry_loop_tests() -generate_max_attempts_tests() \ No newline at end of file +generate_max_attempts_tests()