PlanCacheKey encodes non-text score $meta sorts incorrectly, causing plan cache collisions

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The plan cache key encoder in canonical_query_encoder.cpp only handles $meta: "textScore" as a special case, emitting "t". All other $meta sort types (randVal, geoNearDistance, score, etc.) fall through to the descending branch, emitting "d". This causes incorrect plan cache hits between queries that should be treated as distinct. Each $meta sort type should produce its own unique key suffix, with unit tests added to verify no collisions occur.

            Assignee:
            Unassigned
            Reporter:
            Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: