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

[SBE] Fix latent bug in ExpressionPostVisitor causing a failure in "sanity.js"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Fully Compatible
    • ALL

      After the fix for SERVER-49123 landed in master, I noticed a new failure starting happening in the "sanity.js" test from the old SBE branch.

      Upon investigating the new failure, I discovered that there was a latent bug in generateTraverse() in "sbe_stage_builder_expression.cpp" that has been there for a while. If you look at generateTraverse() around line 304, you'll see a TraverseStage being constructed without a depth limit - let's call this TraverseStage "T". Based on what I know about the code, I'm fairly confident that not having a depth limit on TraverseStage T is wrong.

      Prior to the fix for SERVER-49123 (which included the fix for the "TraverseStage depth limit" bug), TraverseStage T happened to produce correct results (at least for the cases that "sanity.js" exercises) because another TraverseStage with a depth limit was filtering out all the array values first before they could reach TraverseStage T. When the "TraverseStage depth limit" bug got fixed, this latent bug emerged (because now there isn't another TraverseStage earlier in the plan tree filtering out array values before they reach TraverseStage T).

      The goal of this task is to fix the latent bug in ExpressionPostVisitor so that the "sanity.js" test passes (ignoring the $abs related failures, which is a separate issue).

            Assignee:
            andrew.paroski@mongodb.com Drew Paroski
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: