PlanExecutor::getNext() has two return codes to indicate that an error occurred during query execution: DEAD and FAILURE. These two return codes don't have a strong conceptual distinction, and nearly all callers handle them in the same way. Furthermore, there are only a few known ways in which a PlanExecutor can produce DEAD:
- A tailable collection scan dies since its position rolls off the back of the oplog.
- The PlanExecutor is marked as killed during a yield due to a catalog event such as a collection or database drop.
As a simplification, we could change the PlanExecutor to return FAILURE in all cases, which would prevent callers from having to remember to handle multiple getNext() error codes.