[SERVER-13702] Commands without optional query may target to wrong shards on mongos Created: 23/Apr/14 Updated: 19/Jun/15 Resolved: 18/Sep/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 2.6.5, 2.7.7 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Siyuan Zhou |
| Resolution: | Done | Votes: | 0 |
| Labels: | cap-ticket-needed | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Completed: | |||||||||||||
| Steps To Reproduce: | Run attached script for count and mapReduce |
||||||||||||
| Participants: | |||||||||||||
| Description |
|
On mongos, for commands allowing optional query, e.g. count, mapreduce, if the optional query is not given, the command will use the command BSONObj itself as the query to target shards, which could return wrong shards if the shard key happens to be one of the field in the command object. This is because if the optional query is not given, commands call Strategy::commandOp with an empty targetingQuery parameter. The targetingQuery parameter is passed to ParallelSortClusteredCursor as CommandInfo.cmdFilter. An empty cmdFilter will be interpreted as using the command/query as a whole to target shards. |
| Comments |
| Comment by Githook User [ 18/Sep/14 ] |
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: (cherry picked from commit bd1a02385378ee50a33db7c255217c050cc74192)
(cherry picked from commit e986b037f1301fae63938dc9bd933ff8ac25b7d6) |
| Comment by Githook User [ 18/Sep/14 ] |
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: (cherry picked from commit bd1a02385378ee50a33db7c255217c050cc74192)
(cherry picked from commit e986b037f1301fae63938dc9bd933ff8ac25b7d6) |
| Comment by Githook User [ 17/Sep/14 ] |
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: |
| Comment by Siyuan Zhou [ 15/Sep/14 ] |
|
greg_10gen, I am working on the JS tests. Sorry for missing it at the first time. I forgot why we don't backport this issue to 2.6, but v2.6 has the same bug. |
| Comment by Githook User [ 28/Apr/14 ] |
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: |