[SERVER-59837] Improve $facet error message when exceeding single document limit size Created: 08/Sep/21  Updated: 31/Jul/23  Resolved: 13/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Kyle Suarez Assignee: Steve La (Inactive)
Resolution: Won't Fix Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
is related to SERVER-40317 $facet execution has no limit on how ... Closed
Participants:

 Description   

When a $facet is constructing an output document that exceeds the single document size limit, the error message is

"document constructed by $facet is 104858285 bytes, which exceeds the limit of 104857600 bytes"

This is confusing because it leads users to think it is related to the 100 MiB internal memory limit associated with allowDiskUse. It would be better to specify in the error message that it exceeds the single document limit (which is 16 MiB for an output doc and temporarily allowed to exceed that intra-stage).



 Comments   
Comment by Steve La (Inactive) [ 13/Sep/21 ]

Chatted with david.storch who authored https://jira.mongodb.org/browse/SERVER-40317

The intention of 40317 is to prevent facet from consuming unlimited memory.  Towards that, a limit of 100M is added specifically to facet.   

This 100M is different from the 16M BSON limit.

For example, we do allow facet to product a temp document whose size is greater than 16M as long as that long as eventually that temp document do not serialize to BSON.  40317 has a testcase to exhibit this by adding an unwind after facet

 

This 100M is also different from the 100M for sort before spilling kicks in when allowDiskUse is used.  Moreover, allowDiskUse would not help here as the 100M is for a document document and we do not split within document ( if we were to spill )

 

 

Generated at Thu Feb 08 05:48:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.