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

Add support for timestamp offset_reset_policy #137

Conversation

danmarcab
Copy link
Contributor

closes #136

# than all the messages in the partition.
# -1 is not a valid offset you can use with `:brod.fetch` so we need to
# resolve the latest offset instead
lookup_offset(hosts, topic, partition, :latest, client_config)
Copy link
Member

Choose a reason for hiding this comment

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

Would anyone want to reset to earliest instead? Maybe it should be {:timestamp, timestamp, :earliest | :latest}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following the docs here https://github.com/kafka4beam/brod/blob/master/src/brod.erl#L1125-L1157

The function returns the offset of the first message
with the given timestamp, or of the first message after
the given timestamp

I assumed the logical conclusion was to go for the latest, because it's the one after the timestamp you asked for

Happy to add the option if you think it's best

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Fine by me as is then. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome ❤️ , let me know if anything else needs to be done before this can be merged

@danmarcab danmarcab marked this pull request as ready for review March 6, 2024 17:36
@josevalim josevalim merged commit b77f92e into dashbitco:main Mar 6, 2024
4 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@danmarcab danmarcab deleted the feat/allow-timestamp-for-offset-reset-policy branch March 6, 2024 17:54
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.

Add support for reseting offsets to a specific timestamp
2 participants