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

Truncate SBE debug info to fit into internalQueryExplainSizeThresholdBytes

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2025-03-03

      When generating explain for SBE, we output two big strings:

      slots - values of all slots that are set at the start of execution

      stages - a detailed SBE plan

      https://github.com/mongodb/mongo/blob/0a68308f0d39a928ed551f285ba72ca560c38576/src/mongo/db/query/plan_explainer_sbe.h#L88

      Currently they are just added as strings to a BSONObj.

      However, we have seen evidence of some plans having more than 1 000 000 slots, which means just listing slots in format `s123456 = X` may take up megabytes, even with existing truncation of strings and containers.

      We should improve this code to respect internalQueryExplainSizeThresholdBytes

      Otherwise we can crash not only explain, but also mask errors in regular queries (see SERVER-98493)

       

            Assignee:
            evan.bergeron@mongodb.com Evan Bergeron
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: