Skip to content

Conversation

@FGasper
Copy link
Collaborator

@FGasper FGasper commented Dec 4, 2025

Verifier has historically assumed that a change stream’s initial response will be empty (save for the resume token), but that’s not always the case.

When a nonempty initial response arrives, Verifier has been crashing because the driver’s ResumeToken() method has returned nil.

This changeset fixes Verifier to anticipate a nonempty initial response.

A generic cursor-batch-reader is added to mmongo to facilitate this. Also, the log about the start timestamp now more clearly distinguishes when the cluster time predates the resume token’s timestamp.

@FGasper FGasper requested a review from tdq45gj December 4, 2025 18:54
if !hasSavedToken {
// Usually the change stream’s initial response is empty, but sometimes
// there are events right away. We can discard those events because
// they’ve already happened, and our initial scan is yet to come.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding correctly that it is safe because the initial scan enforces afterClusterTime that is after the resume token timestamp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. If there was no saved resume token, then the time that this function returns gets used as the find queries’ initial afterClusterTime.

@FGasper FGasper requested a review from tdq45gj December 6, 2025 17:43
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.

2 participants