-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
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:
This potentially may lead to bugs when SBE PlanCacheKey might be created using classic encoding algorithm and vice versa.