[SERVER-8948] Count() can be wrong in sharded collections Created: 12/Mar/13 Updated: 09/Jul/16 Resolved: 07/Mar/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying, Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Antoine Guiral | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | commands, count | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The count command does not ignore orphans like find/queries. This is true whether the query is on the primary or secondaries (which is known to be a different issue). For a query like this the count can come back larger if there are orphaned docs, but find will filter them out:
|
| Comments |
| Comment by Scott Hernandez (Inactive) [ 05/Feb/14 ] |
|
Here is a test which passes now because the counts are off. This tests current behavior in the server |
| Comment by Adinoyi Omuya [ 11/Apr/13 ] |
|
It could also be SERVER-4123. Could you post the result of calling explain() on the find query? |
| Comment by Adinoyi Omuya [ 11/Apr/13 ] |
|
What shard key are you using? _id? |
| Comment by Antoine Guiral [ 12/Mar/13 ] |
|
I don't know but |
| Comment by Tad Marshall [ 12/Mar/13 ] |
| Comment by Antoine Guiral [ 12/Mar/13 ] |
|
Btw, the result shown with php (21031) is the same I get with the shell. |