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

changeStreamCursor.hasNext() takes longer when returning false

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • 6.0.13
    • None
    • None
    • Query Execution

    Description

      I am writing a no-passthough jstest opening and closing 960 change stream cursors with different options. The test starts and stops a minimalistic ShardingTest instance (1 mongos, 1 config-mongod, 1 shard-mongod) within the JavaScript file.

      I've noticed that changeStreamCursor.hasNext() takes considerably longer (3 to 10 times) when the result is 'false' (no change events to return).

      I have no idea if there is some intended waiting in mongo (legacy) shell, or if it is even a problem in the server's getMore command implementation.

      For reference, mongosh offers two functions: cursor.hasNext() and cursor.tryNext() and from the docs one can infer that cursor.hasNext() is 'blocking', so it might include some waiting (and a timeout?). mongo (legacy) shell does not have cursor.tryNext() counterpart.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: