mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
allow arbiters and passives as seeds SERVER-2547
This commit is contained in:
parent
41631ef969
commit
1c9e34bcd8
@ -10,7 +10,7 @@ config.members[2].priority = 0;
|
||||
|
||||
r.initiate(config);
|
||||
|
||||
var master = r.getMaster().master;
|
||||
var master = r.getMaster();
|
||||
|
||||
var members = config.members.map(function(elem) { return elem.host; });
|
||||
var shardName = "addshard4/"+members.join(",");
|
||||
@ -20,5 +20,21 @@ print("adding shard "+shardName);
|
||||
var result = s.adminCommand({"addshard" : shardName});
|
||||
|
||||
printjson(result);
|
||||
assert.eq(result, true);
|
||||
|
||||
r = new ReplSetTest({name : "addshard42", nodes : 3, startPort : 36000});
|
||||
r.startSet();
|
||||
|
||||
config = r.getReplSetConfig();
|
||||
config.members[2].arbiterOnly = true;
|
||||
|
||||
r.initiate(config);
|
||||
|
||||
master = r.getMaster();
|
||||
|
||||
print("adding shard addshard42");
|
||||
|
||||
result = s.adminCommand({"addshard" : "addshard42/"+config.members[2].host});
|
||||
|
||||
printjson(result);
|
||||
assert.eq(result, true);
|
||||
|
@ -197,6 +197,12 @@ namespace mongo {
|
||||
hostSet.insert( piter.next().String() ); // host:port
|
||||
}
|
||||
}
|
||||
if ( resIsMaster["arbiters"].isABSONObj() ) {
|
||||
BSONObjIterator piter( resIsMaster["arbiters"].Obj() );
|
||||
while ( piter.more() ) {
|
||||
hostSet.insert( piter.next().String() ); // host:port
|
||||
}
|
||||
}
|
||||
|
||||
vector<HostAndPort> hosts = servers.getServers();
|
||||
for ( size_t i = 0 ; i < hosts.size() ; i++ ) {
|
||||
@ -213,7 +219,7 @@ namespace mongo {
|
||||
}
|
||||
if ( ! foundAll ) {
|
||||
ostringstream ss;
|
||||
ss << "host " << offendingHost << " does not belong to replica set as a non-passive member" << setName;;
|
||||
ss << "host " << offendingHost << " does not belong to replica set" << setName;;
|
||||
errMsg = ss.str();
|
||||
newShardConn.done();
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user