summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/override_methods/continuous_stepdown.js16
-rw-r--r--jstests/libs/retry_on_network_error.js22
2 files changed, 5 insertions, 33 deletions
diff --git a/jstests/libs/override_methods/continuous_stepdown.js b/jstests/libs/override_methods/continuous_stepdown.js
index c2c14753420..93ca12d79eb 100644
--- a/jstests/libs/override_methods/continuous_stepdown.js
+++ b/jstests/libs/override_methods/continuous_stepdown.js
@@ -27,9 +27,8 @@ let ContinuousStepdown;
(function() {
"use strict";
- load("jstests/libs/parallelTester.js"); // ScopedThread and CountDownLatch
- load("jstests/libs/retry_on_network_error.js"); // retryOnNetworkError
- load("jstests/replsets/rslib.js"); // reconfig
+ load("jstests/libs/parallelTester.js"); // ScopedThread and CountDownLatch
+ load("jstests/replsets/rslib.js"); // reconfig
/**
* Helper class to manage the ScopedThread instance that will continuously step down the primary
@@ -63,19 +62,14 @@ let ContinuousStepdown;
function _continuousPrimaryStepdownFn(stopCounter, seedNode, options) {
"use strict";
- load("jstests/libs/retry_on_network_error.js");
-
print("*** Continuous stepdown thread running with seed node " + seedNode);
try {
// The config primary may unexpectedly step down during startup if under heavy
// load and too slowly processing heartbeats. When it steps down, it closes all of
- // its connections. This can happen during the call to new ReplSetTest, so in order
- // to account for this and make the tests stable, retry discovery of the replica
- // set's configuration once (SERVER-22794).
- const replSet = retryOnNetworkError(function() {
- return new ReplSetTest(seedNode);
- });
+ // its connections. ReplSetTest will therefore retry discovery of the replica set's
+ // config.
+ const replSet = new ReplSetTest(seedNode);
let primary = replSet.getPrimary();
diff --git a/jstests/libs/retry_on_network_error.js b/jstests/libs/retry_on_network_error.js
deleted file mode 100644
index ab341818167..00000000000
--- a/jstests/libs/retry_on_network_error.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Executes the specified function and if it fails due to exception, which is related to network
- * error retries the call once. If the second attempt also fails, simply throws the last
- * exception.
- *
- * Returns the return value of the input call.
- */
-function retryOnNetworkError(func, numRetries = 1) {
- while (true) {
- try {
- return func();
- } catch (e) {
- if (isNetworkError(e) && numRetries > 0) {
- print("Network error occurred and the call will be retried: " +
- tojson({error: e.toString(), stack: e.stack}));
- numRetries--;
- } else {
- throw e;
- }
- }
- }
-}