printShardingStatus(true) says a certain range of shard key ids fall within a single shard:
...
{ "my_id" : 13165 }-->>
{ "my_id" : 13200 }on : shard4
{ "t" : 68000, "i" : 0 } { "my_id" : 13200 }-->>
{ "my_id" : 13540 }on : shard3
{ "t" : 69000, "i" : 0 }...
i am taking this to mean [13165, 13200) exists on shard4, while [13200, 13540) exist on shard3 based on:
db.coll.find(
{my_id:13200}).explain()
{
"clusteredType" : "ParallelSort",
"shards" : {
"shard3/10.177.210.46:27017,10.177.210.47:27017" : [
{
"cursor" : "BtreeCursor my_id_1",
"nscanned" : 616,
"nscannedObjects" : 616,
"n" : 616,
"millis" : 2,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}
]
},
"n" : 616,
"nChunkSkips" : 0,
"nYields" : 0,
"nscanned" : 616,
"nscannedObjects" : 616,
"millisTotal" : 2,
"millisAvg" : 2,
"numQueries" : 1,
"numShards" : 1
}
therefore i would expect the range query: {"my_id":{"$gte":13165,"$lt":13200}} to be sent only to shard4, however that is not the case:
db.coll.find({my_id:{'$gte':13165,'$lt':13200}}).explain()
{
"clusteredType" : "ParallelSort",
"shards" : {
"shard3/10.177.210.46:27017,10.177.210.47:27017" : [
{
"cursor" : "BtreeCursor my_id_1",
"nscanned" : 0,
"nscannedObjects" : 0,
"n" : 0,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}
],
"shard4/10.176.64.155:27017,10.177.205.133:27017" : [
{
"cursor" : "BtreeCursor my_id_1",
"nscanned" : 9248,
"nscannedObjects" : 9248,
"n" : 9248,
"millis" : 45,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}
]
},
"n" : 9248,
"nChunkSkips" : 0,
"nYields" : 0,
"nscanned" : 9248,
"nscannedObjects" : 9248,
"millisTotal" : 45,
"millisAvg" : 22,
"numQueries" : 2,
"numShards" : 2
}
it should go only to shard4 no?
- duplicates
-
SERVER-20768 Mongos find query including upper bound X of a chunk also targets the shard with chunk having lower bound = X
- Backlog
-
SERVER-4791 shard selection code ignores bound inclusivity
- Closed