summaryrefslogtreecommitdiff
path: root/jstests/hooks
diff options
context:
space:
mode:
authorPavi Vetriselvan <pvselvan@umich.edu>2020-05-29 16:16:04 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-04 16:48:20 +0000
commit37ff80f6234137fd314d00e2cd1ff77cde90ce11 (patch)
treeefa8bbdf4dd473038de37586c85a585244a7b6df /jstests/hooks
parentec28479e742b52c4aa036a804820bbe8aa4afd32 (diff)
downloadmongo-37ff80f6234137fd314d00e2cd1ff77cde90ce11.tar.gz
SERVER-48492 reconfig hook should ignore ShutdownInProgress errors
Diffstat (limited to 'jstests/hooks')
-rw-r--r--jstests/hooks/run_reconfig_background.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/hooks/run_reconfig_background.js b/jstests/hooks/run_reconfig_background.js
index 4717a8d4710..1ec21aade3f 100644
--- a/jstests/hooks/run_reconfig_background.js
+++ b/jstests/hooks/run_reconfig_background.js
@@ -78,6 +78,8 @@ function reconfigBackground(primary, numNodes) {
const primaryHostIndex = (cfg, pHost) => cfg.members.findIndex(m => m.host === pHost);
const primaryIndex = primaryHostIndex(config, primary);
jsTestLog("primaryIndex is " + primaryIndex);
+ jsTestLog("primary's config: (configVersion: " + config.version +
+ ", configTerm: " + config.term + ")");
// Calculate the total number of voting nodes in this set so that we make sure we
// always have at least two voting nodes. This is so that the primary can always
@@ -92,7 +94,7 @@ function reconfigBackground(primary, numNodes) {
indexToChange = Random.randInt(numNodes);
}
- jsTestLog("Running reconfig to change votes of node at index" + indexToChange);
+ jsTestLog("Running reconfig to change votes of node at index " + indexToChange);
// Change the priority to correspond to the votes. If the member's current votes field
// is 1, only change it to 0 if there are more than 3 voting members in this set.
@@ -136,6 +138,11 @@ try {
jsTestLog("Ignoring network error" + tojson(e));
} else if (e.message.match(kReplicaSetMonitorError)) {
jsTestLog("Ignoring read preference primary error" + tojson(e));
+ } else if (e.code === ErrorCodes.ShutdownInProgress) {
+ // When a node is being shutdown, it is possible to fail isMaster requests with
+ // ShutdownInProgress. If we encounter this error, ignore it and find a new
+ // primary.
+ jsTestLog("Ignoring ShutdownInProgress error" + tojson(e));
} else {
throw e;
}