-
Type: Improvement
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Query Optimization
As part of the SBE plan cache project, we now have two separate plan cache implementations: mongo::PlanCache and mongo::sbe::PlanCache. The former is the legacy implementation which stores index tags, and the latter is the SBE-specific cache which stores SBE plans. These two plan caches share much of their logic, and differ largely in the representation of the cached plan. At the moment, code sharing has been achieved with a PlanCacheBase template class. This is convenient because the underlying data structure is LRUKeyValue which is also templated on the key and value types.
However, there are various places in the code where we would like to perform the same actions against both plan caches (e.g. when we need to flush cache contents due to the creation of an index filter). At the moment this cannot be easily abstracted across both plan caches without a template function. In order to avoid this kind of "infectious" templatization effect, it would be convenient to have a PlanCache interface allowing runtime polymorphism. We should introduce a PlanCache interface but still share code between the SBE and classic implementations using the templated base class.