From f7c338674e5877db373837e957e7109417617988 Mon Sep 17 00:00:00 2001 From: Judah Schvimer Date: Wed, 18 Jan 2017 11:53:45 -0500 Subject: SERVER-27656 Ensure node 0 is not primary during reconfig in last_vote.js (cherry picked from commit 2ff3efcabb0a43d5d21b3d636caa76efa4df8bd3) --- jstests/replsets/last_vote.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jstests/replsets/last_vote.js b/jstests/replsets/last_vote.js index bbb38bd4af3..5aa6da56d20 100644 --- a/jstests/replsets/last_vote.js +++ b/jstests/replsets/last_vote.js @@ -76,6 +76,15 @@ var term = getLatestOp(rst.getPrimary()).t + 100; jsTestLog("Test that last vote is loaded on startup"); + // We cannot reconfig nodes[0] to have priority 0 if it is currently the primary. + if (rst.getPrimary() === rst.nodes[0]) { + jsTestLog("Stepping down node 0 before reconfig"); + assert.throws(function() { + rst.nodes[0].adminCommand({replSetStepDown: 5, force: true}); + }); + rst.waitForState(rst.nodes[0], ReplSetTest.State.SECONDARY); + } + jsTestLog("Reconfiguring cluster to make node 0 unelectable so it stays SECONDARY on restart"); conf = rst.getReplSetConfigFromNode(); conf.version++; -- cgit v1.2.1