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

Mongos are failing to Calculate Config Difference

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.7
    • Component/s: Sharding
    • Labels:
      None

      Greetings,

      I hope you're doing well.

      I am currently facing the below error and I will appreciate it if someone can help or advise how can I get it fixed :

      mongos> db.stats()
      2017-07-24T09:12:10.064+0000 E QUERY    Error: error: {
      	"$err" : "error loading initial database config information :: caused by :: could not calculate config difference for ns test.new on IP:27019,IP:27019,IP:27019 :: caused by :: can't find shard for: shard2",
      	"code" : 13129
      }
          at Error (<anonymous>)
          at DBQuery.next (src/mongo/shell/query.js:259:15)
          at DBCollection.findOne (src/mongo/shell/collection.js:189:22)
          at DB.runCommand (src/mongo/shell/db.js:58:41)
          at DB.stats (src/mongo/shell/db.js:30:17)
          at (shell):1:4 at src/mongo/shell/query.js:259
      

      What I am was trying to do is to downscale the cluster and remove one shard, draining completed successfully and all chunks got moved to the primary shard, however after I issued the second shard remove command

       db.runCommand( { removeShard: "shard2" } ) 

      I noticed that the shard got removed however one chunk (shard key) was moved back to shard2 befor it got removed ( I have no idea how or why).

      mongos> db.chunks.find({shard:"shard2"})
      { "_id" : "test.new-_id_MinKey", "lastmod" : Timestamp(4, 0), "lastmodEpoch" : ObjectId("5641e15eab20f8848d81a6e2"), "ns" : "qs_place.places", "min" : { "_id" : { "$minKey" : 1 } }, "max" : { "_id" : "1446560142605673436" }, "shard" : "shard2" }
      mongos> 
      
      sh.status Output :
      
      	{  "_id" : "test",  "partitioned" : true,  "primary" : "shard1" }
      		test.new
      			shard key: { "_id" : "hashed" }
      			chunks:
      				shard1	1
      				shard2	1
      			{ "_id" : { "$minKey" : 1 } } -->> { "_id" : "1446560142605673436" } on : shard2 Timestamp(4, 0) 
      			{ "_id" : "1446560142605673436" } -->> { "_id" : { "$maxKey" : 1 } } on : shard1 Timestamp(4, 1) 
      

      I tried db.adminCommand("flushRouterConfig") but it didn't help.

      Any idea what caused this issue and how can I get it resolved. ?

      Best Regards,
      Mohamed Abada

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            muhamed.abada Mohamed Abada
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: