From 06082604a277b7fea1f8618ae300cd85a0628c4e Mon Sep 17 00:00:00 2001 From: Siyuan Zhou Date: Mon, 30 Jan 2017 18:52:40 -0500 Subject: SERVER-27861 Make the failover in drain.js more reliable (cherry picked from commit 133dbba8f749d3ac758a5365d504341331b03468) --- jstests/replsets/drain.js | 8 +++----- 1 file 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'); -- cgit v1.2.1