Skip to content

Conversation

@FGasper
Copy link
Collaborator

@FGasper FGasper commented Dec 3, 2024

Commit 31cc703 was broken because it didn’t actually recreate the callbacks as needed to redo the reads.

(Unfortunately there’s little good way to test this directly, but mongosync’s CI testing caught it.)

This changeset fixes that by adding a callback to the retryer that runs at the start of each iteration.

@FGasper FGasper changed the title fix retry on doc-read failure REP-5329 Fix retry on document reads. Dec 3, 2024
@FGasper FGasper requested a review from tdq45gj December 3, 2024 20:58
@FGasper FGasper marked this pull request as ready for review December 3, 2024 20:58
Copy link
Collaborator

@tdq45gj tdq45gj left a comment

Choose a reason for hiding this comment

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

LGTM % two questions.

}

eg.Go(func() error {
if curFunc == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we check curFunc to be non-nil both twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This 2nd check is probably redundant. I was just trying to suss out why I was seeing segfaults, and I figured I might as well leave the panics in.

Comment on lines +38 to +40
WithBefore(func() {
srcChannel, dstChannel, readSrcCallback, readDstCallback = verifier.getFetcherChannelsAndCallbacks(task)
}).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm trying to understand why do we need before func. Is it the same as calling the function at the start of the retried function except that the error from it won't be retried?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The trick is that there are multiple retried funcs. Having a “before” func guarantees execution of one piece before all the others … which is crucial here because the callbacks & channels have to get recreated every time.

I’ll clarify this in docs.

@FGasper FGasper merged commit fa1264e into mongodb-labs:main Dec 4, 2024
49 checks passed
@FGasper FGasper deleted the felipe_fix_doc_read_retry branch December 4, 2024 00:39
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