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

[CQF] Investigate reference tracker stack-overflow

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • QO 2023-07-24, QO 2023-08-07, QO 2023-08-21, QO 2023-09-04

      The maximum number of aggregation stages allowed is 1000 for non-debug builds. For the following pipeline (and other long pipelines) the classic engine has no issues, while Bonsai fails with a stack overflow in the first call to the reference tracker.

      db.c.drop();
      const stage = {$addFields: {a: {$add: ["$a", "$b"]}}};
      // Make a pipeline with 990 stages (all the same stage)
      const pipeline = [...Array(990).keys()].map(_ => stage);
      db.c.aggregate(pipeline).toArray();
      // Stack overflow
      

      We should investigate why the stack frames are so large. Are we allocating unnecessarily at all?

      The overall goal is to determine if the transport infrastructure needs to fundamentally change to be able to handle deep trees, or is there a less extreme change we can make?

            Assignee:
            david.percy@mongodb.com David Percy
            Reporter:
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: