Imagine we have the following SBE plan:
unwind s13 s14 project [s13 = if (getArraySize (s12) > 0, s12, [null])] group [] [s12 = addToSet (s10)] // Some part of the tree producing s10
Basically, we are collecting some values into ArraySet in s12, make a reference to s12 with s13 and then unwind ArraySet from s13.
Now imagine that after unwinding first N elements, yield happens. All values in the tree will be copied, including the value behind s13. Unwind will update its reference to ArraySet to point to the freshly copied value and skip first N elements. The problem is, we have no guarantee that these N elements are in fact the same elements produced before, since ArraySet does not have ordering guarantees.
Since all non-BSON values are always owned by the SBE tree, it makes sense to copy only BSON values during yielding. This will also solve the problem outlined above.
- is depended on by
-
SERVER-62287 Fix disabled Query Execution tests failing due to changing latest release to 5.3
- Closed