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

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.6
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
    • Fully Compatible
    • 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)

      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 }
      

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

              Created:
              Updated:
              Resolved: