Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-96643

When batch size is reached try getting one more document

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: