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

Make debug print of SBE expressions more readable

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • QE 2022-09-19, QE 2022-10-03
    • 146

      As part of our efforts to improve the performance of the SBE engine, we are trying to change our plan generation logic so that instead of generating large subtrees of PlanStages, we instead generate large EExpression trees. This comes with a performance benefit, since we've found that it's cheaper to interpret the bytecode generated from EExpression trees than interpreting PlanStage trees (which involves a long chain of getNext() virtual function calls).

      Although such changes improve the performance of the engine, it reduces debuggability. The debug print for PlanStage uses newlines and spacing to show the tree structure. In contrast, EExpression debug print produces a long wall of text like this:

              [2] filter {let [l4.0 = let [l2.0 = [2, 12], l2.1 = let [l1.0 = s7] if (! exists (l1.0) || typeMatch (l1.0, 1088), null, if (! isArray (l1.0), fail ( 5126900 ,All operands of $setIntersection must be arrays.), setIntersection (l1.0)))] fillEmpty (l2.0 <=> l2.1 >= 0, exists (l2.0) && typeMatch (l2.0, -65) >= exists (l2.1) && typeMatch (l2.1, -65))] exists (l4.0) && ! typeMatch (l4.0, 1088) && l4.0 <=> false != 0 && l4.0 <=> 0 != 0}
      

      We could improve this by rendering the EExpression tree with newlines and potentially some delimiters to indicate the beginning and end of expressions.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: