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

Refactor relationship between executors and yield policies

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

      The PlanExecutor and PlanYieldPolicy family trees have become intertwined in a way that puts unwanted constraints on visibility of child classes and makes it hard to add some new functionality without creating cycles in build targets and/or #includes.

      The main problem is that there is PlanExecutorXyz concrete (child) class functionality implemented in PlanYieldPolicyXyz concrete (child) classes, especially the saveState() and restoreState() implementations for each executor engine. This requires the PlanYieldPolicyXyz child classes to see the definitions of the PlanExecutorXyz child classes, thus making it impossible for the reverse visibility to be exposed without creating a cycle.

      Ideally there should be no need for a PlanYieldPolicy to know anything about a PlanExecutor. To make this the case, there should not be any PlanExecutorXyz-specific functionality implemented in PlanYieldPolicyXyz. Instead, saveState() and restoreState() should be changed from pure virtual methods in PlanYieldPolicy to callbacks in the YieldPolicyCallbacks class and 100% of their implementations should be moved out of the PlanYieldPolicyXyz classes and into the PlanExecutorXyz classes.

      There are probably additional opportunities for simplification at the same time, but the above appears to be the main one currently constraining the code in unwanted ways.

      SERVER-96442 cannot currently be implemented due to the existing constraints, so it depends on this ticket.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.cherkauer@mongodb.com Kevin Cherkauer
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: