Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9882

addShard fails if connection string includes hidden member

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.5.0
    • Sharding
    • ALL

    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

        Activity

          People

            Unassigned Unassigned
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: