-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
If users have specified a batch size and the number of the documents in the final batch exactly matches the number of documents, returned by a cursor, we are left with a cursor that will return EOF next time it is called.
An example of this happening would be if find command have a limit and an equal batchSize.
A way to fix it may be to always try stashing a document after we satisfy the batch size.
For example, here: https://github.com/mongodb/mongo/blob/b19e7ed6fdaf5eea7a9851955bfdce1be767fa53/src/mongo/db/query/plan_executor.cpp#L108
This way we will either get EOF avoiding an extra network interaction or just stash a single document in advance.
- is related to
-
SERVER-57067 [SBE] Find command unexpectedly returns cursorId when final batch size aligns with result set size
- Closed
-
SERVER-80713 ID on exhausted cursor no longer 0
- Closed
-
SERVER-83077 Check one getNext beyond batchSize for EOF so we only return a cursor if there are more results
- Closed