| Steps To Reproduce: |
From shell in mongos with >1 shard added
mongos>sh.enableSharding("ismbtest")
|
mongos>sh.shardCollection("ismbtest.audit",{region:1,_id:1})
|
mongos>sh.splitAt("ismbtest.audit",{region:"NA",_id:null})
|
mongos>sh.setBalancerState(false)
|
mongos>sh.status()
|
— Sharding Status —
sharding version: {
|
"_id" : 1,
|
"version" : 4,
|
"minCompatibleVersion" : 4,
|
"currentVersion" : 5,
|
"clusterId" : ObjectId("53be36b80698700e22a3bb6f")
|
}
|
shards:
|
{ "_id" : "shard0000", "host" : "localhost:27502" }
|
{ "_id" : "shard0001", "host" : "localhost:27503" }
|
databases:
|
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
|
{ "_id" : "test", "partitioned" : false, "primary" : "shard0000" }
|
{ "_id" : "ismbtest", "partitioned" : true, "primary" : "shard0000" }
|
ismbtest.audit
|
shard key: { "region" : 1, "_id" : 1 }
|
chunks:
|
shard0001 1
|
shard0000 1
|
{ "region" : { "$minKey" : 1 }, "_id" : { "$minKey" : 1 } } -->> { "region" : "NA", "_id" : { "$minKey" : 1 } } on : shard0001 Timestamp(2, 0)
|
{ "region" : "NA", "_id" : { "$minKey" : 1 } } -->> { "region" : { "$maxKey" : 1 }, "_id" : { "$maxKey" : 1 } } on : shard0000 Timestamp(2, 1)
|
{ "_id" : "isbmtest", "partitioned" : false, "primary" : "shard0001" }
|
mongos> db.audit.insert({region:"EMEA",_id:"123-456-789-101112",text:"On Emea"})
|
WriteResult({ "nInserted" : 1 })
|
mongos> db.audit.insert({region:"NA",_id:"123-456-789-101113",text:"On NA"})
|
WriteResult({ "nInserted" : 1 })
|
mongos> db.audit.stats()
|
{
|
"sharded" : true,
|
"systemFlags" : 1,
|
"userFlags" : 1,
|
"ns" : "ismbtest.audit",
|
"count" : 2,
|
"numExtents" : 2,
|
"size" : 224,
|
"storageSize" : 16384,
|
"totalIndexSize" : 32704,
|
"indexSizes" : {
|
"_id_" : 16352,
|
"region_1__id_1" : 16352
|
},
|
"avgObjSize" : 112,
|
"nindexes" : 2,
|
"nchunks" : 2,
|
"shards" : {
|
"shard0000" : {
|
"ns" : "ismbtest.audit",
|
"count" : 0,
|
"size" : 0,
|
"storageSize" : 8192,
|
"numExtents" : 1,
|
"nindexes" : 2,
|
"lastExtentSize" : 8192,
|
"paddingFactor" : 1,
|
"systemFlags" : 1,
|
"userFlags" : 1,
|
"totalIndexSize" : 16352,
|
"indexSizes" : {
|
"_id_" : 8176,
|
"region_1__id_1" : 8176
|
},
|
"ok" : 1
|
},
|
"shard0001" : {
|
"ns" : "ismbtest.audit",
|
"count" : 2,
|
"size" : 224,
|
"avgObjSize" : 112,
|
"storageSize" : 8192,
|
"numExtents" : 1,
|
"nindexes" : 2,
|
"lastExtentSize" : 8192,
|
"paddingFactor" : 1,
|
"systemFlags" : 1,
|
"userFlags" : 1,
|
"totalIndexSize" : 16352,
|
"indexSizes" : {
|
"_id_" : 8176,
|
"region_1__id_1" : 8176
|
},
|
"ok" : 1
|
}
|
},
|
"ok" : 1
|
}
|
Both went to same shard, it appears that a chunk range of
{ "region" : { "$minKey" : 1 }, "_id" : { "$minKey" : 1 } } -->> { "region" : "NA", "_id" : { "$minKey" : 1 } } on : shard0001 Timestamp(2, 0)
|
Somehow includes
{region:"NA","_id:"123-456-789-101113"}
|
in sorting does minKey not come first?
|