[GODRIVER-2930] Allow setting batch size on change stream cursor Created: 02/Aug/23  Updated: 28/Oct/23  Resolved: 02/Aug/23

Status: Closed
Project: Go Driver
Component/s: Change Streams
Affects Version/s: None
Fix Version/s: 1.12.1, 1.11.9

Type: New Feature Priority: Major - P3
Reporter: Matt Dale Assignee: Matt Dale
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Currently you can set batch size on a ChangeStream using ChangeStreamOptions.SetBatchSize. However, that applies to both the initial "aggregate" command as well as the subsequent "getMore" commands run while iterating the change stream. That can cause a problem when starting a change stream on low- or bursty-traffic collections because the initial aggregate won't return a cursor until the batch size is filled. The tailable cursor used by a change stream is intended to wait indefinitely for updates, but the initial "aggregate" command isn't, so will time out if there aren't enough changes to fill a batch, leading to an unexpected error.

Definition of done:

  • Allow setting batch size on a ChangeStream after it's returned by Watch.


 Comments   
Comment by Githook User [ 02/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2930 Allow setting batch size for subsequent getMore's on a ChangeStream. (#1342)
Branch: release/1.12
https://github.com/mongodb/mongo-go-driver/commit/3ff68c3aeb52039692317f51c440293146058b15

Comment by Githook User [ 02/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2930 Allow setting batch size for subsequent getMore's on a ChangeStream. (#1342)
Branch: release/1.11
https://github.com/mongodb/mongo-go-driver/commit/c7b372f9f4220a4bad43cc026392fe047813ee1e

Comment by Githook User [ 02/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2930 Allow setting batch size for subsequent getMore's on a ChangeStream. (#1342)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/3efbd23a061a4069af96e56b894f4f72bcd51999

Comment by Matt Dale [ 02/Aug/23 ]

PR: https://github.com/mongodb/mongo-go-driver/pull/1342

Generated at Thu Feb 08 08:39:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.