[SERVER-59080] Better replanning mechanism for SBE plans with blocking stages Created: 03/Aug/21  Updated: 29/Oct/23  Resolved: 11/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0

Type: Task Priority: Major - P3
Reporter: Ian Boros Assignee: Justin Seyster
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: QE 2021-11-01, QE 2021-11-15
Participants:
Linked BF Score: 184

 Description   

Cached plans with blocking SORTS will completely stop (close()) and restart (open()) after the first 101 documents have been processed by the sort stage. These documents are discarded, and the work done by the plan up to this point is wasted.

 

The strategy of aborting the plan mid-flight makes sense for multi-planning, when we want to run each plan for only a short duration to test its 'productivity'. However, for a plan already in the cache we should be "optimistic" about it remaining in the cache instead of paying the high cost of restarting the plan each time. Ideally, we'd have a solution which only aborts the query when it is clear that replanning is necessary.

 

The way this is implemented is that a 'resultsBudget' is set in the SBE runtime planner when all of the plans are blocking. In the case of a cached solution, there is only one candidate, and if it is blocking, the resultsBudget is set, causing it to stop after a certain number of results have been fed into the sort stage.



 Comments   
Comment by Githook User [ 09/Nov/21 ]

Author:

{'name': 'Justin Seyster', 'email': 'justin.seyster@mongodb.com', 'username': 'jseyster'}

Message: SERVER-59080 Do not discard work from trial run when replanning is not needed
Branch: master
https://github.com/mongodb/mongo/commit/dfbd0af43c7ac29dbb5a7f1bfcd5211973259f1d

Comment by Githook User [ 08/Nov/21 ]

Author:

{'name': 'Mickey. J Winters', 'email': 'mickey.winters@mongodb.com', 'username': 'mjrb'}

Message: Revert "SERVER-59080 Do not discard work from trial run when replanning is not needed"

This reverts commit eac8547116b770dbe3906fe4eb07bbfe1bbf3ede.
Branch: master
https://github.com/mongodb/mongo/commit/24ce5b1d3f3e3c28b607c1aeb77dc061cb3d9088

Comment by Githook User [ 04/Nov/21 ]

Author:

{'name': 'Justin Seyster', 'email': 'justin.seyster@mongodb.com', 'username': 'jseyster'}

Message: SERVER-59080 Do not discard work from trial run when replanning is not needed
Branch: master
https://github.com/mongodb/mongo/commit/eac8547116b770dbe3906fe4eb07bbfe1bbf3ede

Comment by Eric Cox (Inactive) [ 28/Oct/21 ]

Code Review: https://github.com/10gen/mongo/pull/1543

Generated at Thu Feb 08 05:46:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.