Move engine selection to PlannerInterface to support PQS retries

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-04-13
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Situation:

      1. There are two collections: main, secondary.
      2. Indexes on both collections: "a_1", "a_1_b"1
      3. Query: main.aggregate($match, $lookup, hint: "a_1")
      4. Query Settings: indexHints: "test.secondary", allowedIndexes: ["a_1_b_1"]

      The test query_settings_index_application_aggregate.js expects that when using SBE, the hint will be ignored and the plan, regardless of the hint, will be IXSCAN main "a_1_b_1" → IndexedLoopJoin secondary "a_1_b_1"

      This works on master because:

      1. We see $lookup → enable SBE
      2. As soon as we enable SBE, we call fillOutSecondaryCollectionsPlannerParams
      3. fillOutSecondaryCollectionsPlannerParams sets the flag params.querySettingsApplied
      4. When we call QueryPlanner::plan, it checks querySettingsApplied before applying the hint.

      But if we enable featureFlagGetExecutorDeferredEngineChoice, we will be planning before we even know whether we'll be using SBE or not. Because of this, we'll call fillOutSecondaryCollectionsPlannerParams after we've already called QueryPlanner::plan and applied the hint for the main collection.

       

      The plan is to only assert in the test not full plan equality, but if namespaces, affected by query settings have the correct indexes.

            Assignee:
            Ivan Fefer (Inactive)
            Reporter:
            Ivan Fefer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: