-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 8.1.0-rc0, 7.0.14, 8.0.0-rc19
-
Component/s: None
-
Query Optimization
-
Fully Compatible
-
ALL
-
v8.0, v7.0
-
200
Note: this bug affects the release configuration of 7.0. The bug is also present in 8.0 and master, but only when --featureFlagSbeFull is enabled, which is not the release configuration.
See the attached repro-plan-cache.jsand inline comments for reproduction steps.
The problem can occur when:
- SBE plan cache is enabled
- Partial index
- Aggregation with $match with rooted $or and SBE-eligible group
The problem is that we encode a partial index discriminator into the plan cache key as a global discriminator (applying to the query as a whole), yet when we perform access path selection via the subplanner, we can use a partial index which the discriminator indicated was not eligible. This results in an entry in the SBE plan cache which has a hash that query shapes that are and are not eligible for the partial index hash to. This leads to incorrect results.
The reason that the classic plan cache doesn't suffer from this problem is that the subplanner caches index tags for each branch of the rooted $or separately. For a single branch, the discriminators for partial indexes work as expected.
- is related to
-
SERVER-94392 Support rooted $or queries with partial indexes in SBE plan cache
- Needs Scheduling