-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Testing Infrastructure
-
Fully Compatible
-
Sharding 2017-10-02
When a network connection to the mongo shell is closed, attempting to call Mongo.prototype.runCommand() and Mongo.prototype.runCommandWithMetadata() throw a JavaScript exception. We should add a new override in the jstests/libs/override_methods/ directory to catch these exceptions (i.e. ones where isNetworkError() return true) and automatically re-send the command request to the server. The goal of this override is to implement retry logic such that the assertions within our existing JavaScript tests still pass despite stepdowns of the CSRS and replica set shards happening in the background.
The approach for implementing this override can likely be adapted from SessionAwareClient#runClientFunctionWithRetries() with the following changes:
- If the command request is an "insert", "update", "delete", or "findAndModify" command (or a wrapped query/$query object for one of those commands) for which ServerSession#canRetryWrites()) returns true, then the operation should be retried through the existing retryWrites=true logic in SessionAwareClient.
- If the command request is an "insert", "update", or "delete" command (or a wrapped query/$query object for one of those command) for which ServerSession#canRetryWrites() returns false, then an exception should be thrown saying something along the lines of "Cowardly refusing to run a test that issues non-retryable write operations since the test likely makes assertions on the write results and can lead to spurious failures if a network error occurs."
- If the command request is a "getMore", then an exception should be thrown saying something along the lines of "Cowardly refusing to run a test that issues a getMore command since if a network error occurs during it then we won't know whether the cursor was advanced or not."
- is depended on by
-
SERVER-31194 Add a version of retryable_writes_jscore_passthrough.yml with stepdowns
- Closed
- related to
-
SERVER-31355 Increase replica set size and stepdown period and decrease election timeout in auto_retry_on_network_error.js
- Closed