Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-2930 Allow setting batch size for subsequent getMore's on a ChangeStream. #1342

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

matthewdale
Copy link
Collaborator

GODRIVER-2930

Summary

Allow setting batch size for subsequent getMores on a ChangeStream.

Background & Motivation

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.

@matthewdale matthewdale marked this pull request as ready for review August 2, 2023 18:09
@matthewdale matthewdale requested a review from a team as a code owner August 2, 2023 18:09
@matthewdale matthewdale requested review from prestonvasquez and qingyang-hu and removed request for a team August 2, 2023 18:09
@matthewdale matthewdale merged commit 3efbd23 into mongodb:master Aug 2, 2023
matthewdale added a commit that referenced this pull request Aug 2, 2023
matthewdale added a commit that referenced this pull request Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants