Description
When addShard is run to add a replica set, it will fail if the seed list of the connection string includes any replica set members that are hidden. This is due to an (arguably incorrect) sanity check in the implementation of addShard: the addShard command runs isMaster on the primary, and then verifies that every member of the seed list shows up in isMaster. Since hidden members are not returned by isMaster, the sanity check fails.
Reproduce with:
var rsName = "rs";
|
|
|
var replTest = new ReplSetTest({name:rsName, nodes:2, host:'localhost'});
|
replTest.startSet();
|
var config = replTest.getReplSetConfig();
|
config.members[1].hidden = true;
|
config.members[1].priority = 0;
|
var hiddenHost = config.members[1].host;
|
replTest.initiate(config);
|
|
|
var shardingTest = new ShardingTest({shards:1});
|
var mongos = shardingTest.s0;
|
var connString = rsName + "/" + hiddenHost;
|
res = mongos.adminCommand({addShard:connString});
|
assert.eq(res.ok, 1);
|
When the above snippet is run, addShard returns the error "in seed list rs/localhost:31001, host localhost:31001 does not belong to replica set rs".
Attachments
Issue Links
- is depended on by
-
DOCS-2054 Document limitation of addShard command
-
- Closed
-