summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2017-01-30 18:52:40 -0500
committerSiyuan Zhou <visualzhou@gmail.com>2017-03-29 19:57:30 -0400
commit06082604a277b7fea1f8618ae300cd85a0628c4e (patch)
tree041484fa6f4393faa7413809f35ad8a33e5d2a67
parent45cc6d20a413d88fc49f6dac257f800fda926be6 (diff)
downloadmongo-06082604a277b7fea1f8618ae300cd85a0628c4e.tar.gz
SERVER-27861 Make the failover in drain.js more reliable
(cherry picked from commit 133dbba8f749d3ac758a5365d504341331b03468)
-rw-r--r--jstests/replsets/drain.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js
index a81d45f1d10..59082255c1d 100644
--- a/jstests/replsets/drain.js
+++ b/jstests/replsets/drain.js
@@ -25,7 +25,6 @@
var primary = replSet.getPrimary();
var secondary = replSet.getSecondary();
- var isPV0 = replSet.getReplSetConfigFromNode().protocolVersion != 1;
// Do an initial insert to prevent the secondary from going into recovery
var numDocuments = 20;
@@ -52,13 +51,12 @@
jsTestLog('Number of operations buffered on secondary since stopping applier: ' +
bufferCountChange);
return bufferCountChange >= numDocuments - 1;
- }, 'secondary did not buffer operations for new inserts on primary', 30000, 1000);
+ }, 'secondary did not buffer operations for new inserts on primary', 300000, 1000);
// Kill primary; secondary will enter drain mode to catch up
primary.getDB("admin").shutdownServer({force: true});
- var electionTimeout = (isPV0 ? 60 : 20) * 1000; // Timeout in milliseconds
- replSet.waitForState(secondary, ReplSetTest.State.PRIMARY, electionTimeout);
+ replSet.waitForState(secondary, ReplSetTest.State.PRIMARY);
// Ensure new primary is not yet writable
jsTestLog('New primary should not be writable yet');
@@ -95,7 +93,7 @@
assert.commandWorked(
secondary.adminCommand({
replSetTest: 1,
- waitForDrainFinish: 5000,
+ waitForDrainFinish: 30000,
}),
'replSetTest waitForDrainFinish should work when draining is allowed to complete');