[SERVER-44891] collStats will fail if resulting BSON size > 16MB Created: 02/Dec/19 Updated: 23/Oct/23 Resolved: 20/Dec/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding, Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Alex Bevilacqua | Assignee: | Charlie Swanson |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||
| Sprint: | Query 2019-12-30 | ||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||
| Description |
|
Given a larger (50+) sharded cluster with a collection with a larger (45+) number of indexes, when running the collStats command the result will be a failure due to exceeding the internal BSON document size limit:
See https://gist.github.com/alexbevi/dc51c0ce4820f46e46feca06dbdc64bb for reproduction details. Issue appears to originate at https://github.com/mongodb/mongo/blob/81238fa87afbe52a9658547f63c79fac126862f1/src/mongo/s/commands/cluster_coll_stats_cmd.cpp#L207 where the shard results are objectified. |
| Comments |
| Comment by Charlie Swanson [ 03/Jan/20 ] |
|
alex.bevilacqua I filed |
| Comment by Charlie Swanson [ 20/Dec/19 ] |
|
Hi alex.bevilacqua. This is indeed unfortunate behavior but I believe you will be able to work around it by using the $collStats stage which will provide a cursor. I'm closing this as "Won't Fix" as we don't plan on maintaining the collStats command much anymore, but please re-open if there's some reason the agg stage won't work for this use case. I will also link this as related to SERVER-33435. |
| Comment by Carl Champain (Inactive) [ 02/Dec/19 ] |
|
Passing this ticket along to the Sharding team. |
| Comment by Alex Bevilacqua [ 02/Dec/19 ] |
|
A solution to this could be to accept an optional param for collStats (maybe unwindShards: true) which would return an array instead of a document. If this option were set, when the shardResults were being iterated (see https://github.com/mongodb/mongo/blob/81238fa87afbe52a9658547f63c79fac126862f1/src/mongo/s/commands/cluster_coll_stats_cmd.cpp#L108) instead of appending them to a single result object, they could be pushed to an array. |