Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40317

$facet execution has no limit on how much memory it can consume

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • v4.4, v4.2, v4.0, v3.6
    • Query 2020-08-24
    • 21

    Description

      A $facet always outputs one document but it completely executes all of its pipelines no matter how large they are. To avoid unreasonable memory consumption, the $facet should return an error as soon as it has >100MB of results, rather than waiting until it's computed all of its data.

      Note that the $facet's output document is allowed to be up to 100MB large if it is an intermediate result. However, all documents produced by an aggregation pipeline's result set must be 16MB or less due to the BSON size limit. So the 100MB limit applies to the output document produced by $facet, but the pipeline will still fail unless the size of this document is subsequently reduced to 16MB or less.

      Also, note that the value of allowDiskUse does not affect the behavior implemented under this ticket, since the $facet stage's current implementation cannot spill to disk.

      Attachments

        Issue Links

          Activity

            People

              david.storch@mongodb.com David Storch
              justin.seyster@mongodb.com Justin Seyster
              Votes:
              2 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: