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

PlanCacheKey Factory should decide how to encode query shape, not CanonicalQuery

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QO 2022-05-02, QO 2022-05-16, QO 2022-07-25, QO 2022-08-08, QO 2022-08-22, QO 2022-09-05, QO 2022-09-19, QO 2022-10-03, QE 2022-10-17, QO 2023-03-06, QO 2023-03-20, QO 2023-04-03, QO 2023-04-17

      plan_cache_key_factory asks CanonicalQuery to encode the query's shape: https://github.com/10gen/mongo/blob/86473072ba8f4765d9d164c44df5e55b11cb46e3/src/mongo/db/query/plan_cache_key_factory.cpp#L80

      The issue here is that plan_cache_key_factory already knows which PlanCacheKey it should create - Classic or SBE, nevertheless, CanonicalQuery makes additional checks and decides itself how to encode the shape using SBE or Classic way:

      https://github.com/10gen/mongo/blob/86473072ba8f4765d9d164c44df5e55b11cb46e3/src/mongo/db/query/canonical_query.cpp#L530-L534

      This potentially may lead to bugs when SBE PlanCacheKey might be created using classic encoding algorithm and vice versa.

            Assignee:
            anton.korshunov@mongodb.com Anton Korshunov
            Reporter:
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: