[SERVER-16892] PlanYieldPolicy should be lifted out of PlanExecutor Created: 16/Jan/15  Updated: 15/May/15  Resolved: 15/May/15

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

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

PlanExecutor currently performs temprelease-style yielding through a PlanYieldPolicy while inside a call to PlanExecutor::getNext(). This causes yield lock release to happen in code where the acquiring lock is not in scope. PlanExecutors should not know about locks or yielding, and yielding should only happen with explicit manipulation of the lock objects. This way, a reader of a function that acquires a Lock::DBLock can easily reason about how long the lock is held (today, such a reader has to scour the function for hints that one of its subroutines might induce a yield as a hidden side effect).

PlanExecutor::getNext() should perform no yielding on its own, but instead should take a boolean functor as an additional optional argument that is evaluated on each work cycle. When the functor indicates that the time is right, the getNext() call should pass a NEED_YIELD return value to the caller instead of a document to be returned. The caller should then handle this yield request as it pleases.


Generated at Thu Feb 08 03:42:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.