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

What to do when ctx.ErrC channel provides an error? #13

Open
maustin75 opened this issue Jul 29, 2018 · 1 comment
Open

What to do when ctx.ErrC channel provides an error? #13

maustin75 opened this issue Jul 29, 2018 · 1 comment

Comments

@maustin75
Copy link

This is more of a question and not an issue:

I'm trying to figure out what we should do when we get an error. I don't want to skip oplog messages.

Some initial ideas:

  1. We keep going thinking that gtm will handle and we won't skip oplog records
  2. Stop (ctx.Stop() ) and restart with gtm.Start using the offset we have been saving when we get a success handling of ctx.OpC

Your thoughts would be appreciated. Basically, to ensure handling of all oplog messages, how would we deal with ctx.ErrC events?

Thanks,
Mike

@rwynn
Copy link
Owner

rwynn commented Aug 2, 2018

@maustin75 Sorry for taking a while to respond to your question. I guess it depends on the error and in this regard gtm could probably give you more structured information about what happened future updates. You are doing what I would do which is to keep track of the offset for records which you have successfully processed. In addition to the ctx.Stop there is also a ctx.Since which takes a Timestamp. The latter is lighter and simply updates the oplog query to include events occurring after the argument, so you can use it to effectively go backward and reprocess events. Stop on the other hand will cause all the go routines to shut down. Stop will also cause any direct reads to shut down whereas Since only works on the go routine tailing the oplog.

For the most part the errors you would encounter would be serialization errors (more common if you use your own function since by default a generic map is used) and connection type errors. For connection errors gtm simply keeps retrying the connection until it is stopped by user code or reconnects. Since gtm holds on to the last successful oplog entry processed it should pick up where it left off for connection type errors.

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

No branches or pull requests

2 participants