Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Add the ability to rewind offsets based on time #179

Closed
wants to merge 1 commit into from

Conversation

aravindvs
Copy link

Recent Kafka and sarama has the ability to fetch offsets by timestamp;
see:
https://github.com/Shopify/sarama/wiki/Frequently-Asked-Questions

This is very helpful in cases where we need to rewind the offset and
reset our consumption to some earlier time. Some example is, let's say
the downstream app goes down or something and we need to rewind to some
time earlier.

This patch will help achieve this by rewinding the offset for the given
topic for all the paritions to which this consumer worker subscribes to.
This should make sure we "pause" the current consumption, reset the
offset and then resume (rebalance) the consumption before returning.

Also added a UT to rewind the offset and an example test on how to use
the API

Recent Kafka and sarama has the ability to fetch offsets by timestamp;
see:
https://github.com/Shopify/sarama/wiki/Frequently-Asked-Questions

This is very helpful in cases where we need to rewind the offset and
reset our consumption to some earlier time. Some example is, let's say
the downstream app goes down or something and we need to rewind to some
time earlier.

This patch will help achieve this by rewinding the offset for the given
topic for all the paritions to which this consumer worker subscribes to.
This should make sure we "pause" the current consumption, reset the
offset and then resume (rebalance) the consumption before returning.

Also added a UT to rewind the offset and an example test on how to use
the API
@aravindvs
Copy link
Author

@dim - please take a look and see if this or something equivalent to this can be done.. this will be very useful especially now with the ability to get offsets from timestamp supported in both Kafka and sarama lib..

@dim
Copy link
Member

dim commented Nov 8, 2017

@aravindvs will try, probably later this week, thanks for this!

@prune998
Copy link

+1, we definitly need this !

@jerrygb
Copy link

jerrygb commented Dec 11, 2017

+1, it would helpful for us as well. 👍

I not sure about convention used by the project to vote on the commit. Sorry if its incorrect :)

@dim
Copy link
Member

dim commented Dec 19, 2017

hey all, apologies again for the delay, I will take a closer look in the next few days.

@gvishnutej
Copy link

@dim Would love to use this rewind offset feature, hope this PR will be merged soon

@prune998
Copy link

too bad nobody is taking care...

@dim
Copy link
Member

dim commented Feb 23, 2018 via email

@prune998
Copy link

thanks @dim, have a good trip :)

@davecb
Copy link

davecb commented Mar 7, 2018

I'd like to add myself to the list of consumers of this improvement: I have a log extractor that awaits it.

@dim
Copy link
Member

dim commented Apr 17, 2018

Hey all, I am currently working on the integration of a low level consumer group into sarama, see here: IBM/sarama#1083. It allows users to write their own, custom consumer implementations. Once accepted, I will work on the higher level cluster consumer (sarama-cluster V3) where I will aim to provide this feature.

@dim dim closed this Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants