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

$match autoparameterize revertMode for SBE plan cache can lead to cache flooding

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: 7.0.0-rc0
    • Component/s: Query Execution
    • None
    • Fully Compatible
    • ALL

      This is from code inspection:

      MatchExpression:parameterize() (db/matcher/expression.cpp) will revert parameterization of the aggregation $match when there are more than 'maxParameterCount' parameters (512 by default in my investigation), but nothing prevents this plan from being put into the SBE plan cache. Thus if the same query shape occurs again but with different constants, each plan with different constant values will be cached separately, causing cache flooding with large plans that are unlikely ever to be reused.

      The fix should be to avoid caching any plan that triggered the reversion of parameterization. (Concurrence from discussion with anna.wawrzyniak@mongodb.com .)

      Introduced in 7.0.0-rc0 by SERVER-73589.

      CC: amr.elhelw@mongodb.com justin.seyster@mongodb.com 

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

              Created:
              Updated:
              Resolved: