diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-11-03 10:57:24 -0500 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-11-03 11:29:47 -0500 |
commit | b25a1fb5144000ad6ef6b6eaa3cd07de5f738b21 (patch) | |
tree | 503f82b5dc08c459ae3fe9e5d6aa1923aa4a6899 /jstests/replsets/remove1.js | |
parent | a4bc56e0ed623c46e954e88c4c4cea1356126217 (diff) | |
download | mongo-b25a1fb5144000ad6ef6b6eaa3cd07de5f738b21.tar.gz |
SERVER-21237 fix remove1.js to handle failover that occurs in pv0
Diffstat (limited to 'jstests/replsets/remove1.js')
-rw-r--r-- | jstests/replsets/remove1.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/jstests/replsets/remove1.js b/jstests/replsets/remove1.js index 745cf3de7f0..d47586af6d0 100644 --- a/jstests/replsets/remove1.js +++ b/jstests/replsets/remove1.js @@ -79,12 +79,18 @@ wait(function() { catch(e) { print(e); } - // master will likely step down (and close all connections) sometime after the reconfig if it - // thinks the newly re-added secondary is down. So wait for that then reconnect the connection - // we are using. - master = replTest.getMaster(); - - printjson(master.getDB("admin").runCommand({replSetGetStatus:1})); + try { + master = replTest.getMaster(); + printjson(master.getDB("admin").runCommand({replSetGetStatus:1})); + } catch(e) { + // In PV0 the primary node may step down, which will cause the above to try block will + // throw and we will need to wait for a new master and try again. + if (replTest.getConfigFromPrimary().protocolVersion == 1) { + throw e; + } + master = replTest.getMaster(); + printjson(master.getDB("admin").runCommand({replSetGetStatus:1})); + } master.setSlaveOk(); var newConfig = master.getDB("local").system.replset.findOne(); print( "newConfig: " + tojson(newConfig) ); |