-
Notifications
You must be signed in to change notification settings - Fork 133
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
Improve support and documentation for manual offsets #1135
Conversation
d0123ea
to
b09383b
Compare
…t falls back to the `auto.offset.reset` configuration. In this change we allow the user to set that configuration when `Manual` offset retrieval is used. This PR also contains a behavior change. For Manual offsets, when no offset is given by the user, before we would skip the records from the first poll. After this change those are no longer skipped. In addition, add documentation on how to configure offset retrieval. Note: this change is source compatible, but not binary compatible.
b09383b
to
87e30f7
Compare
getOffsets(tps).flatMap { offsets => | ||
ZIO | ||
.attempt(offsets.foreach { case (tp, offset) => c.seek(tp, offset) }) | ||
.as(offsets.keySet) |
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 this change?
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 relates to this part of the PR description:
This PR also contains a behavior change. For Manual offsets, when no offset is given by the user, before we would skip the records from the first poll. After this change those are no longer skipped.
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.
And also to this part:
Furthermore, testing showed that we fall back to 'Auto' behavior when no offset is given.
Basically, how it was before we would loose data for this particular edge case.
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.
Ah I see how the method is being used now. It could use a comment what the return value means.
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.
Indeed, I'll add that.
According to the javadoc of
seek
, when a given offset is invalid, it falls back to theauto.offset.reset
configuration. In this change we allow the user to set that configuration whenManual
offset retrieval is used. Furthermore, testing showed that we fall back to 'Auto' behavior when no offset is given.This PR also contains a behavior change. For Manual offsets, when no offset is given by the user, before we would skip the records from the first poll. After this change those are no longer skipped.
In addition, add documentation on how to configure offset retrieval.
Note: this change is source compatible, but not binary compatible.