summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2016-02-22 16:39:35 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2016-03-04 13:04:44 -0500
commit1e7fd17ee33d8c7c8e6c49e590c722ff71c7079e (patch)
tree9068118a86c2806cb78f2a9cbd44a7afba9f4506 /jstests
parent6eb09b5e4716e31109bcdebaf9cae157edd80773 (diff)
downloadmongo-1e7fd17ee33d8c7c8e6c49e590c722ff71c7079e.tar.gz
SERVER-22794 fixing network error in continuous step down thread due to unaccounted for primary step down closing connections
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/override_methods/sharding_continuous_config_stepdown.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
index e50a6cd971d..56163dc892d 100644
--- a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
+++ b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
@@ -41,8 +41,31 @@ ReplSetTest = function ReplSetTestWithContinuousPrimaryStepdown() {
print('*** Continuous stepdown thread running with seed node ' + seedNode);
+ // 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).
+ var replSet;
+ var networkErrorRetries = 1;
+ while (networkErrorRetries >= 0) {
+ try {
+ replSet = new ReplSetTest(seedNode);
+ break;
+ } catch (e) {
+ if ( ((networkErrorRetries--) > 0) &&
+ (e.toString().indexOf("network error") > -1) ) {
+ print("Error: " + e.toString() + "\nStacktrace: " + e.stack);
+ print("Stepdown thread's config server connection was closed, retrying.");
+ } else {
+ print('*** Continuous stepdown thread failed to connect to the ' +
+ 'config server: ' + tojson(e));
+ return { ok: 0, error: e.toString(), stack: e.stack };
+ }
+ }
+ }
+
try {
- var replSet = new ReplSetTest(seedNode);
var primary = replSet.getPrimary();
while (stopCounter.getCount() > 0) {