diff --git a/db/repl/replset_commands.cpp b/db/repl/replset_commands.cpp index 68dab7eb3c1..456a4692e1b 100644 --- a/db/repl/replset_commands.cpp +++ b/db/repl/replset_commands.cpp @@ -200,6 +200,11 @@ namespace mongo { log() << "replSet replSetReconfig exception: " << e.what() << rsLog; throw; } + catch( string& se ) { + log() << "replSet reconfig exception: " << se << rsLog; + errmsg = se; + return false; + } return true; } diff --git a/jstests/replsets/reconfig.js b/jstests/replsets/reconfig.js index b7dca034806..439bb690c83 100644 --- a/jstests/replsets/reconfig.js +++ b/jstests/replsets/reconfig.js @@ -11,13 +11,21 @@ print("initial sync"); master.getDB("foo").bar.insert({X:1}); replTest.awaitReplication(); +print("invalid reconfig"); +var config = master.getDB("local").system.replset.findOne(); +config.version++; +config.members.push({_id : 5, host : "localhost:12345, votes:0"}); +var result = master.adminCommand({replSetReconfig : config}); +printjson(result); +assert.eq(result.ok, 0); + print("stopping 3 & 4"); replTest.stop(3); replTest.stop(4); print("reconfiguring"); master = replTest.getMaster(); -var config = master.getDB("local").system.replset.findOne(); +config = master.getDB("local").system.replset.findOne(); var oldVersion = config.version++; config.members[0].votes = 2; config.members[3].votes = 2;