[SERVER-86105] changeStreamCursor.hasNext() takes longer when returning false Created: 02/Feb/24 Updated: 06/Feb/24 |
|
| Status: | Needs Scheduling |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.0.13 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Romans Kasperovics | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Participants: |
| 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. |