If a result document buffered inside the MultiPlanStage is invalidated by an update or delete during a yield, this result is dropped from the result set and flagged for review by the KeepMutationsStage:
However, KeepMutationsStage is always below MultiPlanStage in the query execution tree, which means that the flagged results will never get revisited. As a result, these documents will be absent from the result set.
In general, concurrently modified results may be dropped from the query result set (see the Concurrency FAQ). However, the system should make a best effort to preserve results. We could do better in this case by simply copying the pre-image of the about-to-be modified document rather than dropping it.
- is related to
SERVER-20299 Delete KEEP_MUTATIONS stage