0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

handle invalid host in reconfig SERVER-3798

This commit is contained in:
Kristina 2011-09-14 15:31:03 -04:00
parent 7c46fb9ad3
commit 2b8753551a
2 changed files with 14 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;