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

Improve support and documentation for manual offsets #1135

Merged
merged 5 commits into from
Dec 17, 2023

Conversation

erikvanoosten
Copy link
Collaborator

@erikvanoosten erikvanoosten commented Dec 13, 2023

According to the javadoc of seek, when a given offset is invalid, it 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. 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.

…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.
@erikvanoosten erikvanoosten changed the title Add default to manual offset retrieval Improving manual offset retrieval Dec 16, 2023
@erikvanoosten erikvanoosten marked this pull request as ready for review December 16, 2023 17:12
@erikvanoosten erikvanoosten changed the title Improving manual offset retrieval Improving support and documentation for manual offsets Dec 16, 2023
@erikvanoosten erikvanoosten changed the title Improving support and documentation for manual offsets Improve support and documentation for manual offsets Dec 16, 2023
getOffsets(tps).flatMap { offsets =>
ZIO
.attempt(offsets.foreach { case (tp, offset) => c.seek(tp, offset) })
.as(offsets.keySet)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change?

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 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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@erikvanoosten erikvanoosten merged commit a42211a into master Dec 17, 2023
3 of 10 checks passed
@erikvanoosten erikvanoosten deleted the doc-offset-retrieval branch December 17, 2023 10:35
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.

None yet

2 participants