-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
QE 2023-02-06, QE 2023-02-20, QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17, QE 2023-05-01
-
127
jstest to reproduce the issue is attached.
Imagine we create an index with partial filter expression {location: $geoWithin: <polygonA>}.
And query the collection with filter {location: $getWithin: <polygonB>}.
During planning, isSubsetOf(index filter expression, query expression) will be called to determine if index can be used.
It will check if polygonB is inside polygonA: https://github.com/mongodb/mongo/blob/04299d14a33a89023b6bc69d8d59a618aa603e5d/src/mongo/db/matcher/expression_algo.cpp#L750
GeoMatchExpression::matchesGeoContainer has an explicit check to never match big polygon, which fails for some reason
https://github.com/mongodb/mongo/blob/04299d14a33a89023b6bc69d8d59a618aa603e5d/src/mongo/db/matcher/expression_geo.cpp#L415
And GeometryContainer::contains is called that fails if the other container is a big polygon:
https://github.com/mongodb/mongo/blob/04299d14a33a89023b6bc69d8d59a618aa603e5d/src/mongo/db/geo/geometry_container.cpp#L322
It looks like the bug can be triggered easier by just inserting a document with big polygon and querying if it is within another geometry, but for some reason, the only way this actually breaks in partial index filter.
- is caused by
-
SERVER-58359 More flexible query containment for $geoWithin
- Closed
- is related to
-
SERVER-57763 Allow partial filter expression to use $geoWithin
- Closed
-
SERVER-73235 Replace invariant with uassert in geometry_container
- Closed