[SERVER-36911] Ensure that cluster aggregations that fail clean up cursors Created: 28/Aug/18 Updated: 29/Oct/23 Resolved: 04/Oct/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kyle Suarez | Assignee: | Nicholas Zolnierz |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Sprint: | Query 2018-09-24, Query 2018-10-08 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 4 | ||||||||||||||||||||
| Description |
|
When setting up a non-passthrough cluster aggregation, mongos establishes cursors on the targeted shards that will be used by the merging portion of the pipeline. We must ensure that, if the aggregation fails during planning, we appropriately clean up cursors and do not leak them. As part of this work, we'll also write tests that deliberately force a failure and assert that cursors are cleaned up appropriately. |
| Comments |
| Comment by Githook User [ 04/Oct/18 ] |
|
Author: {'name': 'Nick Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}Message: |
| Comment by Githook User [ 04/Oct/18 ] |
|
Author: {'name': 'Nick Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}Message: |
| Comment by Charlie Swanson [ 19/Sep/18 ] |
|
For the record, we noticed that one of our new $out tests added a scenario that would leak a cursor. If parsing fails on the shards but not on the mongos - we will leak the cursors from the first ('shards') half of the pipeline. This shouldn't usually happen, but it can happen in rare cases where extra validation checks are performed during parsing (like verifying the collection is not sharded) that can have different results on the shards vs. the mongos. |
| Comment by Kyle Suarez [ 05/Sep/18 ] |
|
For now, we're going to keep this in the $out epic but will put it on the backlog. While it's true that an $exchange would cause more cursors to be open (and therefore have a bigger impact in the event they were leaked), this is a condition that exists today. The latest plan will not cause stale sharding metadata exceptions to be raised during cluster aggregation planning after cursors have been established. |