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

Convert PlanCache to a template class

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: Query Planning
    • None
    • Fully Compatible
    • QE 2021-09-06

      We plan to make the current PlanCache more generic so that it can be used to implement both the existing plan cache for the classic engine, as well as the SBE plan cache. We will have a PlanCacheBase<KeyType, CachedPlanType> base class which has template parameters for the type of the plan cache key as well as the type of cached plan. The SBE/classic plan classes will each instantiate this template class.

      As a first step, we need to do a bit of surgery to the current PlanCache in order to turn it into a template class. We should try to do this as mechanically as possible to keep this first patch relatively simple. A few notes:

      • There will be a lot of code motion here. We need to move most of the code in plan_cache.cpp into the header file in order to templatize the necessary types.
      • Right now you can't use logv2 from a header file. We'll have to deal with this. We handled this elsewhere by making the templated code call simple helper functions to do the logging. Example here.
      • You'll need to turn not only PlanCache but also CachedSolution and PlanCacheEntry into template classes.
      • This patch won't actually interact at all with the SBE plan cache just yet. We will have template instantiations only for the classic engine. This is just prep work.

            Assignee:
            joshua.lapacik@mongodb.com Joshua Lapacik (Inactive)
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: