|
Currently there are four stages which ask the storage engine whether a document is likely in memory, and if not request a yield by returning NEED_FETCH:
- CollectionScan
- IDHackStage
- FetchStage
- MultiIteratorStage
These stages have no knowledge of the plan's yield policy, and must call documentNeedsFetch() even for plans that will never yield. Any NEED_FETCH requests from these stages for a non-yielding plan will simply be ignored. We can avoid this overhead by passing a flag to any stage which might return NEED_FETCH, and ensure that the stage only can request a yield when the flag is set.
|