[SERVER-9882] addShard fails if connection string includes hidden member Created: 08/Jun/13  Updated: 12/Oct/15  Resolved: 12/Oct/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.5.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DOCS-2054 Document limitation of addShard command Closed
Duplicate
Related
Operating System: ALL
Participants:

 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".



 Comments   
Comment by Andy Schwerin [ 12/Oct/15 ]

Hidden members are not contacted by mongos, and so don't belong in the connection string. I realize that mongos could discover this on its own, but this behavior is intentional and reasonably logical.

Comment by auto [ 04/Oct/13 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: Revert "SERVER-9882 addShard fails if connection string includes hidden member"

This reverts commit 5e331a573cfd9a860f5afb1e2bb14cad8394f464.
Branch: master
https://github.com/mongodb/mongo/commit/6c68034f641f9f50e10ab68ac660242a53373ec1

Comment by auto [ 18/Jun/13 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-9882 addShard fails if connection string includes hidden member
Branch: master
https://github.com/mongodb/mongo/commit/5e331a573cfd9a860f5afb1e2bb14cad8394f464

Generated at Thu Feb 08 03:21:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.