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

Better error messaging when attempting to add a shard with the same name or members as an existing shard

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.6
    • Component/s: Sharding
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Sharding 10 (02/19/16), Sharding 11 (03/11/16), Sharding 12 (04/01/16), Sharding 13 (04/22/16), Sharding 14 (05/13/16)

      Description

      Currently when you try to add a shard with the same name as an existing shard you get a duplicate key error, and if you try to add a shard with the same host(s) as an existing shard you get a not master error

      sh.status()
      --- Sharding Status --- 
        sharding version: {
      	"_id" : 1,
      	"minCompatibleVersion" : 5,
      	"currentVersion" : 6,
      	"clusterId" : ObjectId("55dcf519b004ad14bc014bef")
      }
        shards:
      	{  "_id" : "rs1",  "host" : "rs1/ubuntu:20001,ubuntu:20002,ubuntu:20003" }
      	{  "_id" : "rs2",  "host" : "rs2/ubuntu:30001,ubuntu:30002,ubuntu:30003",  "draining" : true }
        balancer:
      	Currently enabled:  yes
      	Currently running:  yes
      		Balancer lock taken at Thu Sep 03 2015 18:20:26 GMT-0400 (EDT) by ubuntu:27017:1441318568:1804289383:Balancer:846930886
      	Failed balancer rounds in last 5 attempts:  0
      	Migration Results for the last 24 hours: 
      		No recent migrations
        databases:
      	{  "_id" : "temp",  "primary" : "rs1",  "partitioned" : false }
      	{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
       
      mongos> sh.addShard('rs1/ubuntu:20001')
      {
      	"ok" : 0,
      	"errmsg" : "E11000 duplicate key error collection: config.shards index: _id_ dup key: { : \"rs1\" }",
      	"code" : 11000
      }
      mongos> sh.addShard('rs3/ubuntu:20001')
      { "ok" : 0, "errmsg" : "No master found for set rs3", "code" : 10107 }
      

        Attachments

          Activity

            People

            Assignee:
            dianna.hohensee Dianna Hohensee
            Reporter:
            spencer Spencer Brody (Inactive)
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: