-
Notifications
You must be signed in to change notification settings - Fork 11
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-5470 Fix hang when handler thread hits an error. #86
Conversation
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 % two small things.
internal/verifier/check.go
Outdated
if err = verifier.waitForChangeStream(ctx, csr); err != nil { | ||
return errors.Wrapf( | ||
err, | ||
"failed to close %s", |
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.
How is the error related to closing a change stream reader?
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’ll reword.
verifier.SetSrcNamespaces([]string{db.Name() + ".mycoll"}) | ||
verifier.SetDstNamespaces([]string{db.Name() + ".mycoll"}) | ||
verifier.SetNamespaceMap() | ||
// verifier.SetVerifyAll(true) |
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.
why is this line commented out?
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.
cruft. REmoving.
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.
This is a fairly large and complex diff for a codebase I don't understand very well. It looks okay, but there's a lot going on here. It seems like there's a lot more changes than the bare minimum needed to prevent the hang. Did you do some significant refactoring as well?
Would it be possible to split this up into multiple PRs?
internal/util/ctxutil.go
Outdated
// | ||
// NB: The returned error wraps both the context’s original error | ||
// *and* the error’s cause. | ||
func WrapCtxErrWithCause(ctx context.Context) error { |
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.
Is there any reason this isn't the same code as ctxutil.Err
from mongo-go/ctxutil
?
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.
None in particular; I can copy that over.
internal/verifier/change_stream.go
Outdated
} | ||
} | ||
|
||
// This will prevent the reader from hanging. |
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 think it'd be good to say why it will prevent it from hanging.
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.
done
I left a lot of debug logging in because they seem potentially useful and unlikely to pollute logs (excessively, anyhow).
No, actually. There’s some renaming (e.g.,
It seems a mite excessive for a <1k-line PR, most of whose changes are logging, but of course I wrote the changes. :) I can go back over this and make discrete commits. |
c017079
to
6dc9081
Compare
@autarch I’ve separated this into discrete commits. |
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
I think the reason I'm struggling with this is that I don't particularly understand the state of the code before the PR. So this seems like a fairly large change to review in that context. I think discrete commits would make this a lot easier for me to review. I did take a look at the commit history but it didn't look amenable to a commit-by-commit review, which is part of why I asked if this could be broken up differently. |
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!
This fixes a hang that previously happened if migration-verifier received an event that it couldn’t handle.
Specific changes:
This also removes a flapping assertion in
TestStartAtTimeNoChanges
.