-
Notifications
You must be signed in to change notification settings - Fork 16
REP-5318 Retry on change stream failures. #52
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
REP-5318 Retry on change stream failures. #52
Conversation
8231711 to
03853c7
Compare
03853c7 to
1348a60
Compare
tdq45gj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think we need to call IterationSuccess when iterating the change stream.
internal/verifier/change_stream.go
Outdated
| // StartChangeStream starts the change stream. | ||
| func (verifier *Verifier) StartChangeStream(ctx context.Context) error { | ||
| // Result seems a bit simpler than messing with 2 separate channels. | ||
| resultChan := make(chan mo.Result[primitive.Timestamp]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused. Could you clarify what result does this resultChan expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result holds a “payload, or error”. It’s a common pattern in Rust.
The alternative would be 2 separate channels then a select on those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it hold the result from createChangeStream? Could we use a more descriptive name such as createChangeStreamResultChan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the first change stream creation’s result. I’ve reshuffled the code a bit to clarify that.
tdq45gj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Previously this function actually returned the most recent cluster time rather than creating a new cluster time. This changeset makes it now create a new time instead. This simplifies the change stream’s handling of the writesOff timestamp because the writesOff timestamp is separate from any change event.
0f074f1 to
1547534
Compare
This entails a small refactor of the change stream code so that the change stream’s creation and iteration both happen under a retryer.
1547534 to
f4fcc05
Compare
REVIEW NOTE
It probably makes sense to review this PR’s 2 commits separately.
This is necessary for testing migration-verifier’s change stream in mongosync’s nondeterministic tests. It entails a small refactor of the change stream code so that both the change stream’s creation and iteration happen under a retryer.
Additionally, this makes GetNewClusterTime() return an actual new cluster time rather than returning the current one. This simplifies reasoning about the change stream’s handling of the writesOff timestamp.