Fix query_settings_index_hints_tests.js check for identical plans

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      query_settings_index_hints_tests.js module is used as a part of PQS tests passthrough and it checks if plans with and without query settings match.

      However, there is a javascript issue in this line:

      https://github.com/mongodb/mongo/blob/e1e9419b175b9dc770d508d1525fcdb0dda71725/jstests/libs/query/query_settings_index_hints_tests.js#L494

           const {winningPlanWithoutQuerySettings, rejectedPlansWithoutQuerySettings} =
                  getAllQueryPlans(explainWithoutQuerySettings); 

      getAllQueryPlans() returns an object {winningPlan, rejectedPlans}, not a tuple, so when JS unwraps it into winningPlanWithoutQuerySettings and rejectedPlansWithoutQuerySettings, they end up just `undefined` and equal, so they always pass any further equality checks.

      This bug was introduced in SERVER-98924,

      Another thing is that we can't just blindly fix this: if a plan contains "$$NOW", than in explain it will be unwrapped in {$const: <current date>}, which won't be equal between explains, as it will be updated to every time we run explain.

            Assignee:
            Sebastien Mendez
            Reporter:
            Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: