[SERVER-73242] Partial index with $geoWithin filter crashes when querying a big polygon document Created: 24/Jan/23 Updated: 08/Aug/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ivan Fefer | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Sprint: | 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 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 127 | ||||||||||||||||||||
| Description |
|
jstest to reproduce the issue is attached. Imagine we create an index with partial filter expression {location: $geoWithin: <polygonA>}. 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 And GeometryContainer::contains is called that fails if the other container is a big polygon: 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. |
| Comments |
| Comment by Ivan Fefer [ 26/Jan/23 ] |
|
I suspect that the bug hides somewhere here when we unconditionally convert big polygon to regular polygon. https://github.com/mongodb/mongo/blob/cc0dc721042c7ffa2d00a0f414d65c650f646918/src/mongo/db/geo/shapes.cpp#L879
|