[SERVER-72620] $indexStats doesn't include the "shard" field when run on unsharded collections Created: 09/Jan/23 Updated: 29/Oct/23 Resolved: 29/Jan/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 4.4.18, 5.0.14, 6.0.4, 6.2.0-rc6 |
| Fix Version/s: | 4.4.19, 5.0.15, 6.3.0-rc0, 6.0.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Vishnu Kaushik | Assignee: | Tyler Brock |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Sharding NYC
|
||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Requested: |
v6.2, v6.0, v5.0, v4.4
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 151 | ||||||||||||||||||||
| Description |
|
$indexStats includes the "shard" field on version 4.2 when run on an unsharded collection (correct behavior). However on version 4.4 onwards the "shard" field is missing for unsharded collections even though it should be present. See comments for more info. |
| Comments |
| Comment by Githook User [ 30/Jan/23 ] |
|
Author: {'name': 'Tyler Brock', 'email': 'tyler.brock@gmail.com', 'username': 'TylerBrock'}Message: |
| Comment by Githook User [ 30/Jan/23 ] |
|
Author: {'name': 'Tyler Brock', 'email': 'tyler.brock@gmail.com', 'username': 'TylerBrock'}Message: |
| Comment by Githook User [ 30/Jan/23 ] |
|
Author: {'name': 'Tyler Brock', 'email': 'tyler.brock@gmail.com', 'username': 'TylerBrock'}Message: |
| Comment by Tyler Brock [ 29/Jan/23 ] |
|
Fixes behavior to reflect original (documented) behavior of $indexStats to include the shard name in a sharded context even on unsharded collections. |
| Comment by Githook User [ 29/Jan/23 ] |
|
Author: {'name': 'Tyler Brock', 'email': 'tyler.brock@gmail.com', 'username': 'TylerBrock'}Message: |
| Comment by Vishnu Kaushik [ 09/Jan/23 ] |
|
tyler.brock@mongodb.com's comment: It looks like getIndexStats() determines whether or not to include the shard name info based on the addShardName param which it gets from the expression context's fromMongos bool. So the question is what is setting the fromMongos bool...
... On the other hand, the server ticket that added the code seems to indicate it should always be included however when run on a sharded cluster: ... "Output documents generated for indexes on sharding enabled node started with --shardsvr should contain the shardId of the shard that generated the document in a new shard field" ... So it would seem that we've got a bug, nice spot! |