Details
-
Task
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
-
None
-
None
-
Query Optimization
Description
For queries against unsharded collections, the query system currently generates plans which do not perform orphan filtering. Such plans can then get cached in the SBE plan cache. If the collection later becomes sharded, then cached plans which do not perform shard filtering are no longer valid. In order to prevent invalid cached plans from being reused when a collection becomes sharded, we currently encode the collection's sharding epoch into the SBE plan cache key.
This depends on the collection's sharding epoch changing when a collection transitions from unsharded to sharded. The problem is that the sharding team is working on eliminating the concept of unsharded collections and may alter the semantics of the sharding epoch so that it no longer gets bumped when a collection is first sharded. In order to prepare for this change, we should explicitly encode whether or not the collection is sharded into the SBE plan cache key. That way the sharding team will not unwittingly break the SBE plan cache with a subtle change to unrelated logic around the collection sharding epoch.