-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
None
void getShardsForRange(set<Shard>& shards, const BSONObj& min, const BSONObj& max, bool fullKeyReq = true) const; // [min, max)
The [min, max) comment is incorrect here, both min and max are treated as inclusive bounds. That means for a query like {a:{$lt:5}} a chunk [
{a:5},
{a:6}) will be considered to potentially contain matches even though it cannot contain matches. Similarly, it looks like the datasize command calls this function with the expectation that max is treated as an exclusive bound, even though it is not.
There's no functional error here, just a possibility of sending the operation to a shard unnecessarily. And also, currently there are cases where an inclusive upper bound must be supported - so to optimize we'd need to support both inclusive and exclusive bounds.
Descriptive test written, push pending bb code freeze.
- duplicates
-
SERVER-20768 Mongos find query including upper bound X of a chunk also targets the shard with chunk having lower bound = X
- Backlog
- is duplicated by
-
SERVER-5365 range query on shard key incorrectly sends query to extra shard(s)
- Closed
-
SERVER-13487 Incorrect mongos shard routing for some range based finds on single shard key
- Closed