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

OffsetManager: match upstream mark/next behaviour #713

Merged
merged 1 commit into from
Jul 26, 2016

Conversation

eapache
Copy link
Contributor

@eapache eapache commented Jul 26, 2016

Upstream requires you mark last-consumed+1 and then returns that value directly.
We were requiring you mark last-consumed and then adding one to the returned
value.

Match upstream's behaviour so that our offset tracking is interoperable.

Fixes #705.

@Kane-Sendgrid

@tcrayford
Copy link
Contributor

@eapache does this mean that all consumers that use the offset manager that upgrade past this patch will drop a single message during the upgrade?

@eapache
Copy link
Contributor Author

eapache commented Jul 26, 2016

It depends on what you were using before. If you were sharing the offset topic with an upstream java producer consumer you were already potentially inconsistent because of the different expectations.

If you were using the previous Sarama behaviour as documented (storing the offset of the last-consumed message) then an upgrade should cause you to consume a single message twice (the previous code will consume X and mark X, then the new code will read X, consume X, and mark X+1). Your consumer should already be able to handle that safely because it can occur in other scenarios.

Note that either way you should ensure that code using the behaviour in this PR commits last-consumed + 1 instead of just last-consumed. Otherwise you will see duplicate messages consumed every time your consumer restarts.

Upstream requires you mark last-consumed+1 and then returns that value directly.
We were requiring you mark last-consumed and then adding one to the returned
value.

Match upstream's behaviour so that our offset tracking is interoperable.

Fixes #705.
@eapache eapache force-pushed the match-upstream-offset-manager branch from b096b15 to ccab789 Compare July 26, 2016 17:17
@eapache
Copy link
Contributor Author

eapache commented Jul 26, 2016

I've added a more explicit warning to the changelog, but since consumers should already be able to handle duplicates (and this change will at worst cause a single duplicate message when a consumer restarts) I'm not too worried.

@eapache
Copy link
Contributor Author

eapache commented Jul 26, 2016

cc @dim FYI - I don't think sarama-cluster is using our offset-manager but I know you took some inspiration from it so you might have the same issue.

@tcrayford
Copy link
Contributor

@eapache ok, that seems fine

@eapache eapache merged commit e8020bf into master Jul 26, 2016
@eapache eapache deleted the match-upstream-offset-manager branch July 26, 2016 17:35
@dim
Copy link
Contributor

dim commented Jul 27, 2016

@eapache thanks for the heads up - fixed in bsm/sarama-cluster@6fdf904

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.

4 participants