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

shardCollection don't behave properly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.8
    • Component/s: Sharding
    • Environment:
      Cluster on amazon cloud
      3 config server-> t1.micro
      2 mongos -> m1.medium
      4 machines with each 4 shard -> m2.2xlarge

      Operating system : AMAZON LINUX AMI
      Mongodb version : 2.4.8
    • Linux
    • Hide

      Don't know how to reproduce it.

      Show
      Don't know how to reproduce it.

      I am creating and sharding collections dynamically with the PHP driver every week in this case.

      When executing the 'shardCollection' db command with my driver, this last returned an exception 'collection already sharded with 1 chunks'. When I take a look at it, the collection in cause (MO_3h.MO_2014_09) isn't sharded at all.

      Here are some useful data :

      mongos> db.printShardingStatus()
       
      MO_3h.MO_2014_09
                              shard key: { "_id" : 1 }
                              chunks:
      MO_3h.MO_2014_10
                              shard key: { "_id" : 1 }
                              chunks:
                                      shard0005       1
                              { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0005 Timestamp(1, 0)
      
      mongos> db.MO_2014_09.stats()
      {
              "sharded" : false,
              "primary" : "shard0005",
              "ns" : "MO_3h.MO_2014_09",
              "count" : 10711832,
              "size" : 2423233888,
              "avgObjSize" : 226.22030367914658,
              "storageSize" : 2897113088,
              "numExtents" : 21,
              "nindexes" : 2,
              "lastExtentSize" : 756604928,
              "paddingFactor" : 1,
              "systemFlags" : 1,
              "userFlags" : 0,
              "totalIndexSize" : 5727582336,
              "indexSizes" : {
                      "_id_" : 3398084592,
                      "_id_m_1__id_r_1__id_d_1__id_h_1__id_p_1" : 2329497744
              },
              "ok" : 1
      }
      
      config.collections
      { "_id" : "MO_3h.MO_2014_09" , "lastmod" : { 
                "$date" : "1970-01-17T02:49:56.104Z"} , 
                "dropped" : false , "key" : { "_id" : 1} , 
                "unique" : false , "lastmodEpoch" : { "$oid" : "5301548756e74ab823a950ba"}
      }
      

      When executing a second time the 'shardCollection' db command, everything went right.
      This happened to me 3 times in 8 months.

      On which info should I base myself to know if the collection has been sharded or not? The config of the collection or its stats?

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            melania-zanin Melania Zanin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: