You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Manikumar <ma...@gmail.com> on 2024/11/04 09:22:34 UTC
[DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Hi everyone,
I would like to start a discussion on KIP-1106:
https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
This KIP proposes to add an additional auto offset reset strategy for
consumer clients.
Regards,
Manikumar
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Dániel,
Thanks for the review,
DU1,DU2: Based on suggestions, I have updated the config option to
support ISO format.
DU3: We will compute the timestamp on the client side and use that
timestamp to fetch the offset from the server. This will be similar to
the kafka-consumer-group cmd's --by-duration reset option.
Thanks,
On Mon, Nov 4, 2024 at 9:08 PM Dániel Urbán <ur...@gmail.com> wrote:
>
> Hi Manikumar,
>
> Thanks for the KIP! I have a few questions:
> 1. Why did you choose the "minus-" prefix for the new value format? Can't
> we just drop the prefix? If we have to keep the prefix, I'd suggest
> "last-N-Duration", as it somewhat "rhymes" with latest-earliest.
> 2. Should minutes and seconds be also supported as durations? What about
> fractions? I think the rejected ISO format has the advantage of flexibility
> in this regard.
> 3. More like a clarification than a question: "we will use
> ListOffsetRequest to fetch the offset for the timestamp of the configured
> duration" - this means that the offset will be reset based on the broker's
> clock, and not the client's clock, correct?
>
> Thanks,
> Daniel
>
> Manikumar <ma...@gmail.com> ezt írta (időpont: 2024. nov. 4., H,
> 10:23):
>
> > Hi everyone,
> > I would like to start a discussion on KIP-1106:
> >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >
> > This KIP proposes to add an additional auto offset reset strategy for
> > consumer clients.
> >
> > Regards,
> > Manikumar
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Dániel Urbán <ur...@gmail.com>.
Hi Manikumar,
Thanks for the KIP! I have a few questions:
1. Why did you choose the "minus-" prefix for the new value format? Can't
we just drop the prefix? If we have to keep the prefix, I'd suggest
"last-N-Duration", as it somewhat "rhymes" with latest-earliest.
2. Should minutes and seconds be also supported as durations? What about
fractions? I think the rejected ISO format has the advantage of flexibility
in this regard.
3. More like a clarification than a question: "we will use
ListOffsetRequest to fetch the offset for the timestamp of the configured
duration" - this means that the offset will be reset based on the broker's
clock, and not the client's clock, correct?
Thanks,
Daniel
Manikumar <ma...@gmail.com> ezt írta (időpont: 2024. nov. 4., H,
10:23):
> Hi everyone,
> I would like to start a discussion on KIP-1106:
>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>
> This KIP proposes to add an additional auto offset reset strategy for
> consumer clients.
>
> Regards,
> Manikumar
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Matthias,
Thanks for the explanation.
> I am wondering if AutoOffsetReset should be an interface (we usually
just use classes)?
I have converted `AutoOffsetReset` to a class now.
Thanks.
On Fri, Nov 8, 2024 at 11:41 PM Matthias J. Sax <mj...@apache.org> wrote:
>
> >> I was assuming we will be using the underlying consumer config here. I
> >> will update based on your suggestions.
>
> Well, yes we can, be for KS we only use the underlying consumer config
> if there is not code base overwrite. The consumer config only serves as
> the default. It works similar to `default.api.timeout.ms` which might be
> overwritten on a per method basis.
>
> For such on code based overwrite, we need a good API.
>
> For Kafka Streams, it's in general more complicate. We can read from
> more than one input topic, and allow to set a different reset policy per
> topic. Thus, under the hood, KS often need to configure the consumer
> with `auto.offset.reset=none` and catches the corresponding exception
> and does an explicit `seekToBeginning()` or `seekToEnd()` on a per topic
> basis.
>
>
> I am wondering if AutoOffsetReset should be an interface (we usually
> just use classes)? I would also not expose getters `name()` and
> `timestamp()` -- in KS, we usually use non-public sub-classed which add
> the necessary getters. Users don't need getters, so we try to hide them
> o keep the public API surface area as small as possible.
>
> Cf GroupedInternal which extends Grouped:
> https://github.com/apache/kafka/blob/trunk/streams/src/main/java/org/apache/kafka/streams/kstream/internals/GroupedInternal.java
>
> We don't have an interface as we don't need none, and GroupedInternal
> has the necessary getters. Of course, the KIP does not need to define
> `AutoOffsetResetInternal` but only the public / user-facing
> `AutoOffsetReset` class.
>
>
> -Matthias
>
> On 11/7/24 10:23 PM, Manikumar wrote:
> > Hi Matthias,
> >
> > Thanks for the comments.
> >
> >> I am personally not convinced that adding a new config
> > `auto.offset.reset.by.duration` is the best way.
> >
> > I think in this case, we felt it's better to add the strategy name to
> > auto.offset.reset config and add additional strategy specific configs.
> > This will be easy to understand and extend in future. I am open to
> > change if there are similar concerns.
> >
> >> One question about "earliest_local": if we fetch this offset from the
> > server, and seek it later, and start fetching, won't there be a race
> > condition? the server would just need to reload it from the tier.
> >
> > Yes, your understanding is correct. the server will read from the tier storage.
> > Anyhow, I will consider dropping earliest_local based on Jun's suggestion.
> >
> >> For Kafka Streams, just adding the new option so the existing enum does
> > not work IMHO. If a user would use BY_DURATION, there is no option to pass
> > in the actual duration (and we might need to throw an exception).
> >
> > I was assuming we will be using the underlying consumer config here. I
> > will update based on your suggestions.
> >
> >
> > Thanks,
> >
> >
> >
> >
> > On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
> >>
> >> Thanks for updating the KIP.
> >>
> >> I am personally not convinced that adding a new config
> >> `auto.offset.reset.by.duration` is the best way. Kafka in general has
> >> way too many configs and trying to avoid adding more configs seems to be
> >> desirable? -- It seems this might be a point of contention, and if the
> >> majority of people wants this new config so be it. I just wanted to
> >> stress my concerns about it.
> >>
> >> One question about "earliest_local": if we fetch this offset from the
> >> server, and seek to it later, and start fetching, won't there be a race
> >> condition? The oldest segment could have been discarded locally in the
> >> mean time? Maybe not too much of a big deal: the server would just need
> >> to reload it from the tier. Just want to ensure my understanding is
> >> correct, and make sure nobody has concerns about it.
> >>
> >> For Kafka Streams, just adding the new option so the existing enum does
> >> not work IMHO.
> >>
> >> For example, we have a method:
> >>
> >> addSource(final AutoOffsetReset offsetReset,
> >> final String name,
> >> final String... topics)
> >>
> >> If a user would use BY_DURATION, there is no option to pass in the
> >> actual duration (and we might need to throw an exception). And if we
> >> overload `addSource` adding a fourth parameter, it would be odd too, as
> >> users could pass in `EARLIEST` plus a duration, and we would need to
> >> throw an exception or ignore the given duration. Overall not an easy to
> >> use API.
> >>
> >> Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
> >> and add a new class `AutoOffsetReset` for which we can guide users
> >> accordingly avoiding corner cases:
> >>
> >> public class AutoOffsetReset() {
> >> public static AutoOffsetReset earliest();
> >> public static AutoOffsetReset latest();
> >> public static AutoOffsetReset byDuration(Duration duration);
> >> public static AutoOffsetReset earliestLocal();
> >> }
> >>
> >> The existing enum is contained inside `Topology` so we can add the new
> >> class just for package `org.apache.kafka.streams` to avoid naming conflicts.
> >>
> >> Additionally, we would deprecate all methods taking existing enum
> >> `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> >> affected) and add new overload which accepts the new `class
> >> AutoOffsetReset` instead.
> >>
> >>
> >> -Matthias
> >>
> >> On 11/7/24 1:57 PM, Jun Rao wrote:
> >>> Hi, Manikumar,
> >>>
> >>> Thanks for the KIP. A couple of comments.
> >>>
> >>> JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
> >>> sense for a consumer app to bootstrap based on time. The time that a topic
> >>> is kept locally seems irrelevant to a consumer application.
> >>>
> >>> JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> >>> covers the common scenario in KIP-842 and is simpler. The scenario
> >>> described in KIP-842 is about which initial offset to use when a new
> >>> partition is added. This is more or less the same problem for choosing the
> >>> initial offset for existing partitions. Having a time based option provides
> >>> more flexibility than earliest or latest, and is likely good enough for
> >>> most usage.
> >>>
> >>> Jun
> >>>
> >>>
> >>> On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
> >>> wrote:
> >>>
> >>>> Thanks Manikumar and Andrew.
> >>>>
> >>>> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> >>>> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
> >>>> itself. However I agree that this is just another convenient way and not
> >>>> necessary to support functionality. Skipping it sounds good to me.
> >>>>
> >>>> Regards,
> >>>> Apoorv Mittal
> >>>>
> >>>>
> >>>> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> >>>> andrew_schofield_jira@outlook.com> wrote:
> >>>>
> >>>>> Hi Manikumar,
> >>>>>
> >>>>> AS7: In response to AM6, I agree that in general the combination
> >>>>> of offsetsForTimes() and seek() will do what is required. The one case
> >>>> that
> >>>>> I think is more tricky is seeking to the local earliest/beginning.
> >>>>>
> >>>>> The Consumer API has Consumer.beginningOffsets and
> >>>>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> >>>>> Similarly there are methods for OffsetResetStrategy.LATEST.
> >>>>>
> >>>>> With the Consumer API, I don't think you can find the local earliest
> >>>>> offset.
> >>>>> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> >>>>> We could add equivalents of Consumer.beginningOffsets and
> >>>>> Consumer.seekToBeginning. An application could always use the
> >>>>> Admin API with the Consumer API.
> >>>>>
> >>>>> Personally, I would not complicate this KIP with these new methods when
> >>>>> the focus is more on duration-based offset reset and configs.
> >>>>>
> >>>>> Thanks,
> >>>>> Andrew
> >>>>> ________________________________________
> >>>>> From: Manikumar <ma...@gmail.com>
> >>>>> Sent: 06 November 2024 04:20
> >>>>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> >>>>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> >>>>> for consumer clients
> >>>>>
> >>>>> Hi Apoorv,
> >>>>>
> >>>>> Thanks for the review.
> >>>>>
> >>>>> AM5: Thanks, Updated the KIP.
> >>>>>
> >>>>> AM6: Currently we can achieve this with the combination of
> >>>>> offsetsForTimes() and seek() API..
> >>>>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> >>>>> Long> timestampsToSearch) if required.
> >>>>> Let's see what others think.
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> >>>>> wrote:
> >>>>>>
> >>>>>> Hi Manikumar,
> >>>>>> Thanks for the changes. Just minor comment and a question:
> >>>>>>
> >>>>>> AM5: The description "How to initialize the share-partition start
> >>>>> offset:"
> >>>>>> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> >>>>>> Should we write the details as defined in KIP-932 i.e.
> >>>>>>
> >>>>>> How to initialize the share-partition start offset:
> >>>>>>
> >>>>>> -
> >>>>>>
> >>>>>> "earliest" : automatically reset the offset to the earliest offset
> >>>>>> -
> >>>>>>
> >>>>>> "latest" : automatically reset the offset to the latest offset
> >>>>>> -
> >>>>>>
> >>>>>> "*earliest_local": *automatically resets the offset to the earliest
> >>>>>> message stored in the local log on the broker.
> >>>>>> -
> >>>>>>
> >>>>>> "*by_duration": *automatically resets the offset to the earliest
> >>>>> offset
> >>>>>> whose timestamp is greater than or equal to the configured duration
> >>>>>> * (auto.offset.reset.by.duration).*
> >>>>>>
> >>>>>>
> >>>>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> >>>>>> share-partition start offset." as the details of the new configs are
> >>>>>> defined at top in different sections as well.
> >>>>>>
> >>>>>> AM6: Question: KafkaConsumer has public methods defined to "seek" for
> >>>> the
> >>>>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> >>>>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
> >>>> it
> >>>>>> would be sensible to add additional KafkaConsumer APIs for newly
> >>>>> introduced
> >>>>>> strategies?
> >>>>>>
> >>>>>> Regards,
> >>>>>> Apoorv Mittal
> >>>>>>
> >>>>>>
> >>>>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> >>>>> wrote:
> >>>>>>
> >>>>>>> Hi Matthias,
> >>>>>>>
> >>>>>>> Thanks for the review.
> >>>>>>>
> >>>>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> >>>> should
> >>>>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
> >>>>>>> proposing to add new configs (auto.offset.reset.on.no.initial.offset
> >>>>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> >>>>>>> after completing this KIP.
> >>>>>>>
> >>>>>>> MS2: Added support for earliest-local config to reset to oldest local
> >>>>>>> offset and changes to kafka-consumer-group cmd.
> >>>>>>>
> >>>>>>> MS3: Based on suggestions, I have updated the config option to
> >>>> support
> >>>>>>> ISO format.
> >>>>>>>
> >>>>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> >>>>>>> definitely need your help on refining the API/solution for KS :)
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> >>>>> wrote:
> >>>>>>>>
> >>>>>>>> Thanks for the KIP.
> >>>>>>>>
> >>>>>>>> A somewhat orthogonal question I have is, if we should try to merge
> >>>>> this
> >>>>>>>> KIP with the existing KIP-842:
> >>>>>>>>
> >>>>>>>
> >>>>>
> >>>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> >>>>>>>>
> >>>>>>>> While KIP-842 has a different intention, ie, separating the case of
> >>>>> "no
> >>>>>>>> offset during initial startup" vs "offset out of bounds during
> >>>>>>>> processing", it might still be worth it? My motivation for this
> >>>>> question
> >>>>>>>> is, that `auto.offset.reset` is one of the most central configs we
> >>>>> have,
> >>>>>>>> and thus, doing a single larger change (ie, both KIPs together)
> >>>>> might be
> >>>>>>>> better (less noise) than doing two independent changes? Thoughts? I
> >>>>> know
> >>>>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> About the KIP itself, did we consider to add something like
> >>>>>>>> "latest-local" to say reset to oldest local, but not fetch from
> >>>>> tiered
> >>>>>>>> storage?
> >>>>>>>>
> >>>>>>>> For the format of the config, did we consider what we do in
> >>>>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
> >>>> like
> >>>>>>>>
> >>>>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> >>>>>>>> --shift-by <number-of-records>
> >>>>>>>>
> >>>>>>>> --to-datetime <fixed point in time: format
> >>>>> `YYYY-MM-DDTHH:mm:SS.sss`>
> >>>>>>>> --to-offset <absolute offset>
> >>>>>>>>
> >>>>>>>> As it also uses ISO format, it might be good to also use them (even
> >>>>> if I
> >>>>>>>> can see the appeal and simplicity of what you proposed).
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> I also want to add to (AM1), as there is also
> >>>>> `Topology.AutoOffsetReset`
> >>>>>>>> enum in Kafka Streams. I think we would need to convert this into a
> >>>>>>>> class. While it could be done is a follow up KIP, too, it seems
> >>>> best
> >>>>> to
> >>>>>>>> do this holistically in a single KIP, because KS is not something
> >>>>> on-top
> >>>>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> >>>> design
> >>>>> and
> >>>>>>>> even PRs if necessary, but would strongly prefer to do it all in a
> >>>>>>>> single KIP.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Btw: if we add something like "latest-local", it might also be good
> >>>>> to
> >>>>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> >>>>> works
> >>>>>>>> slightly different, as it does commit an offset and there could be
> >>>>> some
> >>>>>>>> race condition between committing "latest-local", tiering, and when
> >>>>> the
> >>>>>>>> consumer is actually started?
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> -Matthias
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> >>>>>>>>> Hi Manikumar,
> >>>>>>>>> Thanks for the KIP, this new strategy would be helpful in
> >>>>> specifying
> >>>>>>> fetch
> >>>>>>>>> behaviour.
> >>>>>>>>>
> >>>>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
> >>>> the
> >>>>>>> enum
> >>>>>>>>> class OffsetResetStarategy which is part of kafka-clients javadoc
> >>>>>>>>> <
> >>>>>>>
> >>>>> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> >>>>> .
> >>>>>>>>> Are we also proposing to somehow add new definitions in the same
> >>>>> class?
> >>>>>>>>> However as new configurations will be a string representation
> >>>> hence
> >>>>>>> are we
> >>>>>>>>> moving away from OffsetResetStartegy enum class altogether?
> >>>> Should
> >>>>> we
> >>>>>>>>> include the change in the KIP as OffsetResetStarategy is part of
> >>>>> public
> >>>>>>>>> javadoc?
> >>>>>>>>>
> >>>>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> >>>>>>> alternative,
> >>>>>>>>> should we not follow some standard of defining duration which has
> >>>>>>> already
> >>>>>>>>> been adopted in other systems?
> >>>>>>>>>
> >>>>>>>>> AM3: We've introduced new config values using the format
> >>>>> minus-n-hours,
> >>>>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> >>>>> explicitly
> >>>>>>>>> define the "minus" prefix, or is it implied?
> >>>>>>>>>
> >>>>>>>>> AM4: When supporting duration-based resets, should we also allow
> >>>>> users
> >>>>>>> to
> >>>>>>>>> specify a specific checkpoint time? For example, if a checkpoint
> >>>>>>> occurs 2
> >>>>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
> >>>>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> >>>> might
> >>>>> not
> >>>>>>> be
> >>>>>>>>> sufficient. Should we consider adding a format to accommodate
> >>>>> specific
> >>>>>>>>> checkpoint times, or is there a reason to limit the supported
> >>>>> formats?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Regards,
> >>>>>>>>> Apoorv Mittal
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> >>>>> manikumar.reddy@gmail.com>
> >>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> Hi everyone,
> >>>>>>>>>> I would like to start a discussion on KIP-1106:
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>
> >>>>>
> >>>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >>>>>>>>>>
> >>>>>>>>>> This KIP proposes to add an additional auto offset reset
> >>>> strategy
> >>>>> for
> >>>>>>>>>> consumer clients.
> >>>>>>>>>>
> >>>>>>>>>> Regards,
> >>>>>>>>>> Manikumar
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>>>
> >>>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by "Matthias J. Sax" <mj...@apache.org>.
>> I was assuming we will be using the underlying consumer config here. I
>> will update based on your suggestions.
Well, yes we can, be for KS we only use the underlying consumer config
if there is not code base overwrite. The consumer config only serves as
the default. It works similar to `default.api.timeout.ms` which might be
overwritten on a per method basis.
For such on code based overwrite, we need a good API.
For Kafka Streams, it's in general more complicate. We can read from
more than one input topic, and allow to set a different reset policy per
topic. Thus, under the hood, KS often need to configure the consumer
with `auto.offset.reset=none` and catches the corresponding exception
and does an explicit `seekToBeginning()` or `seekToEnd()` on a per topic
basis.
I am wondering if AutoOffsetReset should be an interface (we usually
just use classes)? I would also not expose getters `name()` and
`timestamp()` -- in KS, we usually use non-public sub-classed which add
the necessary getters. Users don't need getters, so we try to hide them
o keep the public API surface area as small as possible.
Cf GroupedInternal which extends Grouped:
https://github.com/apache/kafka/blob/trunk/streams/src/main/java/org/apache/kafka/streams/kstream/internals/GroupedInternal.java
We don't have an interface as we don't need none, and GroupedInternal
has the necessary getters. Of course, the KIP does not need to define
`AutoOffsetResetInternal` but only the public / user-facing
`AutoOffsetReset` class.
-Matthias
On 11/7/24 10:23 PM, Manikumar wrote:
> Hi Matthias,
>
> Thanks for the comments.
>
>> I am personally not convinced that adding a new config
> `auto.offset.reset.by.duration` is the best way.
>
> I think in this case, we felt it's better to add the strategy name to
> auto.offset.reset config and add additional strategy specific configs.
> This will be easy to understand and extend in future. I am open to
> change if there are similar concerns.
>
>> One question about "earliest_local": if we fetch this offset from the
> server, and seek it later, and start fetching, won't there be a race
> condition? the server would just need to reload it from the tier.
>
> Yes, your understanding is correct. the server will read from the tier storage.
> Anyhow, I will consider dropping earliest_local based on Jun's suggestion.
>
>> For Kafka Streams, just adding the new option so the existing enum does
> not work IMHO. If a user would use BY_DURATION, there is no option to pass
> in the actual duration (and we might need to throw an exception).
>
> I was assuming we will be using the underlying consumer config here. I
> will update based on your suggestions.
>
>
> Thanks,
>
>
>
>
> On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
>>
>> Thanks for updating the KIP.
>>
>> I am personally not convinced that adding a new config
>> `auto.offset.reset.by.duration` is the best way. Kafka in general has
>> way too many configs and trying to avoid adding more configs seems to be
>> desirable? -- It seems this might be a point of contention, and if the
>> majority of people wants this new config so be it. I just wanted to
>> stress my concerns about it.
>>
>> One question about "earliest_local": if we fetch this offset from the
>> server, and seek to it later, and start fetching, won't there be a race
>> condition? The oldest segment could have been discarded locally in the
>> mean time? Maybe not too much of a big deal: the server would just need
>> to reload it from the tier. Just want to ensure my understanding is
>> correct, and make sure nobody has concerns about it.
>>
>> For Kafka Streams, just adding the new option so the existing enum does
>> not work IMHO.
>>
>> For example, we have a method:
>>
>> addSource(final AutoOffsetReset offsetReset,
>> final String name,
>> final String... topics)
>>
>> If a user would use BY_DURATION, there is no option to pass in the
>> actual duration (and we might need to throw an exception). And if we
>> overload `addSource` adding a fourth parameter, it would be odd too, as
>> users could pass in `EARLIEST` plus a duration, and we would need to
>> throw an exception or ignore the given duration. Overall not an easy to
>> use API.
>>
>> Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
>> and add a new class `AutoOffsetReset` for which we can guide users
>> accordingly avoiding corner cases:
>>
>> public class AutoOffsetReset() {
>> public static AutoOffsetReset earliest();
>> public static AutoOffsetReset latest();
>> public static AutoOffsetReset byDuration(Duration duration);
>> public static AutoOffsetReset earliestLocal();
>> }
>>
>> The existing enum is contained inside `Topology` so we can add the new
>> class just for package `org.apache.kafka.streams` to avoid naming conflicts.
>>
>> Additionally, we would deprecate all methods taking existing enum
>> `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
>> affected) and add new overload which accepts the new `class
>> AutoOffsetReset` instead.
>>
>>
>> -Matthias
>>
>> On 11/7/24 1:57 PM, Jun Rao wrote:
>>> Hi, Manikumar,
>>>
>>> Thanks for the KIP. A couple of comments.
>>>
>>> JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
>>> sense for a consumer app to bootstrap based on time. The time that a topic
>>> is kept locally seems irrelevant to a consumer application.
>>>
>>> JR2. I took a look at the proposal of KIP-842. It seems that this KIP
>>> covers the common scenario in KIP-842 and is simpler. The scenario
>>> described in KIP-842 is about which initial offset to use when a new
>>> partition is added. This is more or less the same problem for choosing the
>>> initial offset for existing partitions. Having a time based option provides
>>> more flexibility than earliest or latest, and is likely good enough for
>>> most usage.
>>>
>>> Jun
>>>
>>>
>>> On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
>>> wrote:
>>>
>>>> Thanks Manikumar and Andrew.
>>>>
>>>> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
>>>> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
>>>> itself. However I agree that this is just another convenient way and not
>>>> necessary to support functionality. Skipping it sounds good to me.
>>>>
>>>> Regards,
>>>> Apoorv Mittal
>>>>
>>>>
>>>> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
>>>> andrew_schofield_jira@outlook.com> wrote:
>>>>
>>>>> Hi Manikumar,
>>>>>
>>>>> AS7: In response to AM6, I agree that in general the combination
>>>>> of offsetsForTimes() and seek() will do what is required. The one case
>>>> that
>>>>> I think is more tricky is seeking to the local earliest/beginning.
>>>>>
>>>>> The Consumer API has Consumer.beginningOffsets and
>>>>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
>>>>> Similarly there are methods for OffsetResetStrategy.LATEST.
>>>>>
>>>>> With the Consumer API, I don't think you can find the local earliest
>>>>> offset.
>>>>> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
>>>>> We could add equivalents of Consumer.beginningOffsets and
>>>>> Consumer.seekToBeginning. An application could always use the
>>>>> Admin API with the Consumer API.
>>>>>
>>>>> Personally, I would not complicate this KIP with these new methods when
>>>>> the focus is more on duration-based offset reset and configs.
>>>>>
>>>>> Thanks,
>>>>> Andrew
>>>>> ________________________________________
>>>>> From: Manikumar <ma...@gmail.com>
>>>>> Sent: 06 November 2024 04:20
>>>>> To: dev@kafka.apache.org <de...@kafka.apache.org>
>>>>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
>>>>> for consumer clients
>>>>>
>>>>> Hi Apoorv,
>>>>>
>>>>> Thanks for the review.
>>>>>
>>>>> AM5: Thanks, Updated the KIP.
>>>>>
>>>>> AM6: Currently we can achieve this with the combination of
>>>>> offsetsForTimes() and seek() API..
>>>>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
>>>>> Long> timestampsToSearch) if required.
>>>>> Let's see what others think.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Hi Manikumar,
>>>>>> Thanks for the changes. Just minor comment and a question:
>>>>>>
>>>>>> AM5: The description "How to initialize the share-partition start
>>>>> offset:"
>>>>>> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
>>>>>> Should we write the details as defined in KIP-932 i.e.
>>>>>>
>>>>>> How to initialize the share-partition start offset:
>>>>>>
>>>>>> -
>>>>>>
>>>>>> "earliest" : automatically reset the offset to the earliest offset
>>>>>> -
>>>>>>
>>>>>> "latest" : automatically reset the offset to the latest offset
>>>>>> -
>>>>>>
>>>>>> "*earliest_local": *automatically resets the offset to the earliest
>>>>>> message stored in the local log on the broker.
>>>>>> -
>>>>>>
>>>>>> "*by_duration": *automatically resets the offset to the earliest
>>>>> offset
>>>>>> whose timestamp is greater than or equal to the configured duration
>>>>>> * (auto.offset.reset.by.duration).*
>>>>>>
>>>>>>
>>>>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
>>>>>> share-partition start offset." as the details of the new configs are
>>>>>> defined at top in different sections as well.
>>>>>>
>>>>>> AM6: Question: KafkaConsumer has public methods defined to "seek" for
>>>> the
>>>>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
>>>>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
>>>> it
>>>>>> would be sensible to add additional KafkaConsumer APIs for newly
>>>>> introduced
>>>>>> strategies?
>>>>>>
>>>>>> Regards,
>>>>>> Apoorv Mittal
>>>>>>
>>>>>>
>>>>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>>> Hi Matthias,
>>>>>>>
>>>>>>> Thanks for the review.
>>>>>>>
>>>>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
>>>> should
>>>>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
>>>>>>> proposing to add new configs (auto.offset.reset.on.no.initial.offset
>>>>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
>>>>>>> after completing this KIP.
>>>>>>>
>>>>>>> MS2: Added support for earliest-local config to reset to oldest local
>>>>>>> offset and changes to kafka-consumer-group cmd.
>>>>>>>
>>>>>>> MS3: Based on suggestions, I have updated the config option to
>>>> support
>>>>>>> ISO format.
>>>>>>>
>>>>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
>>>>>>> definitely need your help on refining the API/solution for KS :)
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
>>>>> wrote:
>>>>>>>>
>>>>>>>> Thanks for the KIP.
>>>>>>>>
>>>>>>>> A somewhat orthogonal question I have is, if we should try to merge
>>>>> this
>>>>>>>> KIP with the existing KIP-842:
>>>>>>>>
>>>>>>>
>>>>>
>>>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
>>>>>>>>
>>>>>>>> While KIP-842 has a different intention, ie, separating the case of
>>>>> "no
>>>>>>>> offset during initial startup" vs "offset out of bounds during
>>>>>>>> processing", it might still be worth it? My motivation for this
>>>>> question
>>>>>>>> is, that `auto.offset.reset` is one of the most central configs we
>>>>> have,
>>>>>>>> and thus, doing a single larger change (ie, both KIPs together)
>>>>> might be
>>>>>>>> better (less noise) than doing two independent changes? Thoughts? I
>>>>> know
>>>>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
>>>>>>>>
>>>>>>>>
>>>>>>>> About the KIP itself, did we consider to add something like
>>>>>>>> "latest-local" to say reset to oldest local, but not fetch from
>>>>> tiered
>>>>>>>> storage?
>>>>>>>>
>>>>>>>> For the format of the config, did we consider what we do in
>>>>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
>>>> like
>>>>>>>>
>>>>>>>> --by-duration <duration: format `PnDTnHnMnS`>
>>>>>>>> --shift-by <number-of-records>
>>>>>>>>
>>>>>>>> --to-datetime <fixed point in time: format
>>>>> `YYYY-MM-DDTHH:mm:SS.sss`>
>>>>>>>> --to-offset <absolute offset>
>>>>>>>>
>>>>>>>> As it also uses ISO format, it might be good to also use them (even
>>>>> if I
>>>>>>>> can see the appeal and simplicity of what you proposed).
>>>>>>>>
>>>>>>>>
>>>>>>>> I also want to add to (AM1), as there is also
>>>>> `Topology.AutoOffsetReset`
>>>>>>>> enum in Kafka Streams. I think we would need to convert this into a
>>>>>>>> class. While it could be done is a follow up KIP, too, it seems
>>>> best
>>>>> to
>>>>>>>> do this holistically in a single KIP, because KS is not something
>>>>> on-top
>>>>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
>>>> design
>>>>> and
>>>>>>>> even PRs if necessary, but would strongly prefer to do it all in a
>>>>>>>> single KIP.
>>>>>>>>
>>>>>>>>
>>>>>>>> Btw: if we add something like "latest-local", it might also be good
>>>>> to
>>>>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
>>>>> works
>>>>>>>> slightly different, as it does commit an offset and there could be
>>>>> some
>>>>>>>> race condition between committing "latest-local", tiering, and when
>>>>> the
>>>>>>>> consumer is actually started?
>>>>>>>>
>>>>>>>>
>>>>>>>> -Matthias
>>>>>>>>
>>>>>>>>
>>>>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
>>>>>>>>> Hi Manikumar,
>>>>>>>>> Thanks for the KIP, this new strategy would be helpful in
>>>>> specifying
>>>>>>> fetch
>>>>>>>>> behaviour.
>>>>>>>>>
>>>>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
>>>> the
>>>>>>> enum
>>>>>>>>> class OffsetResetStarategy which is part of kafka-clients javadoc
>>>>>>>>> <
>>>>>>>
>>>>> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
>>>>> .
>>>>>>>>> Are we also proposing to somehow add new definitions in the same
>>>>> class?
>>>>>>>>> However as new configurations will be a string representation
>>>> hence
>>>>>>> are we
>>>>>>>>> moving away from OffsetResetStartegy enum class altogether?
>>>> Should
>>>>> we
>>>>>>>>> include the change in the KIP as OffsetResetStarategy is part of
>>>>> public
>>>>>>>>> javadoc?
>>>>>>>>>
>>>>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
>>>>>>> alternative,
>>>>>>>>> should we not follow some standard of defining duration which has
>>>>>>> already
>>>>>>>>> been adopted in other systems?
>>>>>>>>>
>>>>>>>>> AM3: We've introduced new config values using the format
>>>>> minus-n-hours,
>>>>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
>>>>> explicitly
>>>>>>>>> define the "minus" prefix, or is it implied?
>>>>>>>>>
>>>>>>>>> AM4: When supporting duration-based resets, should we also allow
>>>>> users
>>>>>>> to
>>>>>>>>> specify a specific checkpoint time? For example, if a checkpoint
>>>>>>> occurs 2
>>>>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
>>>>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
>>>> might
>>>>> not
>>>>>>> be
>>>>>>>>> sufficient. Should we consider adding a format to accommodate
>>>>> specific
>>>>>>>>> checkpoint times, or is there a reason to limit the supported
>>>>> formats?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Apoorv Mittal
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
>>>>> manikumar.reddy@gmail.com>
>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi everyone,
>>>>>>>>>> I would like to start a discussion on KIP-1106:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>
>>>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>>>>>>>>>>
>>>>>>>>>> This KIP proposes to add an additional auto offset reset
>>>> strategy
>>>>> for
>>>>>>>>>> consumer clients.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Manikumar
>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Jun Rao <ju...@confluent.io.INVALID>.
Hi, Andrew,
Thanks for the reply. I agree that ISO8601 is more human readable and less
error prone to configure. It probably covers all common usage. So, we can
keep it as it is.
Jun
On Fri, Nov 8, 2024 at 10:26 AM Andrew Schofield <
andrew_schofield_jira@outlook.com> wrote:
> Hi Jun,
> I suggest there are two reasons why ISO8601 is a more appropriate
> choice than ms.
>
> First, kafka-consumer-groups.sh --reset-offsets --by-duration uses ISO8601.
> This KIP is providing essentially the Kafka consumer equivalent of this
> tool.
> I favour consistency with the existing way of doing this.
>
> Second, I suggest that people are going to be thinking of larger time
> units than
> milliseconds in practice, such as a few hours or days. They should not
> have to calculate how many milliseconds there are in a day.
>
> Thanks,
> Andrew
> ________________________________________
> From: Jun Rao <ju...@confluent.io.INVALID>
> Sent: 08 November 2024 17:37
> To: dev@kafka.apache.org <de...@kafka.apache.org>
> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> for consumer clients
>
> Hi, ManiKumar,
>
> Thanks for the updated PR. Another comment.
>
> JR3. Is there any benefit of using ISO8601
> for auto.offset.reset.by.duration instead of just ms in long? The latter
> covers a broader range. Also, AutoOffsetResetByDuration uses Java During,
> which covers a different granularity than ISO8601. It might be better to
> just use ms for both.
>
> Jun
>
> On Fri, Nov 8, 2024 at 5:51 AM Manikumar <ma...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > I have updated the KIP with recent suggestions.
> >
> > Thanks.
> >
> > On Fri, Nov 8, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
> > wrote:
> > >
> > > Hi Matthias,
> > >
> > > Thanks for the comments.
> > >
> > > > I am personally not convinced that adding a new config
> > > `auto.offset.reset.by.duration` is the best way.
> > >
> > > I think in this case, we felt it's better to add the strategy name to
> > > auto.offset.reset config and add additional strategy specific configs.
> > > This will be easy to understand and extend in future. I am open to
> > > change if there are similar concerns.
> > >
> > > > One question about "earliest_local": if we fetch this offset from the
> > > server, and seek it later, and start fetching, won't there be a race
> > > condition? the server would just need to reload it from the tier.
> > >
> > > Yes, your understanding is correct. the server will read from the tier
> > storage.
> > > Anyhow, I will consider dropping earliest_local based on Jun's
> > suggestion.
> > >
> > > > For Kafka Streams, just adding the new option so the existing enum
> does
> > > not work IMHO. If a user would use BY_DURATION, there is no option to
> > pass
> > > in the actual duration (and we might need to throw an exception).
> > >
> > > I was assuming we will be using the underlying consumer config here. I
> > > will update based on your suggestions.
> > >
> > >
> > > Thanks,
> > >
> > >
> > >
> > >
> > > On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org>
> wrote:
> > > >
> > > > Thanks for updating the KIP.
> > > >
> > > > I am personally not convinced that adding a new config
> > > > `auto.offset.reset.by.duration` is the best way. Kafka in general
> has
> > > > way too many configs and trying to avoid adding more configs seems to
> > be
> > > > desirable? -- It seems this might be a point of contention, and if
> the
> > > > majority of people wants this new config so be it. I just wanted to
> > > > stress my concerns about it.
> > > >
> > > > One question about "earliest_local": if we fetch this offset from the
> > > > server, and seek to it later, and start fetching, won't there be a
> race
> > > > condition? The oldest segment could have been discarded locally in
> the
> > > > mean time? Maybe not too much of a big deal: the server would just
> need
> > > > to reload it from the tier. Just want to ensure my understanding is
> > > > correct, and make sure nobody has concerns about it.
> > > >
> > > > For Kafka Streams, just adding the new option so the existing enum
> does
> > > > not work IMHO.
> > > >
> > > > For example, we have a method:
> > > >
> > > > addSource(final AutoOffsetReset offsetReset,
> > > > final String name,
> > > > final String... topics)
> > > >
> > > > If a user would use BY_DURATION, there is no option to pass in the
> > > > actual duration (and we might need to throw an exception). And if we
> > > > overload `addSource` adding a fourth parameter, it would be odd too,
> as
> > > > users could pass in `EARLIEST` plus a duration, and we would need to
> > > > throw an exception or ignore the given duration. Overall not an easy
> to
> > > > use API.
> > > >
> > > > Thus, I would suggest to deprecate the existing `AutoOffsetReset`
> enum,
> > > > and add a new class `AutoOffsetReset` for which we can guide users
> > > > accordingly avoiding corner cases:
> > > >
> > > > public class AutoOffsetReset() {
> > > > public static AutoOffsetReset earliest();
> > > > public static AutoOffsetReset latest();
> > > > public static AutoOffsetReset byDuration(Duration duration);
> > > > public static AutoOffsetReset earliestLocal();
> > > > }
> > > >
> > > > The existing enum is contained inside `Topology` so we can add the
> new
> > > > class just for package `org.apache.kafka.streams` to avoid naming
> > conflicts.
> > > >
> > > > Additionally, we would deprecate all methods taking existing enum
> > > > `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> > > > affected) and add new overload which accepts the new `class
> > > > AutoOffsetReset` instead.
> > > >
> > > >
> > > > -Matthias
> > > >
> > > > On 11/7/24 1:57 PM, Jun Rao wrote:
> > > > > Hi, Manikumar,
> > > > >
> > > > > Thanks for the KIP. A couple of comments.
> > > > >
> > > > > JR1. It doesn't seem that we need earliest_local. Intuitively, it
> > makes
> > > > > sense for a consumer app to bootstrap based on time. The time that
> a
> > topic
> > > > > is kept locally seems irrelevant to a consumer application.
> > > > >
> > > > > JR2. I took a look at the proposal of KIP-842. It seems that this
> KIP
> > > > > covers the common scenario in KIP-842 and is simpler. The scenario
> > > > > described in KIP-842 is about which initial offset to use when a
> new
> > > > > partition is added. This is more or less the same problem for
> > choosing the
> > > > > initial offset for existing partitions. Having a time based option
> > provides
> > > > > more flexibility than earliest or latest, and is likely good enough
> > for
> > > > > most usage.
> > > > >
> > > > > Jun
> > > > >
> > > > >
> > > > > On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <
> > apoorvmittal10@gmail.com>
> > > > > wrote:
> > > > >
> > > > >> Thanks Manikumar and Andrew.
> > > > >>
> > > > >> For AM6: Though I was thinking of enhancing OffsetFetcher and
> adding
> > > > >> "seekToLocalBeginning" where OffsetFetcher does use
> > Admin.listOffsets API
> > > > >> itself. However I agree that this is just another convenient way
> > and not
> > > > >> necessary to support functionality. Skipping it sounds good to me.
> > > > >>
> > > > >> Regards,
> > > > >> Apoorv Mittal
> > > > >>
> > > > >>
> > > > >> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> > > > >> andrew_schofield_jira@outlook.com> wrote:
> > > > >>
> > > > >>> Hi Manikumar,
> > > > >>>
> > > > >>> AS7: In response to AM6, I agree that in general the combination
> > > > >>> of offsetsForTimes() and seek() will do what is required. The one
> > case
> > > > >> that
> > > > >>> I think is more tricky is seeking to the local
> earliest/beginning.
> > > > >>>
> > > > >>> The Consumer API has Consumer.beginningOffsets and
> > > > >>> seekToBeginning, which correspond to
> OffsetResetStrategy.EARLIEST.
> > > > >>> Similarly there are methods for OffsetResetStrategy.LATEST.
> > > > >>>
> > > > >>> With the Consumer API, I don't think you can find the local
> > earliest
> > > > >>> offset.
> > > > >>> That can be found using Admin.listOffsets with
> > OffsetSpec.EarliestLocal.
> > > > >>> We could add equivalents of Consumer.beginningOffsets and
> > > > >>> Consumer.seekToBeginning. An application could always use the
> > > > >>> Admin API with the Consumer API.
> > > > >>>
> > > > >>> Personally, I would not complicate this KIP with these new
> methods
> > when
> > > > >>> the focus is more on duration-based offset reset and configs.
> > > > >>>
> > > > >>> Thanks,
> > > > >>> Andrew
> > > > >>> ________________________________________
> > > > >>> From: Manikumar <ma...@gmail.com>
> > > > >>> Sent: 06 November 2024 04:20
> > > > >>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > > >>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> > option
> > > > >>> for consumer clients
> > > > >>>
> > > > >>> Hi Apoorv,
> > > > >>>
> > > > >>> Thanks for the review.
> > > > >>>
> > > > >>> AM5: Thanks, Updated the KIP.
> > > > >>>
> > > > >>> AM6: Currently we can achieve this with the combination of
> > > > >>> offsetsForTimes() and seek() API..
> > > > >>> Maybe we can add a generic API like
> seekToTimes(Map<TopicPartition,
> > > > >>> Long> timestampsToSearch) if required.
> > > > >>> Let's see what others think.
> > > > >>>
> > > > >>> Thanks,
> > > > >>>
> > > > >>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <
> > apoorvmittal10@gmail.com>
> > > > >>> wrote:
> > > > >>>>
> > > > >>>> Hi Manikumar,
> > > > >>>> Thanks for the changes. Just minor comment and a question:
> > > > >>>>
> > > > >>>> AM5: The description "How to initialize the share-partition
> start
> > > > >>> offset:"
> > > > >>>> for "*share.auto.offset.reset*" seems incomplete as it ends with
> > `:`.
> > > > >>>> Should we write the details as defined in KIP-932 i.e.
> > > > >>>>
> > > > >>>> How to initialize the share-partition start offset:
> > > > >>>>
> > > > >>>> -
> > > > >>>>
> > > > >>>> "earliest" : automatically reset the offset to the earliest
> > offset
> > > > >>>> -
> > > > >>>>
> > > > >>>> "latest" : automatically reset the offset to the latest
> offset
> > > > >>>> -
> > > > >>>>
> > > > >>>> "*earliest_local": *automatically resets the offset to the
> > earliest
> > > > >>>> message stored in the local log on the broker.
> > > > >>>> -
> > > > >>>>
> > > > >>>> "*by_duration": *automatically resets the offset to the
> > earliest
> > > > >>> offset
> > > > >>>> whose timestamp is greater than or equal to the configured
> > duration
> > > > >>>> * (auto.offset.reset.by.duration).*
> > > > >>>>
> > > > >>>>
> > > > >>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> > > > >>>> share-partition start offset." as the details of the new configs
> > are
> > > > >>>> defined at top in different sections as well.
> > > > >>>>
> > > > >>>> AM6: Question: KafkaConsumer has public methods defined to
> "seek"
> > for
> > > > >> the
> > > > >>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > > > >>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you
> > think
> > > > >> it
> > > > >>>> would be sensible to add additional KafkaConsumer APIs for newly
> > > > >>> introduced
> > > > >>>> strategies?
> > > > >>>>
> > > > >>>> Regards,
> > > > >>>> Apoorv Mittal
> > > > >>>>
> > > > >>>>
> > > > >>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <
> > manikumar.reddy@gmail.com>
> > > > >>> wrote:
> > > > >>>>
> > > > >>>>> Hi Matthias,
> > > > >>>>>
> > > > >>>>> Thanks for the review.
> > > > >>>>>
> > > > >>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> > > > >> should
> > > > >>>>> fit into KIP-842 (few updates definitely required) as KIP-842
> is
> > > > >>>>> proposing to add new configs (auto.offset.reset.on.no
> > .initial.offset
> > > > >>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive
> > KIP-842
> > > > >>>>> after completing this KIP.
> > > > >>>>>
> > > > >>>>> MS2: Added support for earliest-local config to reset to oldest
> > local
> > > > >>>>> offset and changes to kafka-consumer-group cmd.
> > > > >>>>>
> > > > >>>>> MS3: Based on suggestions, I have updated the config option to
> > > > >> support
> > > > >>>>> ISO format.
> > > > >>>>>
> > > > >>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > > >>>>> definitely need your help on refining the API/solution for KS
> :)
> > > > >>>>>
> > > > >>>>> Thanks
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>
> > > > >>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <
> mjsax@apache.org
> > >
> > > > >>> wrote:
> > > > >>>>>>
> > > > >>>>>> Thanks for the KIP.
> > > > >>>>>>
> > > > >>>>>> A somewhat orthogonal question I have is, if we should try to
> > merge
> > > > >>> this
> > > > >>>>>> KIP with the existing KIP-842:
> > > > >>>>>>
> > > > >>>>>
> > > > >>>
> > > > >>
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > > >>>>>>
> > > > >>>>>> While KIP-842 has a different intention, ie, separating the
> > case of
> > > > >>> "no
> > > > >>>>>> offset during initial startup" vs "offset out of bounds during
> > > > >>>>>> processing", it might still be worth it? My motivation for
> this
> > > > >>> question
> > > > >>>>>> is, that `auto.offset.reset` is one of the most central
> configs
> > we
> > > > >>> have,
> > > > >>>>>> and thus, doing a single larger change (ie, both KIPs
> together)
> > > > >>> might be
> > > > >>>>>> better (less noise) than doing two independent changes?
> > Thoughts? I
> > > > >>> know
> > > > >>>>>> it might be a little bit of a stretch, but asking cannot hurt
> :)
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> About the KIP itself, did we consider to add something like
> > > > >>>>>> "latest-local" to say reset to oldest local, but not fetch
> from
> > > > >>> tiered
> > > > >>>>>> storage?
> > > > >>>>>>
> > > > >>>>>> For the format of the config, did we consider what we do in
> > > > >>>>>> `bin/kafka-consumer-group.sh`? It has multiple different
> options
> > > > >> like
> > > > >>>>>>
> > > > >>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> > > > >>>>>> --shift-by <number-of-records>
> > > > >>>>>>
> > > > >>>>>> --to-datetime <fixed point in time: format
> > > > >>> `YYYY-MM-DDTHH:mm:SS.sss`>
> > > > >>>>>> --to-offset <absolute offset>
> > > > >>>>>>
> > > > >>>>>> As it also uses ISO format, it might be good to also use them
> > (even
> > > > >>> if I
> > > > >>>>>> can see the appeal and simplicity of what you proposed).
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> I also want to add to (AM1), as there is also
> > > > >>> `Topology.AutoOffsetReset`
> > > > >>>>>> enum in Kafka Streams. I think we would need to convert this
> > into a
> > > > >>>>>> class. While it could be done is a follow up KIP, too, it
> seems
> > > > >> best
> > > > >>> to
> > > > >>>>>> do this holistically in a single KIP, because KS is not
> > something
> > > > >>> on-top
> > > > >>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> > > > >> design
> > > > >>> and
> > > > >>>>>> even PRs if necessary, but would strongly prefer to do it all
> > in a
> > > > >>>>>> single KIP.
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> Btw: if we add something like "latest-local", it might also be
> > good
> > > > >>> to
> > > > >>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the
> > tool
> > > > >>> works
> > > > >>>>>> slightly different, as it does commit an offset and there
> could
> > be
> > > > >>> some
> > > > >>>>>> race condition between committing "latest-local", tiering, and
> > when
> > > > >>> the
> > > > >>>>>> consumer is actually started?
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> -Matthias
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > >>>>>>> Hi Manikumar,
> > > > >>>>>>> Thanks for the KIP, this new strategy would be helpful in
> > > > >>> specifying
> > > > >>>>> fetch
> > > > >>>>>>> behaviour.
> > > > >>>>>>>
> > > > >>>>>>> AM1: The config `auto.offset.reset` is currently applied as
> per
> > > > >> the
> > > > >>>>> enum
> > > > >>>>>>> class OffsetResetStarategy which is part of kafka-clients
> > javadoc
> > > > >>>>>>> <
> > > > >>>>>
> > > > >>>
> > https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> > > > >>> .
> > > > >>>>>>> Are we also proposing to somehow add new definitions in the
> > same
> > > > >>> class?
> > > > >>>>>>> However as new configurations will be a string representation
> > > > >> hence
> > > > >>>>> are we
> > > > >>>>>>> moving away from OffsetResetStartegy enum class altogether?
> > > > >> Should
> > > > >>> we
> > > > >>>>>>> include the change in the KIP as OffsetResetStarategy is part
> > of
> > > > >>> public
> > > > >>>>>>> javadoc?
> > > > >>>>>>>
> > > > >>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> > > > >>>>> alternative,
> > > > >>>>>>> should we not follow some standard of defining duration which
> > has
> > > > >>>>> already
> > > > >>>>>>> been adopted in other systems?
> > > > >>>>>>>
> > > > >>>>>>> AM3: We've introduced new config values using the format
> > > > >>> minus-n-hours,
> > > > >>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> > > > >>> explicitly
> > > > >>>>>>> define the "minus" prefix, or is it implied?
> > > > >>>>>>>
> > > > >>>>>>> AM4: When supporting duration-based resets, should we also
> > allow
> > > > >>> users
> > > > >>>>> to
> > > > >>>>>>> specify a specific checkpoint time? For example, if a
> > checkpoint
> > > > >>>>> occurs 2
> > > > >>>>>>> days, 5 hours and 30 minutes earlier, the current four
> formats
> > > > >>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> > > > >> might
> > > > >>> not
> > > > >>>>> be
> > > > >>>>>>> sufficient. Should we consider adding a format to accommodate
> > > > >>> specific
> > > > >>>>>>> checkpoint times, or is there a reason to limit the supported
> > > > >>> formats?
> > > > >>>>>>>
> > > > >>>>>>>
> > > > >>>>>>> Regards,
> > > > >>>>>>> Apoorv Mittal
> > > > >>>>>>>
> > > > >>>>>>>
> > > > >>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > > > >>> manikumar.reddy@gmail.com>
> > > > >>>>> wrote:
> > > > >>>>>>>
> > > > >>>>>>>> Hi everyone,
> > > > >>>>>>>> I would like to start a discussion on KIP-1106:
> > > > >>>>>>>>
> > > > >>>>>>>>
> > > > >>>>>
> > > > >>>
> > > > >>
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > > >>>>>>>>
> > > > >>>>>>>> This KIP proposes to add an additional auto offset reset
> > > > >> strategy
> > > > >>> for
> > > > >>>>>>>> consumer clients.
> > > > >>>>>>>>
> > > > >>>>>>>> Regards,
> > > > >>>>>>>> Manikumar
> > > > >>>>>>>>
> > > > >>>>>>>
> > > > >>>>>
> > > > >>>
> > > > >>
> > > > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Andrew Schofield <an...@outlook.com>.
Hi Jun,
I suggest there are two reasons why ISO8601 is a more appropriate
choice than ms.
First, kafka-consumer-groups.sh --reset-offsets --by-duration uses ISO8601.
This KIP is providing essentially the Kafka consumer equivalent of this tool.
I favour consistency with the existing way of doing this.
Second, I suggest that people are going to be thinking of larger time units than
milliseconds in practice, such as a few hours or days. They should not
have to calculate how many milliseconds there are in a day.
Thanks,
Andrew
________________________________________
From: Jun Rao <ju...@confluent.io.INVALID>
Sent: 08 November 2024 17:37
To: dev@kafka.apache.org <de...@kafka.apache.org>
Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Hi, ManiKumar,
Thanks for the updated PR. Another comment.
JR3. Is there any benefit of using ISO8601
for auto.offset.reset.by.duration instead of just ms in long? The latter
covers a broader range. Also, AutoOffsetResetByDuration uses Java During,
which covers a different granularity than ISO8601. It might be better to
just use ms for both.
Jun
On Fri, Nov 8, 2024 at 5:51 AM Manikumar <ma...@gmail.com> wrote:
> Hi All,
>
> I have updated the KIP with recent suggestions.
>
> Thanks.
>
> On Fri, Nov 8, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
> wrote:
> >
> > Hi Matthias,
> >
> > Thanks for the comments.
> >
> > > I am personally not convinced that adding a new config
> > `auto.offset.reset.by.duration` is the best way.
> >
> > I think in this case, we felt it's better to add the strategy name to
> > auto.offset.reset config and add additional strategy specific configs.
> > This will be easy to understand and extend in future. I am open to
> > change if there are similar concerns.
> >
> > > One question about "earliest_local": if we fetch this offset from the
> > server, and seek it later, and start fetching, won't there be a race
> > condition? the server would just need to reload it from the tier.
> >
> > Yes, your understanding is correct. the server will read from the tier
> storage.
> > Anyhow, I will consider dropping earliest_local based on Jun's
> suggestion.
> >
> > > For Kafka Streams, just adding the new option so the existing enum does
> > not work IMHO. If a user would use BY_DURATION, there is no option to
> pass
> > in the actual duration (and we might need to throw an exception).
> >
> > I was assuming we will be using the underlying consumer config here. I
> > will update based on your suggestions.
> >
> >
> > Thanks,
> >
> >
> >
> >
> > On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
> > >
> > > Thanks for updating the KIP.
> > >
> > > I am personally not convinced that adding a new config
> > > `auto.offset.reset.by.duration` is the best way. Kafka in general has
> > > way too many configs and trying to avoid adding more configs seems to
> be
> > > desirable? -- It seems this might be a point of contention, and if the
> > > majority of people wants this new config so be it. I just wanted to
> > > stress my concerns about it.
> > >
> > > One question about "earliest_local": if we fetch this offset from the
> > > server, and seek to it later, and start fetching, won't there be a race
> > > condition? The oldest segment could have been discarded locally in the
> > > mean time? Maybe not too much of a big deal: the server would just need
> > > to reload it from the tier. Just want to ensure my understanding is
> > > correct, and make sure nobody has concerns about it.
> > >
> > > For Kafka Streams, just adding the new option so the existing enum does
> > > not work IMHO.
> > >
> > > For example, we have a method:
> > >
> > > addSource(final AutoOffsetReset offsetReset,
> > > final String name,
> > > final String... topics)
> > >
> > > If a user would use BY_DURATION, there is no option to pass in the
> > > actual duration (and we might need to throw an exception). And if we
> > > overload `addSource` adding a fourth parameter, it would be odd too, as
> > > users could pass in `EARLIEST` plus a duration, and we would need to
> > > throw an exception or ignore the given duration. Overall not an easy to
> > > use API.
> > >
> > > Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
> > > and add a new class `AutoOffsetReset` for which we can guide users
> > > accordingly avoiding corner cases:
> > >
> > > public class AutoOffsetReset() {
> > > public static AutoOffsetReset earliest();
> > > public static AutoOffsetReset latest();
> > > public static AutoOffsetReset byDuration(Duration duration);
> > > public static AutoOffsetReset earliestLocal();
> > > }
> > >
> > > The existing enum is contained inside `Topology` so we can add the new
> > > class just for package `org.apache.kafka.streams` to avoid naming
> conflicts.
> > >
> > > Additionally, we would deprecate all methods taking existing enum
> > > `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> > > affected) and add new overload which accepts the new `class
> > > AutoOffsetReset` instead.
> > >
> > >
> > > -Matthias
> > >
> > > On 11/7/24 1:57 PM, Jun Rao wrote:
> > > > Hi, Manikumar,
> > > >
> > > > Thanks for the KIP. A couple of comments.
> > > >
> > > > JR1. It doesn't seem that we need earliest_local. Intuitively, it
> makes
> > > > sense for a consumer app to bootstrap based on time. The time that a
> topic
> > > > is kept locally seems irrelevant to a consumer application.
> > > >
> > > > JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> > > > covers the common scenario in KIP-842 and is simpler. The scenario
> > > > described in KIP-842 is about which initial offset to use when a new
> > > > partition is added. This is more or less the same problem for
> choosing the
> > > > initial offset for existing partitions. Having a time based option
> provides
> > > > more flexibility than earliest or latest, and is likely good enough
> for
> > > > most usage.
> > > >
> > > > Jun
> > > >
> > > >
> > > > On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <
> apoorvmittal10@gmail.com>
> > > > wrote:
> > > >
> > > >> Thanks Manikumar and Andrew.
> > > >>
> > > >> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> > > >> "seekToLocalBeginning" where OffsetFetcher does use
> Admin.listOffsets API
> > > >> itself. However I agree that this is just another convenient way
> and not
> > > >> necessary to support functionality. Skipping it sounds good to me.
> > > >>
> > > >> Regards,
> > > >> Apoorv Mittal
> > > >>
> > > >>
> > > >> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> > > >> andrew_schofield_jira@outlook.com> wrote:
> > > >>
> > > >>> Hi Manikumar,
> > > >>>
> > > >>> AS7: In response to AM6, I agree that in general the combination
> > > >>> of offsetsForTimes() and seek() will do what is required. The one
> case
> > > >> that
> > > >>> I think is more tricky is seeking to the local earliest/beginning.
> > > >>>
> > > >>> The Consumer API has Consumer.beginningOffsets and
> > > >>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> > > >>> Similarly there are methods for OffsetResetStrategy.LATEST.
> > > >>>
> > > >>> With the Consumer API, I don't think you can find the local
> earliest
> > > >>> offset.
> > > >>> That can be found using Admin.listOffsets with
> OffsetSpec.EarliestLocal.
> > > >>> We could add equivalents of Consumer.beginningOffsets and
> > > >>> Consumer.seekToBeginning. An application could always use the
> > > >>> Admin API with the Consumer API.
> > > >>>
> > > >>> Personally, I would not complicate this KIP with these new methods
> when
> > > >>> the focus is more on duration-based offset reset and configs.
> > > >>>
> > > >>> Thanks,
> > > >>> Andrew
> > > >>> ________________________________________
> > > >>> From: Manikumar <ma...@gmail.com>
> > > >>> Sent: 06 November 2024 04:20
> > > >>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > >>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> option
> > > >>> for consumer clients
> > > >>>
> > > >>> Hi Apoorv,
> > > >>>
> > > >>> Thanks for the review.
> > > >>>
> > > >>> AM5: Thanks, Updated the KIP.
> > > >>>
> > > >>> AM6: Currently we can achieve this with the combination of
> > > >>> offsetsForTimes() and seek() API..
> > > >>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> > > >>> Long> timestampsToSearch) if required.
> > > >>> Let's see what others think.
> > > >>>
> > > >>> Thanks,
> > > >>>
> > > >>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <
> apoorvmittal10@gmail.com>
> > > >>> wrote:
> > > >>>>
> > > >>>> Hi Manikumar,
> > > >>>> Thanks for the changes. Just minor comment and a question:
> > > >>>>
> > > >>>> AM5: The description "How to initialize the share-partition start
> > > >>> offset:"
> > > >>>> for "*share.auto.offset.reset*" seems incomplete as it ends with
> `:`.
> > > >>>> Should we write the details as defined in KIP-932 i.e.
> > > >>>>
> > > >>>> How to initialize the share-partition start offset:
> > > >>>>
> > > >>>> -
> > > >>>>
> > > >>>> "earliest" : automatically reset the offset to the earliest
> offset
> > > >>>> -
> > > >>>>
> > > >>>> "latest" : automatically reset the offset to the latest offset
> > > >>>> -
> > > >>>>
> > > >>>> "*earliest_local": *automatically resets the offset to the
> earliest
> > > >>>> message stored in the local log on the broker.
> > > >>>> -
> > > >>>>
> > > >>>> "*by_duration": *automatically resets the offset to the
> earliest
> > > >>> offset
> > > >>>> whose timestamp is greater than or equal to the configured
> duration
> > > >>>> * (auto.offset.reset.by.duration).*
> > > >>>>
> > > >>>>
> > > >>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> > > >>>> share-partition start offset." as the details of the new configs
> are
> > > >>>> defined at top in different sections as well.
> > > >>>>
> > > >>>> AM6: Question: KafkaConsumer has public methods defined to "seek"
> for
> > > >> the
> > > >>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > > >>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you
> think
> > > >> it
> > > >>>> would be sensible to add additional KafkaConsumer APIs for newly
> > > >>> introduced
> > > >>>> strategies?
> > > >>>>
> > > >>>> Regards,
> > > >>>> Apoorv Mittal
> > > >>>>
> > > >>>>
> > > >>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <
> manikumar.reddy@gmail.com>
> > > >>> wrote:
> > > >>>>
> > > >>>>> Hi Matthias,
> > > >>>>>
> > > >>>>> Thanks for the review.
> > > >>>>>
> > > >>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> > > >> should
> > > >>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
> > > >>>>> proposing to add new configs (auto.offset.reset.on.no
> .initial.offset
> > > >>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive
> KIP-842
> > > >>>>> after completing this KIP.
> > > >>>>>
> > > >>>>> MS2: Added support for earliest-local config to reset to oldest
> local
> > > >>>>> offset and changes to kafka-consumer-group cmd.
> > > >>>>>
> > > >>>>> MS3: Based on suggestions, I have updated the config option to
> > > >> support
> > > >>>>> ISO format.
> > > >>>>>
> > > >>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > >>>>> definitely need your help on refining the API/solution for KS :)
> > > >>>>>
> > > >>>>> Thanks
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mjsax@apache.org
> >
> > > >>> wrote:
> > > >>>>>>
> > > >>>>>> Thanks for the KIP.
> > > >>>>>>
> > > >>>>>> A somewhat orthogonal question I have is, if we should try to
> merge
> > > >>> this
> > > >>>>>> KIP with the existing KIP-842:
> > > >>>>>>
> > > >>>>>
> > > >>>
> > > >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > >>>>>>
> > > >>>>>> While KIP-842 has a different intention, ie, separating the
> case of
> > > >>> "no
> > > >>>>>> offset during initial startup" vs "offset out of bounds during
> > > >>>>>> processing", it might still be worth it? My motivation for this
> > > >>> question
> > > >>>>>> is, that `auto.offset.reset` is one of the most central configs
> we
> > > >>> have,
> > > >>>>>> and thus, doing a single larger change (ie, both KIPs together)
> > > >>> might be
> > > >>>>>> better (less noise) than doing two independent changes?
> Thoughts? I
> > > >>> know
> > > >>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> About the KIP itself, did we consider to add something like
> > > >>>>>> "latest-local" to say reset to oldest local, but not fetch from
> > > >>> tiered
> > > >>>>>> storage?
> > > >>>>>>
> > > >>>>>> For the format of the config, did we consider what we do in
> > > >>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
> > > >> like
> > > >>>>>>
> > > >>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> > > >>>>>> --shift-by <number-of-records>
> > > >>>>>>
> > > >>>>>> --to-datetime <fixed point in time: format
> > > >>> `YYYY-MM-DDTHH:mm:SS.sss`>
> > > >>>>>> --to-offset <absolute offset>
> > > >>>>>>
> > > >>>>>> As it also uses ISO format, it might be good to also use them
> (even
> > > >>> if I
> > > >>>>>> can see the appeal and simplicity of what you proposed).
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> I also want to add to (AM1), as there is also
> > > >>> `Topology.AutoOffsetReset`
> > > >>>>>> enum in Kafka Streams. I think we would need to convert this
> into a
> > > >>>>>> class. While it could be done is a follow up KIP, too, it seems
> > > >> best
> > > >>> to
> > > >>>>>> do this holistically in a single KIP, because KS is not
> something
> > > >>> on-top
> > > >>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> > > >> design
> > > >>> and
> > > >>>>>> even PRs if necessary, but would strongly prefer to do it all
> in a
> > > >>>>>> single KIP.
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> Btw: if we add something like "latest-local", it might also be
> good
> > > >>> to
> > > >>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the
> tool
> > > >>> works
> > > >>>>>> slightly different, as it does commit an offset and there could
> be
> > > >>> some
> > > >>>>>> race condition between committing "latest-local", tiering, and
> when
> > > >>> the
> > > >>>>>> consumer is actually started?
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> -Matthias
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > >>>>>>> Hi Manikumar,
> > > >>>>>>> Thanks for the KIP, this new strategy would be helpful in
> > > >>> specifying
> > > >>>>> fetch
> > > >>>>>>> behaviour.
> > > >>>>>>>
> > > >>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
> > > >> the
> > > >>>>> enum
> > > >>>>>>> class OffsetResetStarategy which is part of kafka-clients
> javadoc
> > > >>>>>>> <
> > > >>>>>
> > > >>>
> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> > > >>> .
> > > >>>>>>> Are we also proposing to somehow add new definitions in the
> same
> > > >>> class?
> > > >>>>>>> However as new configurations will be a string representation
> > > >> hence
> > > >>>>> are we
> > > >>>>>>> moving away from OffsetResetStartegy enum class altogether?
> > > >> Should
> > > >>> we
> > > >>>>>>> include the change in the KIP as OffsetResetStarategy is part
> of
> > > >>> public
> > > >>>>>>> javadoc?
> > > >>>>>>>
> > > >>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> > > >>>>> alternative,
> > > >>>>>>> should we not follow some standard of defining duration which
> has
> > > >>>>> already
> > > >>>>>>> been adopted in other systems?
> > > >>>>>>>
> > > >>>>>>> AM3: We've introduced new config values using the format
> > > >>> minus-n-hours,
> > > >>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> > > >>> explicitly
> > > >>>>>>> define the "minus" prefix, or is it implied?
> > > >>>>>>>
> > > >>>>>>> AM4: When supporting duration-based resets, should we also
> allow
> > > >>> users
> > > >>>>> to
> > > >>>>>>> specify a specific checkpoint time? For example, if a
> checkpoint
> > > >>>>> occurs 2
> > > >>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
> > > >>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> > > >> might
> > > >>> not
> > > >>>>> be
> > > >>>>>>> sufficient. Should we consider adding a format to accommodate
> > > >>> specific
> > > >>>>>>> checkpoint times, or is there a reason to limit the supported
> > > >>> formats?
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>> Regards,
> > > >>>>>>> Apoorv Mittal
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > > >>> manikumar.reddy@gmail.com>
> > > >>>>> wrote:
> > > >>>>>>>
> > > >>>>>>>> Hi everyone,
> > > >>>>>>>> I would like to start a discussion on KIP-1106:
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>
> > > >>>
> > > >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > >>>>>>>>
> > > >>>>>>>> This KIP proposes to add an additional auto offset reset
> > > >> strategy
> > > >>> for
> > > >>>>>>>> consumer clients.
> > > >>>>>>>>
> > > >>>>>>>> Regards,
> > > >>>>>>>> Manikumar
> > > >>>>>>>>
> > > >>>>>>>
> > > >>>>>
> > > >>>
> > > >>
> > > >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Jun Rao <ju...@confluent.io.INVALID>.
Hi, ManiKumar,
Thanks for the updated PR. Another comment.
JR3. Is there any benefit of using ISO8601
for auto.offset.reset.by.duration instead of just ms in long? The latter
covers a broader range. Also, AutoOffsetResetByDuration uses Java During,
which covers a different granularity than ISO8601. It might be better to
just use ms for both.
Jun
On Fri, Nov 8, 2024 at 5:51 AM Manikumar <ma...@gmail.com> wrote:
> Hi All,
>
> I have updated the KIP with recent suggestions.
>
> Thanks.
>
> On Fri, Nov 8, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
> wrote:
> >
> > Hi Matthias,
> >
> > Thanks for the comments.
> >
> > > I am personally not convinced that adding a new config
> > `auto.offset.reset.by.duration` is the best way.
> >
> > I think in this case, we felt it's better to add the strategy name to
> > auto.offset.reset config and add additional strategy specific configs.
> > This will be easy to understand and extend in future. I am open to
> > change if there are similar concerns.
> >
> > > One question about "earliest_local": if we fetch this offset from the
> > server, and seek it later, and start fetching, won't there be a race
> > condition? the server would just need to reload it from the tier.
> >
> > Yes, your understanding is correct. the server will read from the tier
> storage.
> > Anyhow, I will consider dropping earliest_local based on Jun's
> suggestion.
> >
> > > For Kafka Streams, just adding the new option so the existing enum does
> > not work IMHO. If a user would use BY_DURATION, there is no option to
> pass
> > in the actual duration (and we might need to throw an exception).
> >
> > I was assuming we will be using the underlying consumer config here. I
> > will update based on your suggestions.
> >
> >
> > Thanks,
> >
> >
> >
> >
> > On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
> > >
> > > Thanks for updating the KIP.
> > >
> > > I am personally not convinced that adding a new config
> > > `auto.offset.reset.by.duration` is the best way. Kafka in general has
> > > way too many configs and trying to avoid adding more configs seems to
> be
> > > desirable? -- It seems this might be a point of contention, and if the
> > > majority of people wants this new config so be it. I just wanted to
> > > stress my concerns about it.
> > >
> > > One question about "earliest_local": if we fetch this offset from the
> > > server, and seek to it later, and start fetching, won't there be a race
> > > condition? The oldest segment could have been discarded locally in the
> > > mean time? Maybe not too much of a big deal: the server would just need
> > > to reload it from the tier. Just want to ensure my understanding is
> > > correct, and make sure nobody has concerns about it.
> > >
> > > For Kafka Streams, just adding the new option so the existing enum does
> > > not work IMHO.
> > >
> > > For example, we have a method:
> > >
> > > addSource(final AutoOffsetReset offsetReset,
> > > final String name,
> > > final String... topics)
> > >
> > > If a user would use BY_DURATION, there is no option to pass in the
> > > actual duration (and we might need to throw an exception). And if we
> > > overload `addSource` adding a fourth parameter, it would be odd too, as
> > > users could pass in `EARLIEST` plus a duration, and we would need to
> > > throw an exception or ignore the given duration. Overall not an easy to
> > > use API.
> > >
> > > Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
> > > and add a new class `AutoOffsetReset` for which we can guide users
> > > accordingly avoiding corner cases:
> > >
> > > public class AutoOffsetReset() {
> > > public static AutoOffsetReset earliest();
> > > public static AutoOffsetReset latest();
> > > public static AutoOffsetReset byDuration(Duration duration);
> > > public static AutoOffsetReset earliestLocal();
> > > }
> > >
> > > The existing enum is contained inside `Topology` so we can add the new
> > > class just for package `org.apache.kafka.streams` to avoid naming
> conflicts.
> > >
> > > Additionally, we would deprecate all methods taking existing enum
> > > `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> > > affected) and add new overload which accepts the new `class
> > > AutoOffsetReset` instead.
> > >
> > >
> > > -Matthias
> > >
> > > On 11/7/24 1:57 PM, Jun Rao wrote:
> > > > Hi, Manikumar,
> > > >
> > > > Thanks for the KIP. A couple of comments.
> > > >
> > > > JR1. It doesn't seem that we need earliest_local. Intuitively, it
> makes
> > > > sense for a consumer app to bootstrap based on time. The time that a
> topic
> > > > is kept locally seems irrelevant to a consumer application.
> > > >
> > > > JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> > > > covers the common scenario in KIP-842 and is simpler. The scenario
> > > > described in KIP-842 is about which initial offset to use when a new
> > > > partition is added. This is more or less the same problem for
> choosing the
> > > > initial offset for existing partitions. Having a time based option
> provides
> > > > more flexibility than earliest or latest, and is likely good enough
> for
> > > > most usage.
> > > >
> > > > Jun
> > > >
> > > >
> > > > On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <
> apoorvmittal10@gmail.com>
> > > > wrote:
> > > >
> > > >> Thanks Manikumar and Andrew.
> > > >>
> > > >> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> > > >> "seekToLocalBeginning" where OffsetFetcher does use
> Admin.listOffsets API
> > > >> itself. However I agree that this is just another convenient way
> and not
> > > >> necessary to support functionality. Skipping it sounds good to me.
> > > >>
> > > >> Regards,
> > > >> Apoorv Mittal
> > > >>
> > > >>
> > > >> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> > > >> andrew_schofield_jira@outlook.com> wrote:
> > > >>
> > > >>> Hi Manikumar,
> > > >>>
> > > >>> AS7: In response to AM6, I agree that in general the combination
> > > >>> of offsetsForTimes() and seek() will do what is required. The one
> case
> > > >> that
> > > >>> I think is more tricky is seeking to the local earliest/beginning.
> > > >>>
> > > >>> The Consumer API has Consumer.beginningOffsets and
> > > >>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> > > >>> Similarly there are methods for OffsetResetStrategy.LATEST.
> > > >>>
> > > >>> With the Consumer API, I don't think you can find the local
> earliest
> > > >>> offset.
> > > >>> That can be found using Admin.listOffsets with
> OffsetSpec.EarliestLocal.
> > > >>> We could add equivalents of Consumer.beginningOffsets and
> > > >>> Consumer.seekToBeginning. An application could always use the
> > > >>> Admin API with the Consumer API.
> > > >>>
> > > >>> Personally, I would not complicate this KIP with these new methods
> when
> > > >>> the focus is more on duration-based offset reset and configs.
> > > >>>
> > > >>> Thanks,
> > > >>> Andrew
> > > >>> ________________________________________
> > > >>> From: Manikumar <ma...@gmail.com>
> > > >>> Sent: 06 November 2024 04:20
> > > >>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > >>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> option
> > > >>> for consumer clients
> > > >>>
> > > >>> Hi Apoorv,
> > > >>>
> > > >>> Thanks for the review.
> > > >>>
> > > >>> AM5: Thanks, Updated the KIP.
> > > >>>
> > > >>> AM6: Currently we can achieve this with the combination of
> > > >>> offsetsForTimes() and seek() API..
> > > >>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> > > >>> Long> timestampsToSearch) if required.
> > > >>> Let's see what others think.
> > > >>>
> > > >>> Thanks,
> > > >>>
> > > >>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <
> apoorvmittal10@gmail.com>
> > > >>> wrote:
> > > >>>>
> > > >>>> Hi Manikumar,
> > > >>>> Thanks for the changes. Just minor comment and a question:
> > > >>>>
> > > >>>> AM5: The description "How to initialize the share-partition start
> > > >>> offset:"
> > > >>>> for "*share.auto.offset.reset*" seems incomplete as it ends with
> `:`.
> > > >>>> Should we write the details as defined in KIP-932 i.e.
> > > >>>>
> > > >>>> How to initialize the share-partition start offset:
> > > >>>>
> > > >>>> -
> > > >>>>
> > > >>>> "earliest" : automatically reset the offset to the earliest
> offset
> > > >>>> -
> > > >>>>
> > > >>>> "latest" : automatically reset the offset to the latest offset
> > > >>>> -
> > > >>>>
> > > >>>> "*earliest_local": *automatically resets the offset to the
> earliest
> > > >>>> message stored in the local log on the broker.
> > > >>>> -
> > > >>>>
> > > >>>> "*by_duration": *automatically resets the offset to the
> earliest
> > > >>> offset
> > > >>>> whose timestamp is greater than or equal to the configured
> duration
> > > >>>> * (auto.offset.reset.by.duration).*
> > > >>>>
> > > >>>>
> > > >>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> > > >>>> share-partition start offset." as the details of the new configs
> are
> > > >>>> defined at top in different sections as well.
> > > >>>>
> > > >>>> AM6: Question: KafkaConsumer has public methods defined to "seek"
> for
> > > >> the
> > > >>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > > >>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you
> think
> > > >> it
> > > >>>> would be sensible to add additional KafkaConsumer APIs for newly
> > > >>> introduced
> > > >>>> strategies?
> > > >>>>
> > > >>>> Regards,
> > > >>>> Apoorv Mittal
> > > >>>>
> > > >>>>
> > > >>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <
> manikumar.reddy@gmail.com>
> > > >>> wrote:
> > > >>>>
> > > >>>>> Hi Matthias,
> > > >>>>>
> > > >>>>> Thanks for the review.
> > > >>>>>
> > > >>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> > > >> should
> > > >>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
> > > >>>>> proposing to add new configs (auto.offset.reset.on.no
> .initial.offset
> > > >>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive
> KIP-842
> > > >>>>> after completing this KIP.
> > > >>>>>
> > > >>>>> MS2: Added support for earliest-local config to reset to oldest
> local
> > > >>>>> offset and changes to kafka-consumer-group cmd.
> > > >>>>>
> > > >>>>> MS3: Based on suggestions, I have updated the config option to
> > > >> support
> > > >>>>> ISO format.
> > > >>>>>
> > > >>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > >>>>> definitely need your help on refining the API/solution for KS :)
> > > >>>>>
> > > >>>>> Thanks
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mjsax@apache.org
> >
> > > >>> wrote:
> > > >>>>>>
> > > >>>>>> Thanks for the KIP.
> > > >>>>>>
> > > >>>>>> A somewhat orthogonal question I have is, if we should try to
> merge
> > > >>> this
> > > >>>>>> KIP with the existing KIP-842:
> > > >>>>>>
> > > >>>>>
> > > >>>
> > > >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > >>>>>>
> > > >>>>>> While KIP-842 has a different intention, ie, separating the
> case of
> > > >>> "no
> > > >>>>>> offset during initial startup" vs "offset out of bounds during
> > > >>>>>> processing", it might still be worth it? My motivation for this
> > > >>> question
> > > >>>>>> is, that `auto.offset.reset` is one of the most central configs
> we
> > > >>> have,
> > > >>>>>> and thus, doing a single larger change (ie, both KIPs together)
> > > >>> might be
> > > >>>>>> better (less noise) than doing two independent changes?
> Thoughts? I
> > > >>> know
> > > >>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> About the KIP itself, did we consider to add something like
> > > >>>>>> "latest-local" to say reset to oldest local, but not fetch from
> > > >>> tiered
> > > >>>>>> storage?
> > > >>>>>>
> > > >>>>>> For the format of the config, did we consider what we do in
> > > >>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
> > > >> like
> > > >>>>>>
> > > >>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> > > >>>>>> --shift-by <number-of-records>
> > > >>>>>>
> > > >>>>>> --to-datetime <fixed point in time: format
> > > >>> `YYYY-MM-DDTHH:mm:SS.sss`>
> > > >>>>>> --to-offset <absolute offset>
> > > >>>>>>
> > > >>>>>> As it also uses ISO format, it might be good to also use them
> (even
> > > >>> if I
> > > >>>>>> can see the appeal and simplicity of what you proposed).
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> I also want to add to (AM1), as there is also
> > > >>> `Topology.AutoOffsetReset`
> > > >>>>>> enum in Kafka Streams. I think we would need to convert this
> into a
> > > >>>>>> class. While it could be done is a follow up KIP, too, it seems
> > > >> best
> > > >>> to
> > > >>>>>> do this holistically in a single KIP, because KS is not
> something
> > > >>> on-top
> > > >>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> > > >> design
> > > >>> and
> > > >>>>>> even PRs if necessary, but would strongly prefer to do it all
> in a
> > > >>>>>> single KIP.
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> Btw: if we add something like "latest-local", it might also be
> good
> > > >>> to
> > > >>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the
> tool
> > > >>> works
> > > >>>>>> slightly different, as it does commit an offset and there could
> be
> > > >>> some
> > > >>>>>> race condition between committing "latest-local", tiering, and
> when
> > > >>> the
> > > >>>>>> consumer is actually started?
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> -Matthias
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > >>>>>>> Hi Manikumar,
> > > >>>>>>> Thanks for the KIP, this new strategy would be helpful in
> > > >>> specifying
> > > >>>>> fetch
> > > >>>>>>> behaviour.
> > > >>>>>>>
> > > >>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
> > > >> the
> > > >>>>> enum
> > > >>>>>>> class OffsetResetStarategy which is part of kafka-clients
> javadoc
> > > >>>>>>> <
> > > >>>>>
> > > >>>
> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> > > >>> .
> > > >>>>>>> Are we also proposing to somehow add new definitions in the
> same
> > > >>> class?
> > > >>>>>>> However as new configurations will be a string representation
> > > >> hence
> > > >>>>> are we
> > > >>>>>>> moving away from OffsetResetStartegy enum class altogether?
> > > >> Should
> > > >>> we
> > > >>>>>>> include the change in the KIP as OffsetResetStarategy is part
> of
> > > >>> public
> > > >>>>>>> javadoc?
> > > >>>>>>>
> > > >>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> > > >>>>> alternative,
> > > >>>>>>> should we not follow some standard of defining duration which
> has
> > > >>>>> already
> > > >>>>>>> been adopted in other systems?
> > > >>>>>>>
> > > >>>>>>> AM3: We've introduced new config values using the format
> > > >>> minus-n-hours,
> > > >>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> > > >>> explicitly
> > > >>>>>>> define the "minus" prefix, or is it implied?
> > > >>>>>>>
> > > >>>>>>> AM4: When supporting duration-based resets, should we also
> allow
> > > >>> users
> > > >>>>> to
> > > >>>>>>> specify a specific checkpoint time? For example, if a
> checkpoint
> > > >>>>> occurs 2
> > > >>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
> > > >>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> > > >> might
> > > >>> not
> > > >>>>> be
> > > >>>>>>> sufficient. Should we consider adding a format to accommodate
> > > >>> specific
> > > >>>>>>> checkpoint times, or is there a reason to limit the supported
> > > >>> formats?
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>> Regards,
> > > >>>>>>> Apoorv Mittal
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > > >>> manikumar.reddy@gmail.com>
> > > >>>>> wrote:
> > > >>>>>>>
> > > >>>>>>>> Hi everyone,
> > > >>>>>>>> I would like to start a discussion on KIP-1106:
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>
> > > >>>
> > > >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > >>>>>>>>
> > > >>>>>>>> This KIP proposes to add an additional auto offset reset
> > > >> strategy
> > > >>> for
> > > >>>>>>>> consumer clients.
> > > >>>>>>>>
> > > >>>>>>>> Regards,
> > > >>>>>>>> Manikumar
> > > >>>>>>>>
> > > >>>>>>>
> > > >>>>>
> > > >>>
> > > >>
> > > >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi All,
I have updated the KIP with recent suggestions.
Thanks.
On Fri, Nov 8, 2024 at 11:53 AM Manikumar <ma...@gmail.com> wrote:
>
> Hi Matthias,
>
> Thanks for the comments.
>
> > I am personally not convinced that adding a new config
> `auto.offset.reset.by.duration` is the best way.
>
> I think in this case, we felt it's better to add the strategy name to
> auto.offset.reset config and add additional strategy specific configs.
> This will be easy to understand and extend in future. I am open to
> change if there are similar concerns.
>
> > One question about "earliest_local": if we fetch this offset from the
> server, and seek it later, and start fetching, won't there be a race
> condition? the server would just need to reload it from the tier.
>
> Yes, your understanding is correct. the server will read from the tier storage.
> Anyhow, I will consider dropping earliest_local based on Jun's suggestion.
>
> > For Kafka Streams, just adding the new option so the existing enum does
> not work IMHO. If a user would use BY_DURATION, there is no option to pass
> in the actual duration (and we might need to throw an exception).
>
> I was assuming we will be using the underlying consumer config here. I
> will update based on your suggestions.
>
>
> Thanks,
>
>
>
>
> On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
> >
> > Thanks for updating the KIP.
> >
> > I am personally not convinced that adding a new config
> > `auto.offset.reset.by.duration` is the best way. Kafka in general has
> > way too many configs and trying to avoid adding more configs seems to be
> > desirable? -- It seems this might be a point of contention, and if the
> > majority of people wants this new config so be it. I just wanted to
> > stress my concerns about it.
> >
> > One question about "earliest_local": if we fetch this offset from the
> > server, and seek to it later, and start fetching, won't there be a race
> > condition? The oldest segment could have been discarded locally in the
> > mean time? Maybe not too much of a big deal: the server would just need
> > to reload it from the tier. Just want to ensure my understanding is
> > correct, and make sure nobody has concerns about it.
> >
> > For Kafka Streams, just adding the new option so the existing enum does
> > not work IMHO.
> >
> > For example, we have a method:
> >
> > addSource(final AutoOffsetReset offsetReset,
> > final String name,
> > final String... topics)
> >
> > If a user would use BY_DURATION, there is no option to pass in the
> > actual duration (and we might need to throw an exception). And if we
> > overload `addSource` adding a fourth parameter, it would be odd too, as
> > users could pass in `EARLIEST` plus a duration, and we would need to
> > throw an exception or ignore the given duration. Overall not an easy to
> > use API.
> >
> > Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
> > and add a new class `AutoOffsetReset` for which we can guide users
> > accordingly avoiding corner cases:
> >
> > public class AutoOffsetReset() {
> > public static AutoOffsetReset earliest();
> > public static AutoOffsetReset latest();
> > public static AutoOffsetReset byDuration(Duration duration);
> > public static AutoOffsetReset earliestLocal();
> > }
> >
> > The existing enum is contained inside `Topology` so we can add the new
> > class just for package `org.apache.kafka.streams` to avoid naming conflicts.
> >
> > Additionally, we would deprecate all methods taking existing enum
> > `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> > affected) and add new overload which accepts the new `class
> > AutoOffsetReset` instead.
> >
> >
> > -Matthias
> >
> > On 11/7/24 1:57 PM, Jun Rao wrote:
> > > Hi, Manikumar,
> > >
> > > Thanks for the KIP. A couple of comments.
> > >
> > > JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
> > > sense for a consumer app to bootstrap based on time. The time that a topic
> > > is kept locally seems irrelevant to a consumer application.
> > >
> > > JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> > > covers the common scenario in KIP-842 and is simpler. The scenario
> > > described in KIP-842 is about which initial offset to use when a new
> > > partition is added. This is more or less the same problem for choosing the
> > > initial offset for existing partitions. Having a time based option provides
> > > more flexibility than earliest or latest, and is likely good enough for
> > > most usage.
> > >
> > > Jun
> > >
> > >
> > > On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
> > > wrote:
> > >
> > >> Thanks Manikumar and Andrew.
> > >>
> > >> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> > >> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
> > >> itself. However I agree that this is just another convenient way and not
> > >> necessary to support functionality. Skipping it sounds good to me.
> > >>
> > >> Regards,
> > >> Apoorv Mittal
> > >>
> > >>
> > >> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> > >> andrew_schofield_jira@outlook.com> wrote:
> > >>
> > >>> Hi Manikumar,
> > >>>
> > >>> AS7: In response to AM6, I agree that in general the combination
> > >>> of offsetsForTimes() and seek() will do what is required. The one case
> > >> that
> > >>> I think is more tricky is seeking to the local earliest/beginning.
> > >>>
> > >>> The Consumer API has Consumer.beginningOffsets and
> > >>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> > >>> Similarly there are methods for OffsetResetStrategy.LATEST.
> > >>>
> > >>> With the Consumer API, I don't think you can find the local earliest
> > >>> offset.
> > >>> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> > >>> We could add equivalents of Consumer.beginningOffsets and
> > >>> Consumer.seekToBeginning. An application could always use the
> > >>> Admin API with the Consumer API.
> > >>>
> > >>> Personally, I would not complicate this KIP with these new methods when
> > >>> the focus is more on duration-based offset reset and configs.
> > >>>
> > >>> Thanks,
> > >>> Andrew
> > >>> ________________________________________
> > >>> From: Manikumar <ma...@gmail.com>
> > >>> Sent: 06 November 2024 04:20
> > >>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > >>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> > >>> for consumer clients
> > >>>
> > >>> Hi Apoorv,
> > >>>
> > >>> Thanks for the review.
> > >>>
> > >>> AM5: Thanks, Updated the KIP.
> > >>>
> > >>> AM6: Currently we can achieve this with the combination of
> > >>> offsetsForTimes() and seek() API..
> > >>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> > >>> Long> timestampsToSearch) if required.
> > >>> Let's see what others think.
> > >>>
> > >>> Thanks,
> > >>>
> > >>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> > >>> wrote:
> > >>>>
> > >>>> Hi Manikumar,
> > >>>> Thanks for the changes. Just minor comment and a question:
> > >>>>
> > >>>> AM5: The description "How to initialize the share-partition start
> > >>> offset:"
> > >>>> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> > >>>> Should we write the details as defined in KIP-932 i.e.
> > >>>>
> > >>>> How to initialize the share-partition start offset:
> > >>>>
> > >>>> -
> > >>>>
> > >>>> "earliest" : automatically reset the offset to the earliest offset
> > >>>> -
> > >>>>
> > >>>> "latest" : automatically reset the offset to the latest offset
> > >>>> -
> > >>>>
> > >>>> "*earliest_local": *automatically resets the offset to the earliest
> > >>>> message stored in the local log on the broker.
> > >>>> -
> > >>>>
> > >>>> "*by_duration": *automatically resets the offset to the earliest
> > >>> offset
> > >>>> whose timestamp is greater than or equal to the configured duration
> > >>>> * (auto.offset.reset.by.duration).*
> > >>>>
> > >>>>
> > >>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> > >>>> share-partition start offset." as the details of the new configs are
> > >>>> defined at top in different sections as well.
> > >>>>
> > >>>> AM6: Question: KafkaConsumer has public methods defined to "seek" for
> > >> the
> > >>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > >>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
> > >> it
> > >>>> would be sensible to add additional KafkaConsumer APIs for newly
> > >>> introduced
> > >>>> strategies?
> > >>>>
> > >>>> Regards,
> > >>>> Apoorv Mittal
> > >>>>
> > >>>>
> > >>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> > >>> wrote:
> > >>>>
> > >>>>> Hi Matthias,
> > >>>>>
> > >>>>> Thanks for the review.
> > >>>>>
> > >>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> > >> should
> > >>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
> > >>>>> proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > >>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > >>>>> after completing this KIP.
> > >>>>>
> > >>>>> MS2: Added support for earliest-local config to reset to oldest local
> > >>>>> offset and changes to kafka-consumer-group cmd.
> > >>>>>
> > >>>>> MS3: Based on suggestions, I have updated the config option to
> > >> support
> > >>>>> ISO format.
> > >>>>>
> > >>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> > >>>>> definitely need your help on refining the API/solution for KS :)
> > >>>>>
> > >>>>> Thanks
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> > >>> wrote:
> > >>>>>>
> > >>>>>> Thanks for the KIP.
> > >>>>>>
> > >>>>>> A somewhat orthogonal question I have is, if we should try to merge
> > >>> this
> > >>>>>> KIP with the existing KIP-842:
> > >>>>>>
> > >>>>>
> > >>>
> > >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > >>>>>>
> > >>>>>> While KIP-842 has a different intention, ie, separating the case of
> > >>> "no
> > >>>>>> offset during initial startup" vs "offset out of bounds during
> > >>>>>> processing", it might still be worth it? My motivation for this
> > >>> question
> > >>>>>> is, that `auto.offset.reset` is one of the most central configs we
> > >>> have,
> > >>>>>> and thus, doing a single larger change (ie, both KIPs together)
> > >>> might be
> > >>>>>> better (less noise) than doing two independent changes? Thoughts? I
> > >>> know
> > >>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
> > >>>>>>
> > >>>>>>
> > >>>>>> About the KIP itself, did we consider to add something like
> > >>>>>> "latest-local" to say reset to oldest local, but not fetch from
> > >>> tiered
> > >>>>>> storage?
> > >>>>>>
> > >>>>>> For the format of the config, did we consider what we do in
> > >>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
> > >> like
> > >>>>>>
> > >>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> > >>>>>> --shift-by <number-of-records>
> > >>>>>>
> > >>>>>> --to-datetime <fixed point in time: format
> > >>> `YYYY-MM-DDTHH:mm:SS.sss`>
> > >>>>>> --to-offset <absolute offset>
> > >>>>>>
> > >>>>>> As it also uses ISO format, it might be good to also use them (even
> > >>> if I
> > >>>>>> can see the appeal and simplicity of what you proposed).
> > >>>>>>
> > >>>>>>
> > >>>>>> I also want to add to (AM1), as there is also
> > >>> `Topology.AutoOffsetReset`
> > >>>>>> enum in Kafka Streams. I think we would need to convert this into a
> > >>>>>> class. While it could be done is a follow up KIP, too, it seems
> > >> best
> > >>> to
> > >>>>>> do this holistically in a single KIP, because KS is not something
> > >>> on-top
> > >>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> > >> design
> > >>> and
> > >>>>>> even PRs if necessary, but would strongly prefer to do it all in a
> > >>>>>> single KIP.
> > >>>>>>
> > >>>>>>
> > >>>>>> Btw: if we add something like "latest-local", it might also be good
> > >>> to
> > >>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> > >>> works
> > >>>>>> slightly different, as it does commit an offset and there could be
> > >>> some
> > >>>>>> race condition between committing "latest-local", tiering, and when
> > >>> the
> > >>>>>> consumer is actually started?
> > >>>>>>
> > >>>>>>
> > >>>>>> -Matthias
> > >>>>>>
> > >>>>>>
> > >>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > >>>>>>> Hi Manikumar,
> > >>>>>>> Thanks for the KIP, this new strategy would be helpful in
> > >>> specifying
> > >>>>> fetch
> > >>>>>>> behaviour.
> > >>>>>>>
> > >>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
> > >> the
> > >>>>> enum
> > >>>>>>> class OffsetResetStarategy which is part of kafka-clients javadoc
> > >>>>>>> <
> > >>>>>
> > >>> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> > >>> .
> > >>>>>>> Are we also proposing to somehow add new definitions in the same
> > >>> class?
> > >>>>>>> However as new configurations will be a string representation
> > >> hence
> > >>>>> are we
> > >>>>>>> moving away from OffsetResetStartegy enum class altogether?
> > >> Should
> > >>> we
> > >>>>>>> include the change in the KIP as OffsetResetStarategy is part of
> > >>> public
> > >>>>>>> javadoc?
> > >>>>>>>
> > >>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> > >>>>> alternative,
> > >>>>>>> should we not follow some standard of defining duration which has
> > >>>>> already
> > >>>>>>> been adopted in other systems?
> > >>>>>>>
> > >>>>>>> AM3: We've introduced new config values using the format
> > >>> minus-n-hours,
> > >>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> > >>> explicitly
> > >>>>>>> define the "minus" prefix, or is it implied?
> > >>>>>>>
> > >>>>>>> AM4: When supporting duration-based resets, should we also allow
> > >>> users
> > >>>>> to
> > >>>>>>> specify a specific checkpoint time? For example, if a checkpoint
> > >>>>> occurs 2
> > >>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
> > >>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> > >> might
> > >>> not
> > >>>>> be
> > >>>>>>> sufficient. Should we consider adding a format to accommodate
> > >>> specific
> > >>>>>>> checkpoint times, or is there a reason to limit the supported
> > >>> formats?
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> Regards,
> > >>>>>>> Apoorv Mittal
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > >>> manikumar.reddy@gmail.com>
> > >>>>> wrote:
> > >>>>>>>
> > >>>>>>>> Hi everyone,
> > >>>>>>>> I would like to start a discussion on KIP-1106:
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>
> > >>>
> > >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > >>>>>>>>
> > >>>>>>>> This KIP proposes to add an additional auto offset reset
> > >> strategy
> > >>> for
> > >>>>>>>> consumer clients.
> > >>>>>>>>
> > >>>>>>>> Regards,
> > >>>>>>>> Manikumar
> > >>>>>>>>
> > >>>>>>>
> > >>>>>
> > >>>
> > >>
> > >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Matthias,
Thanks for the comments.
> I am personally not convinced that adding a new config
`auto.offset.reset.by.duration` is the best way.
I think in this case, we felt it's better to add the strategy name to
auto.offset.reset config and add additional strategy specific configs.
This will be easy to understand and extend in future. I am open to
change if there are similar concerns.
> One question about "earliest_local": if we fetch this offset from the
server, and seek it later, and start fetching, won't there be a race
condition? the server would just need to reload it from the tier.
Yes, your understanding is correct. the server will read from the tier storage.
Anyhow, I will consider dropping earliest_local based on Jun's suggestion.
> For Kafka Streams, just adding the new option so the existing enum does
not work IMHO. If a user would use BY_DURATION, there is no option to pass
in the actual duration (and we might need to throw an exception).
I was assuming we will be using the underlying consumer config here. I
will update based on your suggestions.
Thanks,
On Fri, Nov 8, 2024 at 6:21 AM Matthias J. Sax <mj...@apache.org> wrote:
>
> Thanks for updating the KIP.
>
> I am personally not convinced that adding a new config
> `auto.offset.reset.by.duration` is the best way. Kafka in general has
> way too many configs and trying to avoid adding more configs seems to be
> desirable? -- It seems this might be a point of contention, and if the
> majority of people wants this new config so be it. I just wanted to
> stress my concerns about it.
>
> One question about "earliest_local": if we fetch this offset from the
> server, and seek to it later, and start fetching, won't there be a race
> condition? The oldest segment could have been discarded locally in the
> mean time? Maybe not too much of a big deal: the server would just need
> to reload it from the tier. Just want to ensure my understanding is
> correct, and make sure nobody has concerns about it.
>
> For Kafka Streams, just adding the new option so the existing enum does
> not work IMHO.
>
> For example, we have a method:
>
> addSource(final AutoOffsetReset offsetReset,
> final String name,
> final String... topics)
>
> If a user would use BY_DURATION, there is no option to pass in the
> actual duration (and we might need to throw an exception). And if we
> overload `addSource` adding a fourth parameter, it would be odd too, as
> users could pass in `EARLIEST` plus a duration, and we would need to
> throw an exception or ignore the given duration. Overall not an easy to
> use API.
>
> Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
> and add a new class `AutoOffsetReset` for which we can guide users
> accordingly avoiding corner cases:
>
> public class AutoOffsetReset() {
> public static AutoOffsetReset earliest();
> public static AutoOffsetReset latest();
> public static AutoOffsetReset byDuration(Duration duration);
> public static AutoOffsetReset earliestLocal();
> }
>
> The existing enum is contained inside `Topology` so we can add the new
> class just for package `org.apache.kafka.streams` to avoid naming conflicts.
>
> Additionally, we would deprecate all methods taking existing enum
> `AutoOffsetReset` (only two classed `Topology` and `Consumed` are
> affected) and add new overload which accepts the new `class
> AutoOffsetReset` instead.
>
>
> -Matthias
>
> On 11/7/24 1:57 PM, Jun Rao wrote:
> > Hi, Manikumar,
> >
> > Thanks for the KIP. A couple of comments.
> >
> > JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
> > sense for a consumer app to bootstrap based on time. The time that a topic
> > is kept locally seems irrelevant to a consumer application.
> >
> > JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> > covers the common scenario in KIP-842 and is simpler. The scenario
> > described in KIP-842 is about which initial offset to use when a new
> > partition is added. This is more or less the same problem for choosing the
> > initial offset for existing partitions. Having a time based option provides
> > more flexibility than earliest or latest, and is likely good enough for
> > most usage.
> >
> > Jun
> >
> >
> > On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
> > wrote:
> >
> >> Thanks Manikumar and Andrew.
> >>
> >> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> >> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
> >> itself. However I agree that this is just another convenient way and not
> >> necessary to support functionality. Skipping it sounds good to me.
> >>
> >> Regards,
> >> Apoorv Mittal
> >>
> >>
> >> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> >> andrew_schofield_jira@outlook.com> wrote:
> >>
> >>> Hi Manikumar,
> >>>
> >>> AS7: In response to AM6, I agree that in general the combination
> >>> of offsetsForTimes() and seek() will do what is required. The one case
> >> that
> >>> I think is more tricky is seeking to the local earliest/beginning.
> >>>
> >>> The Consumer API has Consumer.beginningOffsets and
> >>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> >>> Similarly there are methods for OffsetResetStrategy.LATEST.
> >>>
> >>> With the Consumer API, I don't think you can find the local earliest
> >>> offset.
> >>> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> >>> We could add equivalents of Consumer.beginningOffsets and
> >>> Consumer.seekToBeginning. An application could always use the
> >>> Admin API with the Consumer API.
> >>>
> >>> Personally, I would not complicate this KIP with these new methods when
> >>> the focus is more on duration-based offset reset and configs.
> >>>
> >>> Thanks,
> >>> Andrew
> >>> ________________________________________
> >>> From: Manikumar <ma...@gmail.com>
> >>> Sent: 06 November 2024 04:20
> >>> To: dev@kafka.apache.org <de...@kafka.apache.org>
> >>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> >>> for consumer clients
> >>>
> >>> Hi Apoorv,
> >>>
> >>> Thanks for the review.
> >>>
> >>> AM5: Thanks, Updated the KIP.
> >>>
> >>> AM6: Currently we can achieve this with the combination of
> >>> offsetsForTimes() and seek() API..
> >>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> >>> Long> timestampsToSearch) if required.
> >>> Let's see what others think.
> >>>
> >>> Thanks,
> >>>
> >>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> >>> wrote:
> >>>>
> >>>> Hi Manikumar,
> >>>> Thanks for the changes. Just minor comment and a question:
> >>>>
> >>>> AM5: The description "How to initialize the share-partition start
> >>> offset:"
> >>>> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> >>>> Should we write the details as defined in KIP-932 i.e.
> >>>>
> >>>> How to initialize the share-partition start offset:
> >>>>
> >>>> -
> >>>>
> >>>> "earliest" : automatically reset the offset to the earliest offset
> >>>> -
> >>>>
> >>>> "latest" : automatically reset the offset to the latest offset
> >>>> -
> >>>>
> >>>> "*earliest_local": *automatically resets the offset to the earliest
> >>>> message stored in the local log on the broker.
> >>>> -
> >>>>
> >>>> "*by_duration": *automatically resets the offset to the earliest
> >>> offset
> >>>> whose timestamp is greater than or equal to the configured duration
> >>>> * (auto.offset.reset.by.duration).*
> >>>>
> >>>>
> >>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
> >>>> share-partition start offset." as the details of the new configs are
> >>>> defined at top in different sections as well.
> >>>>
> >>>> AM6: Question: KafkaConsumer has public methods defined to "seek" for
> >> the
> >>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> >>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
> >> it
> >>>> would be sensible to add additional KafkaConsumer APIs for newly
> >>> introduced
> >>>> strategies?
> >>>>
> >>>> Regards,
> >>>> Apoorv Mittal
> >>>>
> >>>>
> >>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> >>> wrote:
> >>>>
> >>>>> Hi Matthias,
> >>>>>
> >>>>> Thanks for the review.
> >>>>>
> >>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
> >> should
> >>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
> >>>>> proposing to add new configs (auto.offset.reset.on.no.initial.offset
> >>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> >>>>> after completing this KIP.
> >>>>>
> >>>>> MS2: Added support for earliest-local config to reset to oldest local
> >>>>> offset and changes to kafka-consumer-group cmd.
> >>>>>
> >>>>> MS3: Based on suggestions, I have updated the config option to
> >> support
> >>>>> ISO format.
> >>>>>
> >>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
> >>>>> definitely need your help on refining the API/solution for KS :)
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> >>> wrote:
> >>>>>>
> >>>>>> Thanks for the KIP.
> >>>>>>
> >>>>>> A somewhat orthogonal question I have is, if we should try to merge
> >>> this
> >>>>>> KIP with the existing KIP-842:
> >>>>>>
> >>>>>
> >>>
> >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> >>>>>>
> >>>>>> While KIP-842 has a different intention, ie, separating the case of
> >>> "no
> >>>>>> offset during initial startup" vs "offset out of bounds during
> >>>>>> processing", it might still be worth it? My motivation for this
> >>> question
> >>>>>> is, that `auto.offset.reset` is one of the most central configs we
> >>> have,
> >>>>>> and thus, doing a single larger change (ie, both KIPs together)
> >>> might be
> >>>>>> better (less noise) than doing two independent changes? Thoughts? I
> >>> know
> >>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
> >>>>>>
> >>>>>>
> >>>>>> About the KIP itself, did we consider to add something like
> >>>>>> "latest-local" to say reset to oldest local, but not fetch from
> >>> tiered
> >>>>>> storage?
> >>>>>>
> >>>>>> For the format of the config, did we consider what we do in
> >>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
> >> like
> >>>>>>
> >>>>>> --by-duration <duration: format `PnDTnHnMnS`>
> >>>>>> --shift-by <number-of-records>
> >>>>>>
> >>>>>> --to-datetime <fixed point in time: format
> >>> `YYYY-MM-DDTHH:mm:SS.sss`>
> >>>>>> --to-offset <absolute offset>
> >>>>>>
> >>>>>> As it also uses ISO format, it might be good to also use them (even
> >>> if I
> >>>>>> can see the appeal and simplicity of what you proposed).
> >>>>>>
> >>>>>>
> >>>>>> I also want to add to (AM1), as there is also
> >>> `Topology.AutoOffsetReset`
> >>>>>> enum in Kafka Streams. I think we would need to convert this into a
> >>>>>> class. While it could be done is a follow up KIP, too, it seems
> >> best
> >>> to
> >>>>>> do this holistically in a single KIP, because KS is not something
> >>> on-top
> >>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
> >> design
> >>> and
> >>>>>> even PRs if necessary, but would strongly prefer to do it all in a
> >>>>>> single KIP.
> >>>>>>
> >>>>>>
> >>>>>> Btw: if we add something like "latest-local", it might also be good
> >>> to
> >>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> >>> works
> >>>>>> slightly different, as it does commit an offset and there could be
> >>> some
> >>>>>> race condition between committing "latest-local", tiering, and when
> >>> the
> >>>>>> consumer is actually started?
> >>>>>>
> >>>>>>
> >>>>>> -Matthias
> >>>>>>
> >>>>>>
> >>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> >>>>>>> Hi Manikumar,
> >>>>>>> Thanks for the KIP, this new strategy would be helpful in
> >>> specifying
> >>>>> fetch
> >>>>>>> behaviour.
> >>>>>>>
> >>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
> >> the
> >>>>> enum
> >>>>>>> class OffsetResetStarategy which is part of kafka-clients javadoc
> >>>>>>> <
> >>>>>
> >>> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> >>> .
> >>>>>>> Are we also proposing to somehow add new definitions in the same
> >>> class?
> >>>>>>> However as new configurations will be a string representation
> >> hence
> >>>>> are we
> >>>>>>> moving away from OffsetResetStartegy enum class altogether?
> >> Should
> >>> we
> >>>>>>> include the change in the KIP as OffsetResetStarategy is part of
> >>> public
> >>>>>>> javadoc?
> >>>>>>>
> >>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
> >>>>> alternative,
> >>>>>>> should we not follow some standard of defining duration which has
> >>>>> already
> >>>>>>> been adopted in other systems?
> >>>>>>>
> >>>>>>> AM3: We've introduced new config values using the format
> >>> minus-n-hours,
> >>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
> >>> explicitly
> >>>>>>> define the "minus" prefix, or is it implied?
> >>>>>>>
> >>>>>>> AM4: When supporting duration-based resets, should we also allow
> >>> users
> >>>>> to
> >>>>>>> specify a specific checkpoint time? For example, if a checkpoint
> >>>>> occurs 2
> >>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
> >>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> >> might
> >>> not
> >>>>> be
> >>>>>>> sufficient. Should we consider adding a format to accommodate
> >>> specific
> >>>>>>> checkpoint times, or is there a reason to limit the supported
> >>> formats?
> >>>>>>>
> >>>>>>>
> >>>>>>> Regards,
> >>>>>>> Apoorv Mittal
> >>>>>>>
> >>>>>>>
> >>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> >>> manikumar.reddy@gmail.com>
> >>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi everyone,
> >>>>>>>> I would like to start a discussion on KIP-1106:
> >>>>>>>>
> >>>>>>>>
> >>>>>
> >>>
> >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >>>>>>>>
> >>>>>>>> This KIP proposes to add an additional auto offset reset
> >> strategy
> >>> for
> >>>>>>>> consumer clients.
> >>>>>>>>
> >>>>>>>> Regards,
> >>>>>>>> Manikumar
> >>>>>>>>
> >>>>>>>
> >>>>>
> >>>
> >>
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi All,
The following changes are made to the KIP while implementing the changes to
Kafka Streams.
1. We have changed AutoOffsetReset.duration(...) API to
AutoOffsetReset.byDuration(...)
2. Added "none" reset strategy as an option for the newly added
org.apache.kafka.streams.AutoOffsetReset class
3. And updated the org/apache/kafka/streams/scala/kstream/Consumed.scala to
support the new AutoOffsetReset.
We need deprecated existing two methods and added two new overloaded
methods
- deprecated `with(TimestampExtractor, Topology.AutoOffsetReset)`
method
- deprecated `with(Topology.AutoOffsetReset)` method
- added new `with(TimestampExtractor, AutoOffsetReset)` method
- added new `with(TimestampExtractor, AutoOffsetReset)` method
Thanks
On Tue, Nov 19, 2024 at 5:36 PM Manikumar <ma...@gmail.com> wrote:
> Hi All,
>
> I have made a minor update to the KIP.
> Since we are deprecating the OffsetResetStrategy enum, I have deprecated
> the `MockConsumer(OffsetResetStrategy offsetResetStrategy)` constructor
> and added a new constructor.
>
>
> Thanks,
>
>
> On Thu, Nov 14, 2024 at 10:25 AM Manikumar <ma...@gmail.com>
> wrote:
>
>> Hi Jun,
>>
>> JR10: Yes, we can remove the name field. Updated the KIP.
>>
>>
>> Thanks,
>>
>> On Thu, Nov 14, 2024 at 3:57 AM Jun Rao <ju...@confluent.io.invalid> wrote:
>>
>>> Hi, Manikumar,
>>>
>>> Thanks for the explanation. We can follow the existing KStreams pattern.
>>>
>>> Could AutoOffsetReset(String name, long duration) just
>>> be AutoOffsetReset(long duration)?
>>>
>>> Jun
>>>
>>> On Wed, Nov 13, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
>>> wrote:
>>>
>>> > HI Jun,
>>> >
>>> > JR10: I was trying to follow KS conventions where we use non-public
>>> > sub-class with necessary getters.
>>> > Please check Matthias's suggestion here:
>>> > https://lists.apache.org/thread/mln783cbswgj14wt4hykcks4kfyl9zpf
>>> > There will be an AutoOffsetResetInternal class which will have getter
>>> > method.
>>> > We can follow your suggestions if we do not use Internal class
>>> approach,
>>> >
>>> >
>>> > Thanks,
>>> >
>>> > On Wed, Nov 13, 2024 at 11:12 PM Jun Rao <ju...@confluent.io.invalid>
>>> wrote:
>>> >
>>> > > Hi, Manikumar,
>>> > >
>>> > > Thanks for the updated KIP.
>>> > >
>>> > > JR10. The new AutoOffsetReset class. Could the following
>>> constructors be
>>> > > private?
>>> > > protected AutoOffsetReset(String name, long duration)
>>> > > protected AutoOffsetReset(String name)
>>> > > Could AutoOffsetReset(String name, long duration) just
>>> > > be AutoOffsetReset(long duration)?
>>> > > Do we need the following field?
>>> > > protected final String name;
>>> > > Instead of the following field, is it better to expose it through a
>>> > public
>>> > > method?
>>> > > protected final Optional<Long> duration;
>>> > >
>>> > > Jun
>>> > >
>>> > > On Tue, Nov 12, 2024 at 9:41 PM Manikumar <manikumar.reddy@gmail.com
>>> >
>>> > > wrote:
>>> > >
>>> > > > Hi Matthias.
>>> > > >
>>> > > > Thanks for the review
>>> > > >
>>> > > > 1. looks like the majority of us are leaning towards BY_DURATION
>>> > naming.
>>> > > I
>>> > > > have updated the same in the KIP.
>>> > > >
>>> > > > 2. Thanks. Updated the KIP to remove private/internal
>>> implementation.
>>> > > >
>>> > > >
>>> > > > Thanks,
>>> > > >
>>> > > > On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org>
>>> > > wrote:
>>> > > >
>>> > > > > Thanks for updating the KIP.
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > > I am happy to see that we seem to align to use a single config
>>> only
>>> > :)
>>> > > > >
>>> > > > > Obviously, I need to bikeshed on the format: `BACK:<duration>`
>>> does
>>> > not
>>> > > > > read well IMHO, and I think
>>> `auto.offset.reset="BACK_BY:<duration>"`
>>> > > > > would read much better. Andrew's suggestion of
>>> > `BY_DURATION:<duration>`
>>> > > > > might even be better (but I would be ok with either one).
>>> > > > >
>>> > > > > (I would not use `DURATION:<duration>` personally -- similar to
>>> > > > > `BACK:<duration>` is does not read well from my POV).
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > > About KS related changes. Overall LGTM. What is the reason for
>>> having
>>> > > > >
>>> > > > > AutoOffsetReset.LATEST
>>> > > > > AutoOffsetReset.EARLIEST
>>> > > > >
>>> > > > > as `public` variables? Seems we don't need them, but that they
>>> are
>>> > > > > rather an internal implementation detail?
>>> > > > >
>>> > > > > In general, I would recommend to omit everything `private` on
>>> the KIP
>>> > > > > (including method implementations), as it's not user facing, but
>>> only
>>> > > > > have method signatures in the KIP.
>>> > > > >
>>> > > > > What I believe we need to add is a `protected` constructor (for
>>> the
>>> > > > > internal sub-class):
>>> > > > >
>>> > > > > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > > -Matthias
>>> > > > >
>>> > > > > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
>>> > > > > > Thanks Manikumar for explaining, sounds good to me.
>>> > > > > >
>>> > > > > > Regards,
>>> > > > > > Apoorv Mittal
>>> > > > > >
>>> > > > > >
>>> > > > > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
>>> > > > > > andrew_schofield_jira@outlook.com> wrote:
>>> > > > > >
>>> > > > > >> Hi,
>>> > > > > >> Looks good now. Just one suggestion.
>>> > > > > >>
>>> > > > > >> AS8: Instead of "back:30D", I wonder whether the word
>>> 'duration'
>>> > > ought
>>> > > > > to
>>> > > > > >> be
>>> > > > > >> used to be consistent with kafka-consumer-groups.sh. So,
>>> > > > > >> "by-duration:P3D" or "duration:P3D" might be better.
>>> > > > > >>
>>> > > > > >> The overall idea of merging the configs into one config is
>>> fine in
>>> > > the
>>> > > > > >> current
>>> > > > > >> text of the KIP.
>>> > > > > >>
>>> > > > > >> Thanks,
>>> > > > > >> Andrew
>>> > > > > >>
>>> > > > > >> ________________________________________
>>> > > > > >> From: Manikumar <ma...@gmail.com>
>>> > > > > >> Sent: 12 November 2024 13:30
>>> > > > > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
>>> > > > > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset
>>> reset
>>> > > > option
>>> > > > > >> for consumer clients
>>> > > > > >>
>>> > > > > >> Hi Apoorv,
>>> > > > > >>
>>> > > > > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not
>>> > > proposing
>>> > > > > any
>>> > > > > >> public Interface/class for Kafka Consumer.
>>> > > > > >> As mentioned in the KIP, even though OffsetResetStrategy is a
>>> > public
>>> > > > > class,
>>> > > > > >> it's not used in any public APIs. I think new internal classes
>>> > > should
>>> > > > be
>>> > > > > >> sufficient.
>>> > > > > >>
>>> > > > > >> AM8: Fixed
>>> > > > > >>
>>> > > > > >> AM9: This class is for kafka streams API
>>> > > > > >>
>>> > > > > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP
>>> > constant
>>> > > > > values
>>> > > > > >> from ListOffsetsRequest
>>> > > > > >> <
>>> > > > > >>
>>> > > > >
>>> > > >
>>> > >
>>> >
>>> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
>>> > > > > >>>
>>> > > > > >>
>>> > > > > >> But yes, we can use Optional in AutoOffsetReset class.
>>> Updated the
>>> > > > KIP.
>>> > > > > >>
>>> > > > > >>
>>> > > > > >> Thanks.
>>> > > > > >>
>>> > > > > >>
>>> > > > > >>
>>> > > > > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
>>> > > > apoorvmittal10@gmail.com
>>> > > > > >
>>> > > > > >> wrote:
>>> > > > > >>
>>> > > > > >>> Hi,
>>> > > > > >>> I read the changes for single configuration and deprecated
>>> > > > > >>> OffsetResetStrategy.java.
>>> > > > > >>>
>>> > > > > >>> AM7: Question: The KIP says that previous supported values
>>> were
>>> > > > > >>> earliest/latest/none and new back:<duration> config would be
>>> > added.
>>> > > > We
>>> > > > > >> have
>>> > > > > >>> no definition of "none" in the newly introduced
>>> > > AutoOffsetReset.java
>>> > > > > >> class
>>> > > > > >>> hence I am assuming that if "none" is specified as a config
>>> > option
>>> > > > then
>>> > > > > >>> that config will be ignored, correct? Or are we deprecating
>>> the
>>> > > usage
>>> > > > > of
>>> > > > > >>> "none" altogether?
>>> > > > > >>>
>>> > > > > >>> AM8: Minor: The new class AutoOffsetReset under interfaces
>>> > mentions
>>> > > > the
>>> > > > > >>> name as OffsetResetStrategy.java. This requires correction.
>>> > > > > >>>
>>> > > > > >>> AM9: Is the package name correct for AutoOffsetReset as
>>> > > > > >>> org.apache.kafka.streams, shouldn't it be under clients
>>> package?
>>> > > > > >>>
>>> > > > > >>> AM10: What does -1L and -2L mean as long for latest and
>>> earliest
>>> > in
>>> > > > > >>> AutoOffsetReset.java? Is it just a long placeholder which
>>> will
>>> > > never
>>> > > > be
>>> > > > > >>> used elsewhere for latest and earliest? If yes then does it
>>> make
>>> > > > sense
>>> > > > > to
>>> > > > > >>> keep long as Optional, and use Optional.empty() for latest
>>> and
>>> > > > > earliest?
>>> > > > > >>>
>>> > > > > >>> Regards,
>>> > > > > >>> Apoorv Mittal
>>> > > > > >>>
>>> > > > > >>>
>>> > > > > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
>>> > > > manikumar.reddy@gmail.com>
>>> > > > > >>> wrote:
>>> > > > > >>>
>>> > > > > >>>> Thanks Ismael and Lianet for the reviews.
>>> > > > > >>>>
>>> > > > > >>>> Based on suggestions, I have updated the KIP to in favour of
>>> > > having
>>> > > > a
>>> > > > > >>>> single config (auto.offset.reset).
>>> > > > > >>>> I have also adopted the Lianet's suggestion on naming.
>>> > > > > >>>>
>>> > > > > >>>> auto.offset.reset=back:P3D -> reset back 3 days
>>> > > > > >>>>
>>> > > > > >>>>
>>> > > > > >>>> Let me know if there are any concerns.
>>> > > > > >>>>
>>> > > > > >>>>
>>> > > > > >>>> Thanks,
>>> > > > > >>>>
>>> > > > > >>>>
>>> > > > > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <
>>> lianetmr@gmail.com>
>>> > > > wrote:
>>> > > > > >>>>>
>>> > > > > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful
>>> > indeed.
>>> > > > > >>>>>
>>> > > > > >>>>> I also lean towards having a single config given that it's
>>> all
>>> > > > about
>>> > > > > >>> the
>>> > > > > >>>>> reset policy, seems all the same "what" (auto reset
>>> policy) and
>>> > > we
>>> > > > > >> are
>>> > > > > >>>>> just extending the with a new behaviour. Regarding the
>>> naming
>>> > > > (agree
>>> > > > > >> on
>>> > > > > >>>>> duration being confusing), what about something to show
>>> that
>>> > it's
>>> > > > > >>> simply
>>> > > > > >>>>> about how far back to reset:
>>> > > > > >>>>>
>>> > > > > >>>>> auto.offset.reset=EARLIEST
>>> > > > > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined
>>> with
>>> > > > > >> ISO8601
>>> > > > > >>>>> seems really easy to read/understand from the config
>>> definition
>>> > > > > >> itself)
>>> > > > > >>>>>
>>> > > > > >>>>> Something like that would definitely break consistency
>>> with the
>>> > > > > >> command
>>> > > > > >>>>> line tool argument "by_duration", but if it seems clearer
>>> we
>>> > > should
>>> > > > > >>>>> consider the tradeoff and not penalize the consumer
>>> > API/configs.
>>> > > > > >>>>>
>>> > > > > >>>>> Thanks!
>>> > > > > >>>>>
>>> > > > > >>>>> Lianet
>>> > > > > >>>>>
>>> > > > > >>>>>
>>> > > > > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <
>>> me@ismaeljuma.com>
>>> > > > > >> wrote:
>>> > > > > >>>>>
>>> > > > > >>>>>> Thanks for the KIP, this is useful. A comment below.
>>> > > > > >>>>>>
>>> > > > > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <
>>> > > mjsax@apache.org>
>>> > > > > >>>> wrote:
>>> > > > > >>>>>>
>>> > > > > >>>>>>> I am personally not convinced that adding a new config
>>> > > > > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka
>>> in
>>> > > > > >> general
>>> > > > > >>>> has
>>> > > > > >>>>>>> way too many configs and trying to avoid adding more
>>> configs
>>> > > > > >> seems
>>> > > > > >>>> to be
>>> > > > > >>>>>>> desirable? -- It seems this might be a point of
>>> contention,
>>> > > and
>>> > > > > >> if
>>> > > > > >>>> the
>>> > > > > >>>>>>> majority of people wants this new config so be it. I just
>>> > > wanted
>>> > > > > >> to
>>> > > > > >>>>>>> stress my concerns about it.
>>> > > > > >>>>>>
>>> > > > > >>>>>>
>>> > > > > >>>>>> I agree that we don't need a new config. We can simply
>>> use a
>>> > > value
>>> > > > > >>> for
>>> > > > > >>>> the
>>> > > > > >>>>>> existing config. I think a prefix followed by the relevant
>>> > > ISO8601
>>> > > > > >>>> string
>>> > > > > >>>>>> would be clear enough. For example,
>>> "by-duration:P23DT23H" or
>>> > > > > >>> something
>>> > > > > >>>>>> along those lines. I do find the "by-duration"
>>> description a
>>> > bit
>>> > > > > >>>> confusing
>>> > > > > >>>>>> for what we're doing here (i.e. current time - duration)
>>> > > although
>>> > > > > >>>> there is
>>> > > > > >>>>>> precedent in the reset offsets tool.
>>> > > > > >>>>>>
>>> > > > > >>>>>> Ismael
>>> > > > > >>>>>>
>>> > > > > >>>>
>>> > > > > >>>
>>> > > > > >>
>>> > > > > >
>>> > > > >
>>> > > >
>>> > >
>>> >
>>>
>>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi All,
I have made a minor update to the KIP.
Since we are deprecating the OffsetResetStrategy enum, I have deprecated
the `MockConsumer(OffsetResetStrategy offsetResetStrategy)` constructor
and added a new constructor.
Thanks,
On Thu, Nov 14, 2024 at 10:25 AM Manikumar <ma...@gmail.com>
wrote:
> Hi Jun,
>
> JR10: Yes, we can remove the name field. Updated the KIP.
>
>
> Thanks,
>
> On Thu, Nov 14, 2024 at 3:57 AM Jun Rao <ju...@confluent.io.invalid> wrote:
>
>> Hi, Manikumar,
>>
>> Thanks for the explanation. We can follow the existing KStreams pattern.
>>
>> Could AutoOffsetReset(String name, long duration) just
>> be AutoOffsetReset(long duration)?
>>
>> Jun
>>
>> On Wed, Nov 13, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
>> wrote:
>>
>> > HI Jun,
>> >
>> > JR10: I was trying to follow KS conventions where we use non-public
>> > sub-class with necessary getters.
>> > Please check Matthias's suggestion here:
>> > https://lists.apache.org/thread/mln783cbswgj14wt4hykcks4kfyl9zpf
>> > There will be an AutoOffsetResetInternal class which will have getter
>> > method.
>> > We can follow your suggestions if we do not use Internal class approach,
>> >
>> >
>> > Thanks,
>> >
>> > On Wed, Nov 13, 2024 at 11:12 PM Jun Rao <ju...@confluent.io.invalid>
>> wrote:
>> >
>> > > Hi, Manikumar,
>> > >
>> > > Thanks for the updated KIP.
>> > >
>> > > JR10. The new AutoOffsetReset class. Could the following constructors
>> be
>> > > private?
>> > > protected AutoOffsetReset(String name, long duration)
>> > > protected AutoOffsetReset(String name)
>> > > Could AutoOffsetReset(String name, long duration) just
>> > > be AutoOffsetReset(long duration)?
>> > > Do we need the following field?
>> > > protected final String name;
>> > > Instead of the following field, is it better to expose it through a
>> > public
>> > > method?
>> > > protected final Optional<Long> duration;
>> > >
>> > > Jun
>> > >
>> > > On Tue, Nov 12, 2024 at 9:41 PM Manikumar <ma...@gmail.com>
>> > > wrote:
>> > >
>> > > > Hi Matthias.
>> > > >
>> > > > Thanks for the review
>> > > >
>> > > > 1. looks like the majority of us are leaning towards BY_DURATION
>> > naming.
>> > > I
>> > > > have updated the same in the KIP.
>> > > >
>> > > > 2. Thanks. Updated the KIP to remove private/internal
>> implementation.
>> > > >
>> > > >
>> > > > Thanks,
>> > > >
>> > > > On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org>
>> > > wrote:
>> > > >
>> > > > > Thanks for updating the KIP.
>> > > > >
>> > > > >
>> > > > >
>> > > > > I am happy to see that we seem to align to use a single config
>> only
>> > :)
>> > > > >
>> > > > > Obviously, I need to bikeshed on the format: `BACK:<duration>`
>> does
>> > not
>> > > > > read well IMHO, and I think
>> `auto.offset.reset="BACK_BY:<duration>"`
>> > > > > would read much better. Andrew's suggestion of
>> > `BY_DURATION:<duration>`
>> > > > > might even be better (but I would be ok with either one).
>> > > > >
>> > > > > (I would not use `DURATION:<duration>` personally -- similar to
>> > > > > `BACK:<duration>` is does not read well from my POV).
>> > > > >
>> > > > >
>> > > > >
>> > > > > About KS related changes. Overall LGTM. What is the reason for
>> having
>> > > > >
>> > > > > AutoOffsetReset.LATEST
>> > > > > AutoOffsetReset.EARLIEST
>> > > > >
>> > > > > as `public` variables? Seems we don't need them, but that they are
>> > > > > rather an internal implementation detail?
>> > > > >
>> > > > > In general, I would recommend to omit everything `private` on the
>> KIP
>> > > > > (including method implementations), as it's not user facing, but
>> only
>> > > > > have method signatures in the KIP.
>> > > > >
>> > > > > What I believe we need to add is a `protected` constructor (for
>> the
>> > > > > internal sub-class):
>> > > > >
>> > > > > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > -Matthias
>> > > > >
>> > > > > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
>> > > > > > Thanks Manikumar for explaining, sounds good to me.
>> > > > > >
>> > > > > > Regards,
>> > > > > > Apoorv Mittal
>> > > > > >
>> > > > > >
>> > > > > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
>> > > > > > andrew_schofield_jira@outlook.com> wrote:
>> > > > > >
>> > > > > >> Hi,
>> > > > > >> Looks good now. Just one suggestion.
>> > > > > >>
>> > > > > >> AS8: Instead of "back:30D", I wonder whether the word
>> 'duration'
>> > > ought
>> > > > > to
>> > > > > >> be
>> > > > > >> used to be consistent with kafka-consumer-groups.sh. So,
>> > > > > >> "by-duration:P3D" or "duration:P3D" might be better.
>> > > > > >>
>> > > > > >> The overall idea of merging the configs into one config is
>> fine in
>> > > the
>> > > > > >> current
>> > > > > >> text of the KIP.
>> > > > > >>
>> > > > > >> Thanks,
>> > > > > >> Andrew
>> > > > > >>
>> > > > > >> ________________________________________
>> > > > > >> From: Manikumar <ma...@gmail.com>
>> > > > > >> Sent: 12 November 2024 13:30
>> > > > > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
>> > > > > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset
>> reset
>> > > > option
>> > > > > >> for consumer clients
>> > > > > >>
>> > > > > >> Hi Apoorv,
>> > > > > >>
>> > > > > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not
>> > > proposing
>> > > > > any
>> > > > > >> public Interface/class for Kafka Consumer.
>> > > > > >> As mentioned in the KIP, even though OffsetResetStrategy is a
>> > public
>> > > > > class,
>> > > > > >> it's not used in any public APIs. I think new internal classes
>> > > should
>> > > > be
>> > > > > >> sufficient.
>> > > > > >>
>> > > > > >> AM8: Fixed
>> > > > > >>
>> > > > > >> AM9: This class is for kafka streams API
>> > > > > >>
>> > > > > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP
>> > constant
>> > > > > values
>> > > > > >> from ListOffsetsRequest
>> > > > > >> <
>> > > > > >>
>> > > > >
>> > > >
>> > >
>> >
>> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
>> > > > > >>>
>> > > > > >>
>> > > > > >> But yes, we can use Optional in AutoOffsetReset class. Updated
>> the
>> > > > KIP.
>> > > > > >>
>> > > > > >>
>> > > > > >> Thanks.
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
>> > > > apoorvmittal10@gmail.com
>> > > > > >
>> > > > > >> wrote:
>> > > > > >>
>> > > > > >>> Hi,
>> > > > > >>> I read the changes for single configuration and deprecated
>> > > > > >>> OffsetResetStrategy.java.
>> > > > > >>>
>> > > > > >>> AM7: Question: The KIP says that previous supported values
>> were
>> > > > > >>> earliest/latest/none and new back:<duration> config would be
>> > added.
>> > > > We
>> > > > > >> have
>> > > > > >>> no definition of "none" in the newly introduced
>> > > AutoOffsetReset.java
>> > > > > >> class
>> > > > > >>> hence I am assuming that if "none" is specified as a config
>> > option
>> > > > then
>> > > > > >>> that config will be ignored, correct? Or are we deprecating
>> the
>> > > usage
>> > > > > of
>> > > > > >>> "none" altogether?
>> > > > > >>>
>> > > > > >>> AM8: Minor: The new class AutoOffsetReset under interfaces
>> > mentions
>> > > > the
>> > > > > >>> name as OffsetResetStrategy.java. This requires correction.
>> > > > > >>>
>> > > > > >>> AM9: Is the package name correct for AutoOffsetReset as
>> > > > > >>> org.apache.kafka.streams, shouldn't it be under clients
>> package?
>> > > > > >>>
>> > > > > >>> AM10: What does -1L and -2L mean as long for latest and
>> earliest
>> > in
>> > > > > >>> AutoOffsetReset.java? Is it just a long placeholder which will
>> > > never
>> > > > be
>> > > > > >>> used elsewhere for latest and earliest? If yes then does it
>> make
>> > > > sense
>> > > > > to
>> > > > > >>> keep long as Optional, and use Optional.empty() for latest and
>> > > > > earliest?
>> > > > > >>>
>> > > > > >>> Regards,
>> > > > > >>> Apoorv Mittal
>> > > > > >>>
>> > > > > >>>
>> > > > > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
>> > > > manikumar.reddy@gmail.com>
>> > > > > >>> wrote:
>> > > > > >>>
>> > > > > >>>> Thanks Ismael and Lianet for the reviews.
>> > > > > >>>>
>> > > > > >>>> Based on suggestions, I have updated the KIP to in favour of
>> > > having
>> > > > a
>> > > > > >>>> single config (auto.offset.reset).
>> > > > > >>>> I have also adopted the Lianet's suggestion on naming.
>> > > > > >>>>
>> > > > > >>>> auto.offset.reset=back:P3D -> reset back 3 days
>> > > > > >>>>
>> > > > > >>>>
>> > > > > >>>> Let me know if there are any concerns.
>> > > > > >>>>
>> > > > > >>>>
>> > > > > >>>> Thanks,
>> > > > > >>>>
>> > > > > >>>>
>> > > > > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <
>> lianetmr@gmail.com>
>> > > > wrote:
>> > > > > >>>>>
>> > > > > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful
>> > indeed.
>> > > > > >>>>>
>> > > > > >>>>> I also lean towards having a single config given that it's
>> all
>> > > > about
>> > > > > >>> the
>> > > > > >>>>> reset policy, seems all the same "what" (auto reset policy)
>> and
>> > > we
>> > > > > >> are
>> > > > > >>>>> just extending the with a new behaviour. Regarding the
>> naming
>> > > > (agree
>> > > > > >> on
>> > > > > >>>>> duration being confusing), what about something to show that
>> > it's
>> > > > > >>> simply
>> > > > > >>>>> about how far back to reset:
>> > > > > >>>>>
>> > > > > >>>>> auto.offset.reset=EARLIEST
>> > > > > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined
>> with
>> > > > > >> ISO8601
>> > > > > >>>>> seems really easy to read/understand from the config
>> definition
>> > > > > >> itself)
>> > > > > >>>>>
>> > > > > >>>>> Something like that would definitely break consistency with
>> the
>> > > > > >> command
>> > > > > >>>>> line tool argument "by_duration", but if it seems clearer we
>> > > should
>> > > > > >>>>> consider the tradeoff and not penalize the consumer
>> > API/configs.
>> > > > > >>>>>
>> > > > > >>>>> Thanks!
>> > > > > >>>>>
>> > > > > >>>>> Lianet
>> > > > > >>>>>
>> > > > > >>>>>
>> > > > > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <
>> me@ismaeljuma.com>
>> > > > > >> wrote:
>> > > > > >>>>>
>> > > > > >>>>>> Thanks for the KIP, this is useful. A comment below.
>> > > > > >>>>>>
>> > > > > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <
>> > > mjsax@apache.org>
>> > > > > >>>> wrote:
>> > > > > >>>>>>
>> > > > > >>>>>>> I am personally not convinced that adding a new config
>> > > > > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
>> > > > > >> general
>> > > > > >>>> has
>> > > > > >>>>>>> way too many configs and trying to avoid adding more
>> configs
>> > > > > >> seems
>> > > > > >>>> to be
>> > > > > >>>>>>> desirable? -- It seems this might be a point of
>> contention,
>> > > and
>> > > > > >> if
>> > > > > >>>> the
>> > > > > >>>>>>> majority of people wants this new config so be it. I just
>> > > wanted
>> > > > > >> to
>> > > > > >>>>>>> stress my concerns about it.
>> > > > > >>>>>>
>> > > > > >>>>>>
>> > > > > >>>>>> I agree that we don't need a new config. We can simply use
>> a
>> > > value
>> > > > > >>> for
>> > > > > >>>> the
>> > > > > >>>>>> existing config. I think a prefix followed by the relevant
>> > > ISO8601
>> > > > > >>>> string
>> > > > > >>>>>> would be clear enough. For example, "by-duration:P23DT23H"
>> or
>> > > > > >>> something
>> > > > > >>>>>> along those lines. I do find the "by-duration" description
>> a
>> > bit
>> > > > > >>>> confusing
>> > > > > >>>>>> for what we're doing here (i.e. current time - duration)
>> > > although
>> > > > > >>>> there is
>> > > > > >>>>>> precedent in the reset offsets tool.
>> > > > > >>>>>>
>> > > > > >>>>>> Ismael
>> > > > > >>>>>>
>> > > > > >>>>
>> > > > > >>>
>> > > > > >>
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Jun,
JR10: Yes, we can remove the name field. Updated the KIP.
Thanks,
On Thu, Nov 14, 2024 at 3:57 AM Jun Rao <ju...@confluent.io.invalid> wrote:
> Hi, Manikumar,
>
> Thanks for the explanation. We can follow the existing KStreams pattern.
>
> Could AutoOffsetReset(String name, long duration) just
> be AutoOffsetReset(long duration)?
>
> Jun
>
> On Wed, Nov 13, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
> wrote:
>
> > HI Jun,
> >
> > JR10: I was trying to follow KS conventions where we use non-public
> > sub-class with necessary getters.
> > Please check Matthias's suggestion here:
> > https://lists.apache.org/thread/mln783cbswgj14wt4hykcks4kfyl9zpf
> > There will be an AutoOffsetResetInternal class which will have getter
> > method.
> > We can follow your suggestions if we do not use Internal class approach,
> >
> >
> > Thanks,
> >
> > On Wed, Nov 13, 2024 at 11:12 PM Jun Rao <ju...@confluent.io.invalid>
> wrote:
> >
> > > Hi, Manikumar,
> > >
> > > Thanks for the updated KIP.
> > >
> > > JR10. The new AutoOffsetReset class. Could the following constructors
> be
> > > private?
> > > protected AutoOffsetReset(String name, long duration)
> > > protected AutoOffsetReset(String name)
> > > Could AutoOffsetReset(String name, long duration) just
> > > be AutoOffsetReset(long duration)?
> > > Do we need the following field?
> > > protected final String name;
> > > Instead of the following field, is it better to expose it through a
> > public
> > > method?
> > > protected final Optional<Long> duration;
> > >
> > > Jun
> > >
> > > On Tue, Nov 12, 2024 at 9:41 PM Manikumar <ma...@gmail.com>
> > > wrote:
> > >
> > > > Hi Matthias.
> > > >
> > > > Thanks for the review
> > > >
> > > > 1. looks like the majority of us are leaning towards BY_DURATION
> > naming.
> > > I
> > > > have updated the same in the KIP.
> > > >
> > > > 2. Thanks. Updated the KIP to remove private/internal implementation.
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org>
> > > wrote:
> > > >
> > > > > Thanks for updating the KIP.
> > > > >
> > > > >
> > > > >
> > > > > I am happy to see that we seem to align to use a single config only
> > :)
> > > > >
> > > > > Obviously, I need to bikeshed on the format: `BACK:<duration>` does
> > not
> > > > > read well IMHO, and I think
> `auto.offset.reset="BACK_BY:<duration>"`
> > > > > would read much better. Andrew's suggestion of
> > `BY_DURATION:<duration>`
> > > > > might even be better (but I would be ok with either one).
> > > > >
> > > > > (I would not use `DURATION:<duration>` personally -- similar to
> > > > > `BACK:<duration>` is does not read well from my POV).
> > > > >
> > > > >
> > > > >
> > > > > About KS related changes. Overall LGTM. What is the reason for
> having
> > > > >
> > > > > AutoOffsetReset.LATEST
> > > > > AutoOffsetReset.EARLIEST
> > > > >
> > > > > as `public` variables? Seems we don't need them, but that they are
> > > > > rather an internal implementation detail?
> > > > >
> > > > > In general, I would recommend to omit everything `private` on the
> KIP
> > > > > (including method implementations), as it's not user facing, but
> only
> > > > > have method signatures in the KIP.
> > > > >
> > > > > What I believe we need to add is a `protected` constructor (for the
> > > > > internal sub-class):
> > > > >
> > > > > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > -Matthias
> > > > >
> > > > > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> > > > > > Thanks Manikumar for explaining, sounds good to me.
> > > > > >
> > > > > > Regards,
> > > > > > Apoorv Mittal
> > > > > >
> > > > > >
> > > > > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> > > > > > andrew_schofield_jira@outlook.com> wrote:
> > > > > >
> > > > > >> Hi,
> > > > > >> Looks good now. Just one suggestion.
> > > > > >>
> > > > > >> AS8: Instead of "back:30D", I wonder whether the word 'duration'
> > > ought
> > > > > to
> > > > > >> be
> > > > > >> used to be consistent with kafka-consumer-groups.sh. So,
> > > > > >> "by-duration:P3D" or "duration:P3D" might be better.
> > > > > >>
> > > > > >> The overall idea of merging the configs into one config is fine
> in
> > > the
> > > > > >> current
> > > > > >> text of the KIP.
> > > > > >>
> > > > > >> Thanks,
> > > > > >> Andrew
> > > > > >>
> > > > > >> ________________________________________
> > > > > >> From: Manikumar <ma...@gmail.com>
> > > > > >> Sent: 12 November 2024 13:30
> > > > > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > > > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> > > > option
> > > > > >> for consumer clients
> > > > > >>
> > > > > >> Hi Apoorv,
> > > > > >>
> > > > > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not
> > > proposing
> > > > > any
> > > > > >> public Interface/class for Kafka Consumer.
> > > > > >> As mentioned in the KIP, even though OffsetResetStrategy is a
> > public
> > > > > class,
> > > > > >> it's not used in any public APIs. I think new internal classes
> > > should
> > > > be
> > > > > >> sufficient.
> > > > > >>
> > > > > >> AM8: Fixed
> > > > > >>
> > > > > >> AM9: This class is for kafka streams API
> > > > > >>
> > > > > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP
> > constant
> > > > > values
> > > > > >> from ListOffsetsRequest
> > > > > >> <
> > > > > >>
> > > > >
> > > >
> > >
> >
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> > > > > >>>
> > > > > >>
> > > > > >> But yes, we can use Optional in AutoOffsetReset class. Updated
> the
> > > > KIP.
> > > > > >>
> > > > > >>
> > > > > >> Thanks.
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
> > > > apoorvmittal10@gmail.com
> > > > > >
> > > > > >> wrote:
> > > > > >>
> > > > > >>> Hi,
> > > > > >>> I read the changes for single configuration and deprecated
> > > > > >>> OffsetResetStrategy.java.
> > > > > >>>
> > > > > >>> AM7: Question: The KIP says that previous supported values were
> > > > > >>> earliest/latest/none and new back:<duration> config would be
> > added.
> > > > We
> > > > > >> have
> > > > > >>> no definition of "none" in the newly introduced
> > > AutoOffsetReset.java
> > > > > >> class
> > > > > >>> hence I am assuming that if "none" is specified as a config
> > option
> > > > then
> > > > > >>> that config will be ignored, correct? Or are we deprecating the
> > > usage
> > > > > of
> > > > > >>> "none" altogether?
> > > > > >>>
> > > > > >>> AM8: Minor: The new class AutoOffsetReset under interfaces
> > mentions
> > > > the
> > > > > >>> name as OffsetResetStrategy.java. This requires correction.
> > > > > >>>
> > > > > >>> AM9: Is the package name correct for AutoOffsetReset as
> > > > > >>> org.apache.kafka.streams, shouldn't it be under clients
> package?
> > > > > >>>
> > > > > >>> AM10: What does -1L and -2L mean as long for latest and
> earliest
> > in
> > > > > >>> AutoOffsetReset.java? Is it just a long placeholder which will
> > > never
> > > > be
> > > > > >>> used elsewhere for latest and earliest? If yes then does it
> make
> > > > sense
> > > > > to
> > > > > >>> keep long as Optional, and use Optional.empty() for latest and
> > > > > earliest?
> > > > > >>>
> > > > > >>> Regards,
> > > > > >>> Apoorv Mittal
> > > > > >>>
> > > > > >>>
> > > > > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
> > > > manikumar.reddy@gmail.com>
> > > > > >>> wrote:
> > > > > >>>
> > > > > >>>> Thanks Ismael and Lianet for the reviews.
> > > > > >>>>
> > > > > >>>> Based on suggestions, I have updated the KIP to in favour of
> > > having
> > > > a
> > > > > >>>> single config (auto.offset.reset).
> > > > > >>>> I have also adopted the Lianet's suggestion on naming.
> > > > > >>>>
> > > > > >>>> auto.offset.reset=back:P3D -> reset back 3 days
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> Let me know if there are any concerns.
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> Thanks,
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <lianetmr@gmail.com
> >
> > > > wrote:
> > > > > >>>>>
> > > > > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful
> > indeed.
> > > > > >>>>>
> > > > > >>>>> I also lean towards having a single config given that it's
> all
> > > > about
> > > > > >>> the
> > > > > >>>>> reset policy, seems all the same "what" (auto reset policy)
> and
> > > we
> > > > > >> are
> > > > > >>>>> just extending the with a new behaviour. Regarding the naming
> > > > (agree
> > > > > >> on
> > > > > >>>>> duration being confusing), what about something to show that
> > it's
> > > > > >>> simply
> > > > > >>>>> about how far back to reset:
> > > > > >>>>>
> > > > > >>>>> auto.offset.reset=EARLIEST
> > > > > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined
> with
> > > > > >> ISO8601
> > > > > >>>>> seems really easy to read/understand from the config
> definition
> > > > > >> itself)
> > > > > >>>>>
> > > > > >>>>> Something like that would definitely break consistency with
> the
> > > > > >> command
> > > > > >>>>> line tool argument "by_duration", but if it seems clearer we
> > > should
> > > > > >>>>> consider the tradeoff and not penalize the consumer
> > API/configs.
> > > > > >>>>>
> > > > > >>>>> Thanks!
> > > > > >>>>>
> > > > > >>>>> Lianet
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <
> me@ismaeljuma.com>
> > > > > >> wrote:
> > > > > >>>>>
> > > > > >>>>>> Thanks for the KIP, this is useful. A comment below.
> > > > > >>>>>>
> > > > > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <
> > > mjsax@apache.org>
> > > > > >>>> wrote:
> > > > > >>>>>>
> > > > > >>>>>>> I am personally not convinced that adding a new config
> > > > > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
> > > > > >> general
> > > > > >>>> has
> > > > > >>>>>>> way too many configs and trying to avoid adding more
> configs
> > > > > >> seems
> > > > > >>>> to be
> > > > > >>>>>>> desirable? -- It seems this might be a point of
> contention,
> > > and
> > > > > >> if
> > > > > >>>> the
> > > > > >>>>>>> majority of people wants this new config so be it. I just
> > > wanted
> > > > > >> to
> > > > > >>>>>>> stress my concerns about it.
> > > > > >>>>>>
> > > > > >>>>>>
> > > > > >>>>>> I agree that we don't need a new config. We can simply use a
> > > value
> > > > > >>> for
> > > > > >>>> the
> > > > > >>>>>> existing config. I think a prefix followed by the relevant
> > > ISO8601
> > > > > >>>> string
> > > > > >>>>>> would be clear enough. For example, "by-duration:P23DT23H"
> or
> > > > > >>> something
> > > > > >>>>>> along those lines. I do find the "by-duration" description a
> > bit
> > > > > >>>> confusing
> > > > > >>>>>> for what we're doing here (i.e. current time - duration)
> > > although
> > > > > >>>> there is
> > > > > >>>>>> precedent in the reset offsets tool.
> > > > > >>>>>>
> > > > > >>>>>> Ismael
> > > > > >>>>>>
> > > > > >>>>
> > > > > >>>
> > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Jun Rao <ju...@confluent.io.INVALID>.
Hi, Manikumar,
Thanks for the explanation. We can follow the existing KStreams pattern.
Could AutoOffsetReset(String name, long duration) just
be AutoOffsetReset(long duration)?
Jun
On Wed, Nov 13, 2024 at 11:53 AM Manikumar <ma...@gmail.com>
wrote:
> HI Jun,
>
> JR10: I was trying to follow KS conventions where we use non-public
> sub-class with necessary getters.
> Please check Matthias's suggestion here:
> https://lists.apache.org/thread/mln783cbswgj14wt4hykcks4kfyl9zpf
> There will be an AutoOffsetResetInternal class which will have getter
> method.
> We can follow your suggestions if we do not use Internal class approach,
>
>
> Thanks,
>
> On Wed, Nov 13, 2024 at 11:12 PM Jun Rao <ju...@confluent.io.invalid> wrote:
>
> > Hi, Manikumar,
> >
> > Thanks for the updated KIP.
> >
> > JR10. The new AutoOffsetReset class. Could the following constructors be
> > private?
> > protected AutoOffsetReset(String name, long duration)
> > protected AutoOffsetReset(String name)
> > Could AutoOffsetReset(String name, long duration) just
> > be AutoOffsetReset(long duration)?
> > Do we need the following field?
> > protected final String name;
> > Instead of the following field, is it better to expose it through a
> public
> > method?
> > protected final Optional<Long> duration;
> >
> > Jun
> >
> > On Tue, Nov 12, 2024 at 9:41 PM Manikumar <ma...@gmail.com>
> > wrote:
> >
> > > Hi Matthias.
> > >
> > > Thanks for the review
> > >
> > > 1. looks like the majority of us are leaning towards BY_DURATION
> naming.
> > I
> > > have updated the same in the KIP.
> > >
> > > 2. Thanks. Updated the KIP to remove private/internal implementation.
> > >
> > >
> > > Thanks,
> > >
> > > On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org>
> > wrote:
> > >
> > > > Thanks for updating the KIP.
> > > >
> > > >
> > > >
> > > > I am happy to see that we seem to align to use a single config only
> :)
> > > >
> > > > Obviously, I need to bikeshed on the format: `BACK:<duration>` does
> not
> > > > read well IMHO, and I think `auto.offset.reset="BACK_BY:<duration>"`
> > > > would read much better. Andrew's suggestion of
> `BY_DURATION:<duration>`
> > > > might even be better (but I would be ok with either one).
> > > >
> > > > (I would not use `DURATION:<duration>` personally -- similar to
> > > > `BACK:<duration>` is does not read well from my POV).
> > > >
> > > >
> > > >
> > > > About KS related changes. Overall LGTM. What is the reason for having
> > > >
> > > > AutoOffsetReset.LATEST
> > > > AutoOffsetReset.EARLIEST
> > > >
> > > > as `public` variables? Seems we don't need them, but that they are
> > > > rather an internal implementation detail?
> > > >
> > > > In general, I would recommend to omit everything `private` on the KIP
> > > > (including method implementations), as it's not user facing, but only
> > > > have method signatures in the KIP.
> > > >
> > > > What I believe we need to add is a `protected` constructor (for the
> > > > internal sub-class):
> > > >
> > > > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
> > > >
> > > >
> > > >
> > > >
> > > > -Matthias
> > > >
> > > > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> > > > > Thanks Manikumar for explaining, sounds good to me.
> > > > >
> > > > > Regards,
> > > > > Apoorv Mittal
> > > > >
> > > > >
> > > > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> > > > > andrew_schofield_jira@outlook.com> wrote:
> > > > >
> > > > >> Hi,
> > > > >> Looks good now. Just one suggestion.
> > > > >>
> > > > >> AS8: Instead of "back:30D", I wonder whether the word 'duration'
> > ought
> > > > to
> > > > >> be
> > > > >> used to be consistent with kafka-consumer-groups.sh. So,
> > > > >> "by-duration:P3D" or "duration:P3D" might be better.
> > > > >>
> > > > >> The overall idea of merging the configs into one config is fine in
> > the
> > > > >> current
> > > > >> text of the KIP.
> > > > >>
> > > > >> Thanks,
> > > > >> Andrew
> > > > >>
> > > > >> ________________________________________
> > > > >> From: Manikumar <ma...@gmail.com>
> > > > >> Sent: 12 November 2024 13:30
> > > > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> > > option
> > > > >> for consumer clients
> > > > >>
> > > > >> Hi Apoorv,
> > > > >>
> > > > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not
> > proposing
> > > > any
> > > > >> public Interface/class for Kafka Consumer.
> > > > >> As mentioned in the KIP, even though OffsetResetStrategy is a
> public
> > > > class,
> > > > >> it's not used in any public APIs. I think new internal classes
> > should
> > > be
> > > > >> sufficient.
> > > > >>
> > > > >> AM8: Fixed
> > > > >>
> > > > >> AM9: This class is for kafka streams API
> > > > >>
> > > > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP
> constant
> > > > values
> > > > >> from ListOffsetsRequest
> > > > >> <
> > > > >>
> > > >
> > >
> >
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> > > > >>>
> > > > >>
> > > > >> But yes, we can use Optional in AutoOffsetReset class. Updated the
> > > KIP.
> > > > >>
> > > > >>
> > > > >> Thanks.
> > > > >>
> > > > >>
> > > > >>
> > > > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
> > > apoorvmittal10@gmail.com
> > > > >
> > > > >> wrote:
> > > > >>
> > > > >>> Hi,
> > > > >>> I read the changes for single configuration and deprecated
> > > > >>> OffsetResetStrategy.java.
> > > > >>>
> > > > >>> AM7: Question: The KIP says that previous supported values were
> > > > >>> earliest/latest/none and new back:<duration> config would be
> added.
> > > We
> > > > >> have
> > > > >>> no definition of "none" in the newly introduced
> > AutoOffsetReset.java
> > > > >> class
> > > > >>> hence I am assuming that if "none" is specified as a config
> option
> > > then
> > > > >>> that config will be ignored, correct? Or are we deprecating the
> > usage
> > > > of
> > > > >>> "none" altogether?
> > > > >>>
> > > > >>> AM8: Minor: The new class AutoOffsetReset under interfaces
> mentions
> > > the
> > > > >>> name as OffsetResetStrategy.java. This requires correction.
> > > > >>>
> > > > >>> AM9: Is the package name correct for AutoOffsetReset as
> > > > >>> org.apache.kafka.streams, shouldn't it be under clients package?
> > > > >>>
> > > > >>> AM10: What does -1L and -2L mean as long for latest and earliest
> in
> > > > >>> AutoOffsetReset.java? Is it just a long placeholder which will
> > never
> > > be
> > > > >>> used elsewhere for latest and earliest? If yes then does it make
> > > sense
> > > > to
> > > > >>> keep long as Optional, and use Optional.empty() for latest and
> > > > earliest?
> > > > >>>
> > > > >>> Regards,
> > > > >>> Apoorv Mittal
> > > > >>>
> > > > >>>
> > > > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
> > > manikumar.reddy@gmail.com>
> > > > >>> wrote:
> > > > >>>
> > > > >>>> Thanks Ismael and Lianet for the reviews.
> > > > >>>>
> > > > >>>> Based on suggestions, I have updated the KIP to in favour of
> > having
> > > a
> > > > >>>> single config (auto.offset.reset).
> > > > >>>> I have also adopted the Lianet's suggestion on naming.
> > > > >>>>
> > > > >>>> auto.offset.reset=back:P3D -> reset back 3 days
> > > > >>>>
> > > > >>>>
> > > > >>>> Let me know if there are any concerns.
> > > > >>>>
> > > > >>>>
> > > > >>>> Thanks,
> > > > >>>>
> > > > >>>>
> > > > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com>
> > > wrote:
> > > > >>>>>
> > > > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful
> indeed.
> > > > >>>>>
> > > > >>>>> I also lean towards having a single config given that it's all
> > > about
> > > > >>> the
> > > > >>>>> reset policy, seems all the same "what" (auto reset policy) and
> > we
> > > > >> are
> > > > >>>>> just extending the with a new behaviour. Regarding the naming
> > > (agree
> > > > >> on
> > > > >>>>> duration being confusing), what about something to show that
> it's
> > > > >>> simply
> > > > >>>>> about how far back to reset:
> > > > >>>>>
> > > > >>>>> auto.offset.reset=EARLIEST
> > > > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
> > > > >> ISO8601
> > > > >>>>> seems really easy to read/understand from the config definition
> > > > >> itself)
> > > > >>>>>
> > > > >>>>> Something like that would definitely break consistency with the
> > > > >> command
> > > > >>>>> line tool argument "by_duration", but if it seems clearer we
> > should
> > > > >>>>> consider the tradeoff and not penalize the consumer
> API/configs.
> > > > >>>>>
> > > > >>>>> Thanks!
> > > > >>>>>
> > > > >>>>> Lianet
> > > > >>>>>
> > > > >>>>>
> > > > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
> > > > >> wrote:
> > > > >>>>>
> > > > >>>>>> Thanks for the KIP, this is useful. A comment below.
> > > > >>>>>>
> > > > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <
> > mjsax@apache.org>
> > > > >>>> wrote:
> > > > >>>>>>
> > > > >>>>>>> I am personally not convinced that adding a new config
> > > > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
> > > > >> general
> > > > >>>> has
> > > > >>>>>>> way too many configs and trying to avoid adding more configs
> > > > >> seems
> > > > >>>> to be
> > > > >>>>>>> desirable? -- It seems this might be a point of contention,
> > and
> > > > >> if
> > > > >>>> the
> > > > >>>>>>> majority of people wants this new config so be it. I just
> > wanted
> > > > >> to
> > > > >>>>>>> stress my concerns about it.
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> I agree that we don't need a new config. We can simply use a
> > value
> > > > >>> for
> > > > >>>> the
> > > > >>>>>> existing config. I think a prefix followed by the relevant
> > ISO8601
> > > > >>>> string
> > > > >>>>>> would be clear enough. For example, "by-duration:P23DT23H" or
> > > > >>> something
> > > > >>>>>> along those lines. I do find the "by-duration" description a
> bit
> > > > >>>> confusing
> > > > >>>>>> for what we're doing here (i.e. current time - duration)
> > although
> > > > >>>> there is
> > > > >>>>>> precedent in the reset offsets tool.
> > > > >>>>>>
> > > > >>>>>> Ismael
> > > > >>>>>>
> > > > >>>>
> > > > >>>
> > > > >>
> > > > >
> > > >
> > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
HI Jun,
JR10: I was trying to follow KS conventions where we use non-public
sub-class with necessary getters.
Please check Matthias's suggestion here:
https://lists.apache.org/thread/mln783cbswgj14wt4hykcks4kfyl9zpf
There will be an AutoOffsetResetInternal class which will have getter
method.
We can follow your suggestions if we do not use Internal class approach,
Thanks,
On Wed, Nov 13, 2024 at 11:12 PM Jun Rao <ju...@confluent.io.invalid> wrote:
> Hi, Manikumar,
>
> Thanks for the updated KIP.
>
> JR10. The new AutoOffsetReset class. Could the following constructors be
> private?
> protected AutoOffsetReset(String name, long duration)
> protected AutoOffsetReset(String name)
> Could AutoOffsetReset(String name, long duration) just
> be AutoOffsetReset(long duration)?
> Do we need the following field?
> protected final String name;
> Instead of the following field, is it better to expose it through a public
> method?
> protected final Optional<Long> duration;
>
> Jun
>
> On Tue, Nov 12, 2024 at 9:41 PM Manikumar <ma...@gmail.com>
> wrote:
>
> > Hi Matthias.
> >
> > Thanks for the review
> >
> > 1. looks like the majority of us are leaning towards BY_DURATION naming.
> I
> > have updated the same in the KIP.
> >
> > 2. Thanks. Updated the KIP to remove private/internal implementation.
> >
> >
> > Thanks,
> >
> > On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org>
> wrote:
> >
> > > Thanks for updating the KIP.
> > >
> > >
> > >
> > > I am happy to see that we seem to align to use a single config only :)
> > >
> > > Obviously, I need to bikeshed on the format: `BACK:<duration>` does not
> > > read well IMHO, and I think `auto.offset.reset="BACK_BY:<duration>"`
> > > would read much better. Andrew's suggestion of `BY_DURATION:<duration>`
> > > might even be better (but I would be ok with either one).
> > >
> > > (I would not use `DURATION:<duration>` personally -- similar to
> > > `BACK:<duration>` is does not read well from my POV).
> > >
> > >
> > >
> > > About KS related changes. Overall LGTM. What is the reason for having
> > >
> > > AutoOffsetReset.LATEST
> > > AutoOffsetReset.EARLIEST
> > >
> > > as `public` variables? Seems we don't need them, but that they are
> > > rather an internal implementation detail?
> > >
> > > In general, I would recommend to omit everything `private` on the KIP
> > > (including method implementations), as it's not user facing, but only
> > > have method signatures in the KIP.
> > >
> > > What I believe we need to add is a `protected` constructor (for the
> > > internal sub-class):
> > >
> > > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
> > >
> > >
> > >
> > >
> > > -Matthias
> > >
> > > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> > > > Thanks Manikumar for explaining, sounds good to me.
> > > >
> > > > Regards,
> > > > Apoorv Mittal
> > > >
> > > >
> > > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> > > > andrew_schofield_jira@outlook.com> wrote:
> > > >
> > > >> Hi,
> > > >> Looks good now. Just one suggestion.
> > > >>
> > > >> AS8: Instead of "back:30D", I wonder whether the word 'duration'
> ought
> > > to
> > > >> be
> > > >> used to be consistent with kafka-consumer-groups.sh. So,
> > > >> "by-duration:P3D" or "duration:P3D" might be better.
> > > >>
> > > >> The overall idea of merging the configs into one config is fine in
> the
> > > >> current
> > > >> text of the KIP.
> > > >>
> > > >> Thanks,
> > > >> Andrew
> > > >>
> > > >> ________________________________________
> > > >> From: Manikumar <ma...@gmail.com>
> > > >> Sent: 12 November 2024 13:30
> > > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> > option
> > > >> for consumer clients
> > > >>
> > > >> Hi Apoorv,
> > > >>
> > > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not
> proposing
> > > any
> > > >> public Interface/class for Kafka Consumer.
> > > >> As mentioned in the KIP, even though OffsetResetStrategy is a public
> > > class,
> > > >> it's not used in any public APIs. I think new internal classes
> should
> > be
> > > >> sufficient.
> > > >>
> > > >> AM8: Fixed
> > > >>
> > > >> AM9: This class is for kafka streams API
> > > >>
> > > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant
> > > values
> > > >> from ListOffsetsRequest
> > > >> <
> > > >>
> > >
> >
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> > > >>>
> > > >>
> > > >> But yes, we can use Optional in AutoOffsetReset class. Updated the
> > KIP.
> > > >>
> > > >>
> > > >> Thanks.
> > > >>
> > > >>
> > > >>
> > > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
> > apoorvmittal10@gmail.com
> > > >
> > > >> wrote:
> > > >>
> > > >>> Hi,
> > > >>> I read the changes for single configuration and deprecated
> > > >>> OffsetResetStrategy.java.
> > > >>>
> > > >>> AM7: Question: The KIP says that previous supported values were
> > > >>> earliest/latest/none and new back:<duration> config would be added.
> > We
> > > >> have
> > > >>> no definition of "none" in the newly introduced
> AutoOffsetReset.java
> > > >> class
> > > >>> hence I am assuming that if "none" is specified as a config option
> > then
> > > >>> that config will be ignored, correct? Or are we deprecating the
> usage
> > > of
> > > >>> "none" altogether?
> > > >>>
> > > >>> AM8: Minor: The new class AutoOffsetReset under interfaces mentions
> > the
> > > >>> name as OffsetResetStrategy.java. This requires correction.
> > > >>>
> > > >>> AM9: Is the package name correct for AutoOffsetReset as
> > > >>> org.apache.kafka.streams, shouldn't it be under clients package?
> > > >>>
> > > >>> AM10: What does -1L and -2L mean as long for latest and earliest in
> > > >>> AutoOffsetReset.java? Is it just a long placeholder which will
> never
> > be
> > > >>> used elsewhere for latest and earliest? If yes then does it make
> > sense
> > > to
> > > >>> keep long as Optional, and use Optional.empty() for latest and
> > > earliest?
> > > >>>
> > > >>> Regards,
> > > >>> Apoorv Mittal
> > > >>>
> > > >>>
> > > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
> > manikumar.reddy@gmail.com>
> > > >>> wrote:
> > > >>>
> > > >>>> Thanks Ismael and Lianet for the reviews.
> > > >>>>
> > > >>>> Based on suggestions, I have updated the KIP to in favour of
> having
> > a
> > > >>>> single config (auto.offset.reset).
> > > >>>> I have also adopted the Lianet's suggestion on naming.
> > > >>>>
> > > >>>> auto.offset.reset=back:P3D -> reset back 3 days
> > > >>>>
> > > >>>>
> > > >>>> Let me know if there are any concerns.
> > > >>>>
> > > >>>>
> > > >>>> Thanks,
> > > >>>>
> > > >>>>
> > > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com>
> > wrote:
> > > >>>>>
> > > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> > > >>>>>
> > > >>>>> I also lean towards having a single config given that it's all
> > about
> > > >>> the
> > > >>>>> reset policy, seems all the same "what" (auto reset policy) and
> we
> > > >> are
> > > >>>>> just extending the with a new behaviour. Regarding the naming
> > (agree
> > > >> on
> > > >>>>> duration being confusing), what about something to show that it's
> > > >>> simply
> > > >>>>> about how far back to reset:
> > > >>>>>
> > > >>>>> auto.offset.reset=EARLIEST
> > > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
> > > >> ISO8601
> > > >>>>> seems really easy to read/understand from the config definition
> > > >> itself)
> > > >>>>>
> > > >>>>> Something like that would definitely break consistency with the
> > > >> command
> > > >>>>> line tool argument "by_duration", but if it seems clearer we
> should
> > > >>>>> consider the tradeoff and not penalize the consumer API/configs.
> > > >>>>>
> > > >>>>> Thanks!
> > > >>>>>
> > > >>>>> Lianet
> > > >>>>>
> > > >>>>>
> > > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
> > > >> wrote:
> > > >>>>>
> > > >>>>>> Thanks for the KIP, this is useful. A comment below.
> > > >>>>>>
> > > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <
> mjsax@apache.org>
> > > >>>> wrote:
> > > >>>>>>
> > > >>>>>>> I am personally not convinced that adding a new config
> > > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
> > > >> general
> > > >>>> has
> > > >>>>>>> way too many configs and trying to avoid adding more configs
> > > >> seems
> > > >>>> to be
> > > >>>>>>> desirable? -- It seems this might be a point of contention,
> and
> > > >> if
> > > >>>> the
> > > >>>>>>> majority of people wants this new config so be it. I just
> wanted
> > > >> to
> > > >>>>>>> stress my concerns about it.
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> I agree that we don't need a new config. We can simply use a
> value
> > > >>> for
> > > >>>> the
> > > >>>>>> existing config. I think a prefix followed by the relevant
> ISO8601
> > > >>>> string
> > > >>>>>> would be clear enough. For example, "by-duration:P23DT23H" or
> > > >>> something
> > > >>>>>> along those lines. I do find the "by-duration" description a bit
> > > >>>> confusing
> > > >>>>>> for what we're doing here (i.e. current time - duration)
> although
> > > >>>> there is
> > > >>>>>> precedent in the reset offsets tool.
> > > >>>>>>
> > > >>>>>> Ismael
> > > >>>>>>
> > > >>>>
> > > >>>
> > > >>
> > > >
> > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Jun Rao <ju...@confluent.io.INVALID>.
Hi, Manikumar,
Thanks for the updated KIP.
JR10. The new AutoOffsetReset class. Could the following constructors be
private?
protected AutoOffsetReset(String name, long duration)
protected AutoOffsetReset(String name)
Could AutoOffsetReset(String name, long duration) just
be AutoOffsetReset(long duration)?
Do we need the following field?
protected final String name;
Instead of the following field, is it better to expose it through a public
method?
protected final Optional<Long> duration;
Jun
On Tue, Nov 12, 2024 at 9:41 PM Manikumar <ma...@gmail.com> wrote:
> Hi Matthias.
>
> Thanks for the review
>
> 1. looks like the majority of us are leaning towards BY_DURATION naming. I
> have updated the same in the KIP.
>
> 2. Thanks. Updated the KIP to remove private/internal implementation.
>
>
> Thanks,
>
> On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org> wrote:
>
> > Thanks for updating the KIP.
> >
> >
> >
> > I am happy to see that we seem to align to use a single config only :)
> >
> > Obviously, I need to bikeshed on the format: `BACK:<duration>` does not
> > read well IMHO, and I think `auto.offset.reset="BACK_BY:<duration>"`
> > would read much better. Andrew's suggestion of `BY_DURATION:<duration>`
> > might even be better (but I would be ok with either one).
> >
> > (I would not use `DURATION:<duration>` personally -- similar to
> > `BACK:<duration>` is does not read well from my POV).
> >
> >
> >
> > About KS related changes. Overall LGTM. What is the reason for having
> >
> > AutoOffsetReset.LATEST
> > AutoOffsetReset.EARLIEST
> >
> > as `public` variables? Seems we don't need them, but that they are
> > rather an internal implementation detail?
> >
> > In general, I would recommend to omit everything `private` on the KIP
> > (including method implementations), as it's not user facing, but only
> > have method signatures in the KIP.
> >
> > What I believe we need to add is a `protected` constructor (for the
> > internal sub-class):
> >
> > protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
> >
> >
> >
> >
> > -Matthias
> >
> > On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> > > Thanks Manikumar for explaining, sounds good to me.
> > >
> > > Regards,
> > > Apoorv Mittal
> > >
> > >
> > > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> > > andrew_schofield_jira@outlook.com> wrote:
> > >
> > >> Hi,
> > >> Looks good now. Just one suggestion.
> > >>
> > >> AS8: Instead of "back:30D", I wonder whether the word 'duration' ought
> > to
> > >> be
> > >> used to be consistent with kafka-consumer-groups.sh. So,
> > >> "by-duration:P3D" or "duration:P3D" might be better.
> > >>
> > >> The overall idea of merging the configs into one config is fine in the
> > >> current
> > >> text of the KIP.
> > >>
> > >> Thanks,
> > >> Andrew
> > >>
> > >> ________________________________________
> > >> From: Manikumar <ma...@gmail.com>
> > >> Sent: 12 November 2024 13:30
> > >> To: dev@kafka.apache.org <de...@kafka.apache.org>
> > >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset
> option
> > >> for consumer clients
> > >>
> > >> Hi Apoorv,
> > >>
> > >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing
> > any
> > >> public Interface/class for Kafka Consumer.
> > >> As mentioned in the KIP, even though OffsetResetStrategy is a public
> > class,
> > >> it's not used in any public APIs. I think new internal classes should
> be
> > >> sufficient.
> > >>
> > >> AM8: Fixed
> > >>
> > >> AM9: This class is for kafka streams API
> > >>
> > >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant
> > values
> > >> from ListOffsetsRequest
> > >> <
> > >>
> >
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> > >>>
> > >>
> > >> But yes, we can use Optional in AutoOffsetReset class. Updated the
> KIP.
> > >>
> > >>
> > >> Thanks.
> > >>
> > >>
> > >>
> > >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <
> apoorvmittal10@gmail.com
> > >
> > >> wrote:
> > >>
> > >>> Hi,
> > >>> I read the changes for single configuration and deprecated
> > >>> OffsetResetStrategy.java.
> > >>>
> > >>> AM7: Question: The KIP says that previous supported values were
> > >>> earliest/latest/none and new back:<duration> config would be added.
> We
> > >> have
> > >>> no definition of "none" in the newly introduced AutoOffsetReset.java
> > >> class
> > >>> hence I am assuming that if "none" is specified as a config option
> then
> > >>> that config will be ignored, correct? Or are we deprecating the usage
> > of
> > >>> "none" altogether?
> > >>>
> > >>> AM8: Minor: The new class AutoOffsetReset under interfaces mentions
> the
> > >>> name as OffsetResetStrategy.java. This requires correction.
> > >>>
> > >>> AM9: Is the package name correct for AutoOffsetReset as
> > >>> org.apache.kafka.streams, shouldn't it be under clients package?
> > >>>
> > >>> AM10: What does -1L and -2L mean as long for latest and earliest in
> > >>> AutoOffsetReset.java? Is it just a long placeholder which will never
> be
> > >>> used elsewhere for latest and earliest? If yes then does it make
> sense
> > to
> > >>> keep long as Optional, and use Optional.empty() for latest and
> > earliest?
> > >>>
> > >>> Regards,
> > >>> Apoorv Mittal
> > >>>
> > >>>
> > >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <
> manikumar.reddy@gmail.com>
> > >>> wrote:
> > >>>
> > >>>> Thanks Ismael and Lianet for the reviews.
> > >>>>
> > >>>> Based on suggestions, I have updated the KIP to in favour of having
> a
> > >>>> single config (auto.offset.reset).
> > >>>> I have also adopted the Lianet's suggestion on naming.
> > >>>>
> > >>>> auto.offset.reset=back:P3D -> reset back 3 days
> > >>>>
> > >>>>
> > >>>> Let me know if there are any concerns.
> > >>>>
> > >>>>
> > >>>> Thanks,
> > >>>>
> > >>>>
> > >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com>
> wrote:
> > >>>>>
> > >>>>> Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> > >>>>>
> > >>>>> I also lean towards having a single config given that it's all
> about
> > >>> the
> > >>>>> reset policy, seems all the same "what" (auto reset policy) and we
> > >> are
> > >>>>> just extending the with a new behaviour. Regarding the naming
> (agree
> > >> on
> > >>>>> duration being confusing), what about something to show that it's
> > >>> simply
> > >>>>> about how far back to reset:
> > >>>>>
> > >>>>> auto.offset.reset=EARLIEST
> > >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
> > >> ISO8601
> > >>>>> seems really easy to read/understand from the config definition
> > >> itself)
> > >>>>>
> > >>>>> Something like that would definitely break consistency with the
> > >> command
> > >>>>> line tool argument "by_duration", but if it seems clearer we should
> > >>>>> consider the tradeoff and not penalize the consumer API/configs.
> > >>>>>
> > >>>>> Thanks!
> > >>>>>
> > >>>>> Lianet
> > >>>>>
> > >>>>>
> > >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
> > >> wrote:
> > >>>>>
> > >>>>>> Thanks for the KIP, this is useful. A comment below.
> > >>>>>>
> > >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> > >>>> wrote:
> > >>>>>>
> > >>>>>>> I am personally not convinced that adding a new config
> > >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
> > >> general
> > >>>> has
> > >>>>>>> way too many configs and trying to avoid adding more configs
> > >> seems
> > >>>> to be
> > >>>>>>> desirable? -- It seems this might be a point of contention, and
> > >> if
> > >>>> the
> > >>>>>>> majority of people wants this new config so be it. I just wanted
> > >> to
> > >>>>>>> stress my concerns about it.
> > >>>>>>
> > >>>>>>
> > >>>>>> I agree that we don't need a new config. We can simply use a value
> > >>> for
> > >>>> the
> > >>>>>> existing config. I think a prefix followed by the relevant ISO8601
> > >>>> string
> > >>>>>> would be clear enough. For example, "by-duration:P23DT23H" or
> > >>> something
> > >>>>>> along those lines. I do find the "by-duration" description a bit
> > >>>> confusing
> > >>>>>> for what we're doing here (i.e. current time - duration) although
> > >>>> there is
> > >>>>>> precedent in the reset offsets tool.
> > >>>>>>
> > >>>>>> Ismael
> > >>>>>>
> > >>>>
> > >>>
> > >>
> > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Matthias.
Thanks for the review
1. looks like the majority of us are leaning towards BY_DURATION naming. I
have updated the same in the KIP.
2. Thanks. Updated the KIP to remove private/internal implementation.
Thanks,
On Wed, Nov 13, 2024 at 6:28 AM Matthias J. Sax <mj...@apache.org> wrote:
> Thanks for updating the KIP.
>
>
>
> I am happy to see that we seem to align to use a single config only :)
>
> Obviously, I need to bikeshed on the format: `BACK:<duration>` does not
> read well IMHO, and I think `auto.offset.reset="BACK_BY:<duration>"`
> would read much better. Andrew's suggestion of `BY_DURATION:<duration>`
> might even be better (but I would be ok with either one).
>
> (I would not use `DURATION:<duration>` personally -- similar to
> `BACK:<duration>` is does not read well from my POV).
>
>
>
> About KS related changes. Overall LGTM. What is the reason for having
>
> AutoOffsetReset.LATEST
> AutoOffsetReset.EARLIEST
>
> as `public` variables? Seems we don't need them, but that they are
> rather an internal implementation detail?
>
> In general, I would recommend to omit everything `private` on the KIP
> (including method implementations), as it's not user facing, but only
> have method signatures in the KIP.
>
> What I believe we need to add is a `protected` constructor (for the
> internal sub-class):
>
> protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
>
>
>
>
> -Matthias
>
> On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> > Thanks Manikumar for explaining, sounds good to me.
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> > andrew_schofield_jira@outlook.com> wrote:
> >
> >> Hi,
> >> Looks good now. Just one suggestion.
> >>
> >> AS8: Instead of "back:30D", I wonder whether the word 'duration' ought
> to
> >> be
> >> used to be consistent with kafka-consumer-groups.sh. So,
> >> "by-duration:P3D" or "duration:P3D" might be better.
> >>
> >> The overall idea of merging the configs into one config is fine in the
> >> current
> >> text of the KIP.
> >>
> >> Thanks,
> >> Andrew
> >>
> >> ________________________________________
> >> From: Manikumar <ma...@gmail.com>
> >> Sent: 12 November 2024 13:30
> >> To: dev@kafka.apache.org <de...@kafka.apache.org>
> >> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> >> for consumer clients
> >>
> >> Hi Apoorv,
> >>
> >> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing
> any
> >> public Interface/class for Kafka Consumer.
> >> As mentioned in the KIP, even though OffsetResetStrategy is a public
> class,
> >> it's not used in any public APIs. I think new internal classes should be
> >> sufficient.
> >>
> >> AM8: Fixed
> >>
> >> AM9: This class is for kafka streams API
> >>
> >> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant
> values
> >> from ListOffsetsRequest
> >> <
> >>
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> >>>
> >>
> >> But yes, we can use Optional in AutoOffsetReset class. Updated the KIP.
> >>
> >>
> >> Thanks.
> >>
> >>
> >>
> >> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <apoorvmittal10@gmail.com
> >
> >> wrote:
> >>
> >>> Hi,
> >>> I read the changes for single configuration and deprecated
> >>> OffsetResetStrategy.java.
> >>>
> >>> AM7: Question: The KIP says that previous supported values were
> >>> earliest/latest/none and new back:<duration> config would be added. We
> >> have
> >>> no definition of "none" in the newly introduced AutoOffsetReset.java
> >> class
> >>> hence I am assuming that if "none" is specified as a config option then
> >>> that config will be ignored, correct? Or are we deprecating the usage
> of
> >>> "none" altogether?
> >>>
> >>> AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
> >>> name as OffsetResetStrategy.java. This requires correction.
> >>>
> >>> AM9: Is the package name correct for AutoOffsetReset as
> >>> org.apache.kafka.streams, shouldn't it be under clients package?
> >>>
> >>> AM10: What does -1L and -2L mean as long for latest and earliest in
> >>> AutoOffsetReset.java? Is it just a long placeholder which will never be
> >>> used elsewhere for latest and earliest? If yes then does it make sense
> to
> >>> keep long as Optional, and use Optional.empty() for latest and
> earliest?
> >>>
> >>> Regards,
> >>> Apoorv Mittal
> >>>
> >>>
> >>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
> >>> wrote:
> >>>
> >>>> Thanks Ismael and Lianet for the reviews.
> >>>>
> >>>> Based on suggestions, I have updated the KIP to in favour of having a
> >>>> single config (auto.offset.reset).
> >>>> I have also adopted the Lianet's suggestion on naming.
> >>>>
> >>>> auto.offset.reset=back:P3D -> reset back 3 days
> >>>>
> >>>>
> >>>> Let me know if there are any concerns.
> >>>>
> >>>>
> >>>> Thanks,
> >>>>
> >>>>
> >>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
> >>>>>
> >>>>> Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> >>>>>
> >>>>> I also lean towards having a single config given that it's all about
> >>> the
> >>>>> reset policy, seems all the same "what" (auto reset policy) and we
> >> are
> >>>>> just extending the with a new behaviour. Regarding the naming (agree
> >> on
> >>>>> duration being confusing), what about something to show that it's
> >>> simply
> >>>>> about how far back to reset:
> >>>>>
> >>>>> auto.offset.reset=EARLIEST
> >>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
> >> ISO8601
> >>>>> seems really easy to read/understand from the config definition
> >> itself)
> >>>>>
> >>>>> Something like that would definitely break consistency with the
> >> command
> >>>>> line tool argument "by_duration", but if it seems clearer we should
> >>>>> consider the tradeoff and not penalize the consumer API/configs.
> >>>>>
> >>>>> Thanks!
> >>>>>
> >>>>> Lianet
> >>>>>
> >>>>>
> >>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
> >> wrote:
> >>>>>
> >>>>>> Thanks for the KIP, this is useful. A comment below.
> >>>>>>
> >>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> >>>> wrote:
> >>>>>>
> >>>>>>> I am personally not convinced that adding a new config
> >>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
> >> general
> >>>> has
> >>>>>>> way too many configs and trying to avoid adding more configs
> >> seems
> >>>> to be
> >>>>>>> desirable? -- It seems this might be a point of contention, and
> >> if
> >>>> the
> >>>>>>> majority of people wants this new config so be it. I just wanted
> >> to
> >>>>>>> stress my concerns about it.
> >>>>>>
> >>>>>>
> >>>>>> I agree that we don't need a new config. We can simply use a value
> >>> for
> >>>> the
> >>>>>> existing config. I think a prefix followed by the relevant ISO8601
> >>>> string
> >>>>>> would be clear enough. For example, "by-duration:P23DT23H" or
> >>> something
> >>>>>> along those lines. I do find the "by-duration" description a bit
> >>>> confusing
> >>>>>> for what we're doing here (i.e. current time - duration) although
> >>>> there is
> >>>>>> precedent in the reset offsets tool.
> >>>>>>
> >>>>>> Ismael
> >>>>>>
> >>>>
> >>>
> >>
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by "Matthias J. Sax" <mj...@apache.org>.
Thanks for updating the KIP.
I am happy to see that we seem to align to use a single config only :)
Obviously, I need to bikeshed on the format: `BACK:<duration>` does not
read well IMHO, and I think `auto.offset.reset="BACK_BY:<duration>"`
would read much better. Andrew's suggestion of `BY_DURATION:<duration>`
might even be better (but I would be ok with either one).
(I would not use `DURATION:<duration>` personally -- similar to
`BACK:<duration>` is does not read well from my POV).
About KS related changes. Overall LGTM. What is the reason for having
AutoOffsetReset.LATEST
AutoOffsetReset.EARLIEST
as `public` variables? Seems we don't need them, but that they are
rather an internal implementation detail?
In general, I would recommend to omit everything `private` on the KIP
(including method implementations), as it's not user facing, but only
have method signatures in the KIP.
What I believe we need to add is a `protected` constructor (for the
internal sub-class):
protected AutoOffsetReset(AutoOffsetReset autoOffsetReset);
-Matthias
On 11/12/24 6:09 AM, Apoorv Mittal wrote:
> Thanks Manikumar for explaining, sounds good to me.
>
> Regards,
> Apoorv Mittal
>
>
> On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
> andrew_schofield_jira@outlook.com> wrote:
>
>> Hi,
>> Looks good now. Just one suggestion.
>>
>> AS8: Instead of "back:30D", I wonder whether the word 'duration' ought to
>> be
>> used to be consistent with kafka-consumer-groups.sh. So,
>> "by-duration:P3D" or "duration:P3D" might be better.
>>
>> The overall idea of merging the configs into one config is fine in the
>> current
>> text of the KIP.
>>
>> Thanks,
>> Andrew
>>
>> ________________________________________
>> From: Manikumar <ma...@gmail.com>
>> Sent: 12 November 2024 13:30
>> To: dev@kafka.apache.org <de...@kafka.apache.org>
>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
>> for consumer clients
>>
>> Hi Apoorv,
>>
>> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing any
>> public Interface/class for Kafka Consumer.
>> As mentioned in the KIP, even though OffsetResetStrategy is a public class,
>> it's not used in any public APIs. I think new internal classes should be
>> sufficient.
>>
>> AM8: Fixed
>>
>> AM9: This class is for kafka streams API
>>
>> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant values
>> from ListOffsetsRequest
>> <
>> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
>>>
>>
>> But yes, we can use Optional in AutoOffsetReset class. Updated the KIP.
>>
>>
>> Thanks.
>>
>>
>>
>> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <ap...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> I read the changes for single configuration and deprecated
>>> OffsetResetStrategy.java.
>>>
>>> AM7: Question: The KIP says that previous supported values were
>>> earliest/latest/none and new back:<duration> config would be added. We
>> have
>>> no definition of "none" in the newly introduced AutoOffsetReset.java
>> class
>>> hence I am assuming that if "none" is specified as a config option then
>>> that config will be ignored, correct? Or are we deprecating the usage of
>>> "none" altogether?
>>>
>>> AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
>>> name as OffsetResetStrategy.java. This requires correction.
>>>
>>> AM9: Is the package name correct for AutoOffsetReset as
>>> org.apache.kafka.streams, shouldn't it be under clients package?
>>>
>>> AM10: What does -1L and -2L mean as long for latest and earliest in
>>> AutoOffsetReset.java? Is it just a long placeholder which will never be
>>> used elsewhere for latest and earliest? If yes then does it make sense to
>>> keep long as Optional, and use Optional.empty() for latest and earliest?
>>>
>>> Regards,
>>> Apoorv Mittal
>>>
>>>
>>> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
>>> wrote:
>>>
>>>> Thanks Ismael and Lianet for the reviews.
>>>>
>>>> Based on suggestions, I have updated the KIP to in favour of having a
>>>> single config (auto.offset.reset).
>>>> I have also adopted the Lianet's suggestion on naming.
>>>>
>>>> auto.offset.reset=back:P3D -> reset back 3 days
>>>>
>>>>
>>>> Let me know if there are any concerns.
>>>>
>>>>
>>>> Thanks,
>>>>
>>>>
>>>> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
>>>>>
>>>>> Hi all. Thanks Manikumar for the nice improvement, useful indeed.
>>>>>
>>>>> I also lean towards having a single config given that it's all about
>>> the
>>>>> reset policy, seems all the same "what" (auto reset policy) and we
>> are
>>>>> just extending the with a new behaviour. Regarding the naming (agree
>> on
>>>>> duration being confusing), what about something to show that it's
>>> simply
>>>>> about how far back to reset:
>>>>>
>>>>> auto.offset.reset=EARLIEST
>>>>> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
>> ISO8601
>>>>> seems really easy to read/understand from the config definition
>> itself)
>>>>>
>>>>> Something like that would definitely break consistency with the
>> command
>>>>> line tool argument "by_duration", but if it seems clearer we should
>>>>> consider the tradeoff and not penalize the consumer API/configs.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Lianet
>>>>>
>>>>>
>>>>> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
>> wrote:
>>>>>
>>>>>> Thanks for the KIP, this is useful. A comment below.
>>>>>>
>>>>>> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
>>>> wrote:
>>>>>>
>>>>>>> I am personally not convinced that adding a new config
>>>>>>> `auto.offset.reset.by.duration` is the best way. Kafka in
>> general
>>>> has
>>>>>>> way too many configs and trying to avoid adding more configs
>> seems
>>>> to be
>>>>>>> desirable? -- It seems this might be a point of contention, and
>> if
>>>> the
>>>>>>> majority of people wants this new config so be it. I just wanted
>> to
>>>>>>> stress my concerns about it.
>>>>>>
>>>>>>
>>>>>> I agree that we don't need a new config. We can simply use a value
>>> for
>>>> the
>>>>>> existing config. I think a prefix followed by the relevant ISO8601
>>>> string
>>>>>> would be clear enough. For example, "by-duration:P23DT23H" or
>>> something
>>>>>> along those lines. I do find the "by-duration" description a bit
>>>> confusing
>>>>>> for what we're doing here (i.e. current time - duration) although
>>>> there is
>>>>>> precedent in the reset offsets tool.
>>>>>>
>>>>>> Ismael
>>>>>>
>>>>
>>>
>>
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Apoorv Mittal <ap...@gmail.com>.
Thanks Manikumar for explaining, sounds good to me.
Regards,
Apoorv Mittal
On Tue, Nov 12, 2024 at 1:47 PM Andrew Schofield <
andrew_schofield_jira@outlook.com> wrote:
> Hi,
> Looks good now. Just one suggestion.
>
> AS8: Instead of "back:30D", I wonder whether the word 'duration' ought to
> be
> used to be consistent with kafka-consumer-groups.sh. So,
> "by-duration:P3D" or "duration:P3D" might be better.
>
> The overall idea of merging the configs into one config is fine in the
> current
> text of the KIP.
>
> Thanks,
> Andrew
>
> ________________________________________
> From: Manikumar <ma...@gmail.com>
> Sent: 12 November 2024 13:30
> To: dev@kafka.apache.org <de...@kafka.apache.org>
> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> for consumer clients
>
> Hi Apoorv,
>
> AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing any
> public Interface/class for Kafka Consumer.
> As mentioned in the KIP, even though OffsetResetStrategy is a public class,
> it's not used in any public APIs. I think new internal classes should be
> sufficient.
>
> AM8: Fixed
>
> AM9: This class is for kafka streams API
>
> AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant values
> from ListOffsetsRequest
> <
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41
> >
>
> But yes, we can use Optional in AutoOffsetReset class. Updated the KIP.
>
>
> Thanks.
>
>
>
> On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <ap...@gmail.com>
> wrote:
>
> > Hi,
> > I read the changes for single configuration and deprecated
> > OffsetResetStrategy.java.
> >
> > AM7: Question: The KIP says that previous supported values were
> > earliest/latest/none and new back:<duration> config would be added. We
> have
> > no definition of "none" in the newly introduced AutoOffsetReset.java
> class
> > hence I am assuming that if "none" is specified as a config option then
> > that config will be ignored, correct? Or are we deprecating the usage of
> > "none" altogether?
> >
> > AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
> > name as OffsetResetStrategy.java. This requires correction.
> >
> > AM9: Is the package name correct for AutoOffsetReset as
> > org.apache.kafka.streams, shouldn't it be under clients package?
> >
> > AM10: What does -1L and -2L mean as long for latest and earliest in
> > AutoOffsetReset.java? Is it just a long placeholder which will never be
> > used elsewhere for latest and earliest? If yes then does it make sense to
> > keep long as Optional, and use Optional.empty() for latest and earliest?
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
> > wrote:
> >
> > > Thanks Ismael and Lianet for the reviews.
> > >
> > > Based on suggestions, I have updated the KIP to in favour of having a
> > > single config (auto.offset.reset).
> > > I have also adopted the Lianet's suggestion on naming.
> > >
> > > auto.offset.reset=back:P3D -> reset back 3 days
> > >
> > >
> > > Let me know if there are any concerns.
> > >
> > >
> > > Thanks,
> > >
> > >
> > > On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
> > > >
> > > > Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> > > >
> > > > I also lean towards having a single config given that it's all about
> > the
> > > > reset policy, seems all the same "what" (auto reset policy) and we
> are
> > > > just extending the with a new behaviour. Regarding the naming (agree
> on
> > > > duration being confusing), what about something to show that it's
> > simply
> > > > about how far back to reset:
> > > >
> > > > auto.offset.reset=EARLIEST
> > > > auto.offset.reset=BACK:P3D -> reset back 3 days (combined with
> ISO8601
> > > > seems really easy to read/understand from the config definition
> itself)
> > > >
> > > > Something like that would definitely break consistency with the
> command
> > > > line tool argument "by_duration", but if it seems clearer we should
> > > > consider the tradeoff and not penalize the consumer API/configs.
> > > >
> > > > Thanks!
> > > >
> > > > Lianet
> > > >
> > > >
> > > > On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com>
> wrote:
> > > >
> > > > > Thanks for the KIP, this is useful. A comment below.
> > > > >
> > > > > On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> > > wrote:
> > > > >
> > > > > > I am personally not convinced that adding a new config
> > > > > > `auto.offset.reset.by.duration` is the best way. Kafka in
> general
> > > has
> > > > > > way too many configs and trying to avoid adding more configs
> seems
> > > to be
> > > > > > desirable? -- It seems this might be a point of contention, and
> if
> > > the
> > > > > > majority of people wants this new config so be it. I just wanted
> to
> > > > > > stress my concerns about it.
> > > > >
> > > > >
> > > > > I agree that we don't need a new config. We can simply use a value
> > for
> > > the
> > > > > existing config. I think a prefix followed by the relevant ISO8601
> > > string
> > > > > would be clear enough. For example, "by-duration:P23DT23H" or
> > something
> > > > > along those lines. I do find the "by-duration" description a bit
> > > confusing
> > > > > for what we're doing here (i.e. current time - duration) although
> > > there is
> > > > > precedent in the reset offsets tool.
> > > > >
> > > > > Ismael
> > > > >
> > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Andrew Schofield <an...@outlook.com>.
Hi,
Looks good now. Just one suggestion.
AS8: Instead of "back:30D", I wonder whether the word 'duration' ought to be
used to be consistent with kafka-consumer-groups.sh. So,
"by-duration:P3D" or "duration:P3D" might be better.
The overall idea of merging the configs into one config is fine in the current
text of the KIP.
Thanks,
Andrew
________________________________________
From: Manikumar <ma...@gmail.com>
Sent: 12 November 2024 13:30
To: dev@kafka.apache.org <de...@kafka.apache.org>
Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Hi Apoorv,
AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing any
public Interface/class for Kafka Consumer.
As mentioned in the KIP, even though OffsetResetStrategy is a public class,
it's not used in any public APIs. I think new internal classes should be
sufficient.
AM8: Fixed
AM9: This class is for kafka streams API
AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant values
from ListOffsetsRequest
<https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41>
But yes, we can use Optional in AutoOffsetReset class. Updated the KIP.
Thanks.
On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <ap...@gmail.com>
wrote:
> Hi,
> I read the changes for single configuration and deprecated
> OffsetResetStrategy.java.
>
> AM7: Question: The KIP says that previous supported values were
> earliest/latest/none and new back:<duration> config would be added. We have
> no definition of "none" in the newly introduced AutoOffsetReset.java class
> hence I am assuming that if "none" is specified as a config option then
> that config will be ignored, correct? Or are we deprecating the usage of
> "none" altogether?
>
> AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
> name as OffsetResetStrategy.java. This requires correction.
>
> AM9: Is the package name correct for AutoOffsetReset as
> org.apache.kafka.streams, shouldn't it be under clients package?
>
> AM10: What does -1L and -2L mean as long for latest and earliest in
> AutoOffsetReset.java? Is it just a long placeholder which will never be
> used elsewhere for latest and earliest? If yes then does it make sense to
> keep long as Optional, and use Optional.empty() for latest and earliest?
>
> Regards,
> Apoorv Mittal
>
>
> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
> wrote:
>
> > Thanks Ismael and Lianet for the reviews.
> >
> > Based on suggestions, I have updated the KIP to in favour of having a
> > single config (auto.offset.reset).
> > I have also adopted the Lianet's suggestion on naming.
> >
> > auto.offset.reset=back:P3D -> reset back 3 days
> >
> >
> > Let me know if there are any concerns.
> >
> >
> > Thanks,
> >
> >
> > On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
> > >
> > > Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> > >
> > > I also lean towards having a single config given that it's all about
> the
> > > reset policy, seems all the same "what" (auto reset policy) and we are
> > > just extending the with a new behaviour. Regarding the naming (agree on
> > > duration being confusing), what about something to show that it's
> simply
> > > about how far back to reset:
> > >
> > > auto.offset.reset=EARLIEST
> > > auto.offset.reset=BACK:P3D -> reset back 3 days (combined with ISO8601
> > > seems really easy to read/understand from the config definition itself)
> > >
> > > Something like that would definitely break consistency with the command
> > > line tool argument "by_duration", but if it seems clearer we should
> > > consider the tradeoff and not penalize the consumer API/configs.
> > >
> > > Thanks!
> > >
> > > Lianet
> > >
> > >
> > > On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com> wrote:
> > >
> > > > Thanks for the KIP, this is useful. A comment below.
> > > >
> > > > On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> > wrote:
> > > >
> > > > > I am personally not convinced that adding a new config
> > > > > `auto.offset.reset.by.duration` is the best way. Kafka in general
> > has
> > > > > way too many configs and trying to avoid adding more configs seems
> > to be
> > > > > desirable? -- It seems this might be a point of contention, and if
> > the
> > > > > majority of people wants this new config so be it. I just wanted to
> > > > > stress my concerns about it.
> > > >
> > > >
> > > > I agree that we don't need a new config. We can simply use a value
> for
> > the
> > > > existing config. I think a prefix followed by the relevant ISO8601
> > string
> > > > would be clear enough. For example, "by-duration:P23DT23H" or
> something
> > > > along those lines. I do find the "by-duration" description a bit
> > confusing
> > > > for what we're doing here (i.e. current time - duration) although
> > there is
> > > > precedent in the reset offsets tool.
> > > >
> > > > Ismael
> > > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Apoorv,
AM7: AutoOffsetReset.java is for Kafka Streams API. I am not proposing any
public Interface/class for Kafka Consumer.
As mentioned in the KIP, even though OffsetResetStrategy is a public class,
it's not used in any public APIs. I think new internal classes should be
sufficient.
AM8: Fixed
AM9: This class is for kafka streams API
AM10: I was using the EARLIEST_TIMESTAMP, LATEST_TIMESTAMP constant values
from ListOffsetsRequest
<https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/ListOffsetsRequest.java#L41>
But yes, we can use Optional in AutoOffsetReset class. Updated the KIP.
Thanks.
On Tue, Nov 12, 2024 at 6:15 PM Apoorv Mittal <ap...@gmail.com>
wrote:
> Hi,
> I read the changes for single configuration and deprecated
> OffsetResetStrategy.java.
>
> AM7: Question: The KIP says that previous supported values were
> earliest/latest/none and new back:<duration> config would be added. We have
> no definition of "none" in the newly introduced AutoOffsetReset.java class
> hence I am assuming that if "none" is specified as a config option then
> that config will be ignored, correct? Or are we deprecating the usage of
> "none" altogether?
>
> AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
> name as OffsetResetStrategy.java. This requires correction.
>
> AM9: Is the package name correct for AutoOffsetReset as
> org.apache.kafka.streams, shouldn't it be under clients package?
>
> AM10: What does -1L and -2L mean as long for latest and earliest in
> AutoOffsetReset.java? Is it just a long placeholder which will never be
> used elsewhere for latest and earliest? If yes then does it make sense to
> keep long as Optional, and use Optional.empty() for latest and earliest?
>
> Regards,
> Apoorv Mittal
>
>
> On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
> wrote:
>
> > Thanks Ismael and Lianet for the reviews.
> >
> > Based on suggestions, I have updated the KIP to in favour of having a
> > single config (auto.offset.reset).
> > I have also adopted the Lianet's suggestion on naming.
> >
> > auto.offset.reset=back:P3D -> reset back 3 days
> >
> >
> > Let me know if there are any concerns.
> >
> >
> > Thanks,
> >
> >
> > On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
> > >
> > > Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> > >
> > > I also lean towards having a single config given that it's all about
> the
> > > reset policy, seems all the same "what" (auto reset policy) and we are
> > > just extending the with a new behaviour. Regarding the naming (agree on
> > > duration being confusing), what about something to show that it's
> simply
> > > about how far back to reset:
> > >
> > > auto.offset.reset=EARLIEST
> > > auto.offset.reset=BACK:P3D -> reset back 3 days (combined with ISO8601
> > > seems really easy to read/understand from the config definition itself)
> > >
> > > Something like that would definitely break consistency with the command
> > > line tool argument "by_duration", but if it seems clearer we should
> > > consider the tradeoff and not penalize the consumer API/configs.
> > >
> > > Thanks!
> > >
> > > Lianet
> > >
> > >
> > > On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com> wrote:
> > >
> > > > Thanks for the KIP, this is useful. A comment below.
> > > >
> > > > On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> > wrote:
> > > >
> > > > > I am personally not convinced that adding a new config
> > > > > `auto.offset.reset.by.duration` is the best way. Kafka in general
> > has
> > > > > way too many configs and trying to avoid adding more configs seems
> > to be
> > > > > desirable? -- It seems this might be a point of contention, and if
> > the
> > > > > majority of people wants this new config so be it. I just wanted to
> > > > > stress my concerns about it.
> > > >
> > > >
> > > > I agree that we don't need a new config. We can simply use a value
> for
> > the
> > > > existing config. I think a prefix followed by the relevant ISO8601
> > string
> > > > would be clear enough. For example, "by-duration:P23DT23H" or
> something
> > > > along those lines. I do find the "by-duration" description a bit
> > confusing
> > > > for what we're doing here (i.e. current time - duration) although
> > there is
> > > > precedent in the reset offsets tool.
> > > >
> > > > Ismael
> > > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Apoorv Mittal <ap...@gmail.com>.
Hi,
I read the changes for single configuration and deprecated
OffsetResetStrategy.java.
AM7: Question: The KIP says that previous supported values were
earliest/latest/none and new back:<duration> config would be added. We have
no definition of "none" in the newly introduced AutoOffsetReset.java class
hence I am assuming that if "none" is specified as a config option then
that config will be ignored, correct? Or are we deprecating the usage of
"none" altogether?
AM8: Minor: The new class AutoOffsetReset under interfaces mentions the
name as OffsetResetStrategy.java. This requires correction.
AM9: Is the package name correct for AutoOffsetReset as
org.apache.kafka.streams, shouldn't it be under clients package?
AM10: What does -1L and -2L mean as long for latest and earliest in
AutoOffsetReset.java? Is it just a long placeholder which will never be
used elsewhere for latest and earliest? If yes then does it make sense to
keep long as Optional, and use Optional.empty() for latest and earliest?
Regards,
Apoorv Mittal
On Tue, Nov 12, 2024 at 12:06 PM Manikumar <ma...@gmail.com>
wrote:
> Thanks Ismael and Lianet for the reviews.
>
> Based on suggestions, I have updated the KIP to in favour of having a
> single config (auto.offset.reset).
> I have also adopted the Lianet's suggestion on naming.
>
> auto.offset.reset=back:P3D -> reset back 3 days
>
>
> Let me know if there are any concerns.
>
>
> Thanks,
>
>
> On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
> >
> > Hi all. Thanks Manikumar for the nice improvement, useful indeed.
> >
> > I also lean towards having a single config given that it's all about the
> > reset policy, seems all the same "what" (auto reset policy) and we are
> > just extending the with a new behaviour. Regarding the naming (agree on
> > duration being confusing), what about something to show that it's simply
> > about how far back to reset:
> >
> > auto.offset.reset=EARLIEST
> > auto.offset.reset=BACK:P3D -> reset back 3 days (combined with ISO8601
> > seems really easy to read/understand from the config definition itself)
> >
> > Something like that would definitely break consistency with the command
> > line tool argument "by_duration", but if it seems clearer we should
> > consider the tradeoff and not penalize the consumer API/configs.
> >
> > Thanks!
> >
> > Lianet
> >
> >
> > On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com> wrote:
> >
> > > Thanks for the KIP, this is useful. A comment below.
> > >
> > > On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org>
> wrote:
> > >
> > > > I am personally not convinced that adding a new config
> > > > `auto.offset.reset.by.duration` is the best way. Kafka in general
> has
> > > > way too many configs and trying to avoid adding more configs seems
> to be
> > > > desirable? -- It seems this might be a point of contention, and if
> the
> > > > majority of people wants this new config so be it. I just wanted to
> > > > stress my concerns about it.
> > >
> > >
> > > I agree that we don't need a new config. We can simply use a value for
> the
> > > existing config. I think a prefix followed by the relevant ISO8601
> string
> > > would be clear enough. For example, "by-duration:P23DT23H" or something
> > > along those lines. I do find the "by-duration" description a bit
> confusing
> > > for what we're doing here (i.e. current time - duration) although
> there is
> > > precedent in the reset offsets tool.
> > >
> > > Ismael
> > >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Thanks Ismael and Lianet for the reviews.
Based on suggestions, I have updated the KIP to in favour of having a
single config (auto.offset.reset).
I have also adopted the Lianet's suggestion on naming.
auto.offset.reset=back:P3D -> reset back 3 days
Let me know if there are any concerns.
Thanks,
On Sat, Nov 9, 2024 at 10:06 PM Lianet M. <li...@gmail.com> wrote:
>
> Hi all. Thanks Manikumar for the nice improvement, useful indeed.
>
> I also lean towards having a single config given that it's all about the
> reset policy, seems all the same "what" (auto reset policy) and we are
> just extending the with a new behaviour. Regarding the naming (agree on
> duration being confusing), what about something to show that it's simply
> about how far back to reset:
>
> auto.offset.reset=EARLIEST
> auto.offset.reset=BACK:P3D -> reset back 3 days (combined with ISO8601
> seems really easy to read/understand from the config definition itself)
>
> Something like that would definitely break consistency with the command
> line tool argument "by_duration", but if it seems clearer we should
> consider the tradeoff and not penalize the consumer API/configs.
>
> Thanks!
>
> Lianet
>
>
> On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com> wrote:
>
> > Thanks for the KIP, this is useful. A comment below.
> >
> > On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org> wrote:
> >
> > > I am personally not convinced that adding a new config
> > > `auto.offset.reset.by.duration` is the best way. Kafka in general has
> > > way too many configs and trying to avoid adding more configs seems to be
> > > desirable? -- It seems this might be a point of contention, and if the
> > > majority of people wants this new config so be it. I just wanted to
> > > stress my concerns about it.
> >
> >
> > I agree that we don't need a new config. We can simply use a value for the
> > existing config. I think a prefix followed by the relevant ISO8601 string
> > would be clear enough. For example, "by-duration:P23DT23H" or something
> > along those lines. I do find the "by-duration" description a bit confusing
> > for what we're doing here (i.e. current time - duration) although there is
> > precedent in the reset offsets tool.
> >
> > Ismael
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by "Lianet M." <li...@gmail.com>.
Hi all. Thanks Manikumar for the nice improvement, useful indeed.
I also lean towards having a single config given that it's all about the
reset policy, seems all the same "what" (auto reset policy) and we are
just extending the with a new behaviour. Regarding the naming (agree on
duration being confusing), what about something to show that it's simply
about how far back to reset:
auto.offset.reset=EARLIEST
auto.offset.reset=BACK:P3D -> reset back 3 days (combined with ISO8601
seems really easy to read/understand from the config definition itself)
Something like that would definitely break consistency with the command
line tool argument "by_duration", but if it seems clearer we should
consider the tradeoff and not penalize the consumer API/configs.
Thanks!
Lianet
On Sat, Nov 9, 2024 at 2:47 AM Ismael Juma <me...@ismaeljuma.com> wrote:
> Thanks for the KIP, this is useful. A comment below.
>
> On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org> wrote:
>
> > I am personally not convinced that adding a new config
> > `auto.offset.reset.by.duration` is the best way. Kafka in general has
> > way too many configs and trying to avoid adding more configs seems to be
> > desirable? -- It seems this might be a point of contention, and if the
> > majority of people wants this new config so be it. I just wanted to
> > stress my concerns about it.
>
>
> I agree that we don't need a new config. We can simply use a value for the
> existing config. I think a prefix followed by the relevant ISO8601 string
> would be clear enough. For example, "by-duration:P23DT23H" or something
> along those lines. I do find the "by-duration" description a bit confusing
> for what we're doing here (i.e. current time - duration) although there is
> precedent in the reset offsets tool.
>
> Ismael
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Ismael Juma <me...@ismaeljuma.com>.
Thanks for the KIP, this is useful. A comment below.
On Thu, Nov 7, 2024 at 4:51 PM Matthias J. Sax <mj...@apache.org> wrote:
> I am personally not convinced that adding a new config
> `auto.offset.reset.by.duration` is the best way. Kafka in general has
> way too many configs and trying to avoid adding more configs seems to be
> desirable? -- It seems this might be a point of contention, and if the
> majority of people wants this new config so be it. I just wanted to
> stress my concerns about it.
I agree that we don't need a new config. We can simply use a value for the
existing config. I think a prefix followed by the relevant ISO8601 string
would be clear enough. For example, "by-duration:P23DT23H" or something
along those lines. I do find the "by-duration" description a bit confusing
for what we're doing here (i.e. current time - duration) although there is
precedent in the reset offsets tool.
Ismael
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by "Matthias J. Sax" <mj...@apache.org>.
Thanks for updating the KIP.
I am personally not convinced that adding a new config
`auto.offset.reset.by.duration` is the best way. Kafka in general has
way too many configs and trying to avoid adding more configs seems to be
desirable? -- It seems this might be a point of contention, and if the
majority of people wants this new config so be it. I just wanted to
stress my concerns about it.
One question about "earliest_local": if we fetch this offset from the
server, and seek to it later, and start fetching, won't there be a race
condition? The oldest segment could have been discarded locally in the
mean time? Maybe not too much of a big deal: the server would just need
to reload it from the tier. Just want to ensure my understanding is
correct, and make sure nobody has concerns about it.
For Kafka Streams, just adding the new option so the existing enum does
not work IMHO.
For example, we have a method:
addSource(final AutoOffsetReset offsetReset,
final String name,
final String... topics)
If a user would use BY_DURATION, there is no option to pass in the
actual duration (and we might need to throw an exception). And if we
overload `addSource` adding a fourth parameter, it would be odd too, as
users could pass in `EARLIEST` plus a duration, and we would need to
throw an exception or ignore the given duration. Overall not an easy to
use API.
Thus, I would suggest to deprecate the existing `AutoOffsetReset` enum,
and add a new class `AutoOffsetReset` for which we can guide users
accordingly avoiding corner cases:
public class AutoOffsetReset() {
public static AutoOffsetReset earliest();
public static AutoOffsetReset latest();
public static AutoOffsetReset byDuration(Duration duration);
public static AutoOffsetReset earliestLocal();
}
The existing enum is contained inside `Topology` so we can add the new
class just for package `org.apache.kafka.streams` to avoid naming conflicts.
Additionally, we would deprecate all methods taking existing enum
`AutoOffsetReset` (only two classed `Topology` and `Consumed` are
affected) and add new overload which accepts the new `class
AutoOffsetReset` instead.
-Matthias
On 11/7/24 1:57 PM, Jun Rao wrote:
> Hi, Manikumar,
>
> Thanks for the KIP. A couple of comments.
>
> JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
> sense for a consumer app to bootstrap based on time. The time that a topic
> is kept locally seems irrelevant to a consumer application.
>
> JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> covers the common scenario in KIP-842 and is simpler. The scenario
> described in KIP-842 is about which initial offset to use when a new
> partition is added. This is more or less the same problem for choosing the
> initial offset for existing partitions. Having a time based option provides
> more flexibility than earliest or latest, and is likely good enough for
> most usage.
>
> Jun
>
>
> On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
> wrote:
>
>> Thanks Manikumar and Andrew.
>>
>> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
>> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
>> itself. However I agree that this is just another convenient way and not
>> necessary to support functionality. Skipping it sounds good to me.
>>
>> Regards,
>> Apoorv Mittal
>>
>>
>> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
>> andrew_schofield_jira@outlook.com> wrote:
>>
>>> Hi Manikumar,
>>>
>>> AS7: In response to AM6, I agree that in general the combination
>>> of offsetsForTimes() and seek() will do what is required. The one case
>> that
>>> I think is more tricky is seeking to the local earliest/beginning.
>>>
>>> The Consumer API has Consumer.beginningOffsets and
>>> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
>>> Similarly there are methods for OffsetResetStrategy.LATEST.
>>>
>>> With the Consumer API, I don't think you can find the local earliest
>>> offset.
>>> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
>>> We could add equivalents of Consumer.beginningOffsets and
>>> Consumer.seekToBeginning. An application could always use the
>>> Admin API with the Consumer API.
>>>
>>> Personally, I would not complicate this KIP with these new methods when
>>> the focus is more on duration-based offset reset and configs.
>>>
>>> Thanks,
>>> Andrew
>>> ________________________________________
>>> From: Manikumar <ma...@gmail.com>
>>> Sent: 06 November 2024 04:20
>>> To: dev@kafka.apache.org <de...@kafka.apache.org>
>>> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
>>> for consumer clients
>>>
>>> Hi Apoorv,
>>>
>>> Thanks for the review.
>>>
>>> AM5: Thanks, Updated the KIP.
>>>
>>> AM6: Currently we can achieve this with the combination of
>>> offsetsForTimes() and seek() API..
>>> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
>>> Long> timestampsToSearch) if required.
>>> Let's see what others think.
>>>
>>> Thanks,
>>>
>>> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
>>> wrote:
>>>>
>>>> Hi Manikumar,
>>>> Thanks for the changes. Just minor comment and a question:
>>>>
>>>> AM5: The description "How to initialize the share-partition start
>>> offset:"
>>>> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
>>>> Should we write the details as defined in KIP-932 i.e.
>>>>
>>>> How to initialize the share-partition start offset:
>>>>
>>>> -
>>>>
>>>> "earliest" : automatically reset the offset to the earliest offset
>>>> -
>>>>
>>>> "latest" : automatically reset the offset to the latest offset
>>>> -
>>>>
>>>> "*earliest_local": *automatically resets the offset to the earliest
>>>> message stored in the local log on the broker.
>>>> -
>>>>
>>>> "*by_duration": *automatically resets the offset to the earliest
>>> offset
>>>> whose timestamp is greater than or equal to the configured duration
>>>> * (auto.offset.reset.by.duration).*
>>>>
>>>>
>>>> *or* maybe just replace ":" with "." i.e. "How to initialize the
>>>> share-partition start offset." as the details of the new configs are
>>>> defined at top in different sections as well.
>>>>
>>>> AM6: Question: KafkaConsumer has public methods defined to "seek" for
>> the
>>>> reset strategy like "seekToBeginning" and "seekToEnd" which uses
>>>> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
>> it
>>>> would be sensible to add additional KafkaConsumer APIs for newly
>>> introduced
>>>> strategies?
>>>>
>>>> Regards,
>>>> Apoorv Mittal
>>>>
>>>>
>>>> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
>>> wrote:
>>>>
>>>>> Hi Matthias,
>>>>>
>>>>> Thanks for the review.
>>>>>
>>>>> MS1: looks like KIP-842 is stuck in the voting. Current changes
>> should
>>>>> fit into KIP-842 (few updates definitely required) as KIP-842 is
>>>>> proposing to add new configs (auto.offset.reset.on.no.initial.offset
>>>>> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
>>>>> after completing this KIP.
>>>>>
>>>>> MS2: Added support for earliest-local config to reset to oldest local
>>>>> offset and changes to kafka-consumer-group cmd.
>>>>>
>>>>> MS3: Based on suggestions, I have updated the config option to
>> support
>>>>> ISO format.
>>>>>
>>>>> MS4: I have included the AutoOffsetReset changes to the KIP. I
>>>>> definitely need your help on refining the API/solution for KS :)
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
>>> wrote:
>>>>>>
>>>>>> Thanks for the KIP.
>>>>>>
>>>>>> A somewhat orthogonal question I have is, if we should try to merge
>>> this
>>>>>> KIP with the existing KIP-842:
>>>>>>
>>>>>
>>>
>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
>>>>>>
>>>>>> While KIP-842 has a different intention, ie, separating the case of
>>> "no
>>>>>> offset during initial startup" vs "offset out of bounds during
>>>>>> processing", it might still be worth it? My motivation for this
>>> question
>>>>>> is, that `auto.offset.reset` is one of the most central configs we
>>> have,
>>>>>> and thus, doing a single larger change (ie, both KIPs together)
>>> might be
>>>>>> better (less noise) than doing two independent changes? Thoughts? I
>>> know
>>>>>> it might be a little bit of a stretch, but asking cannot hurt :)
>>>>>>
>>>>>>
>>>>>> About the KIP itself, did we consider to add something like
>>>>>> "latest-local" to say reset to oldest local, but not fetch from
>>> tiered
>>>>>> storage?
>>>>>>
>>>>>> For the format of the config, did we consider what we do in
>>>>>> `bin/kafka-consumer-group.sh`? It has multiple different options
>> like
>>>>>>
>>>>>> --by-duration <duration: format `PnDTnHnMnS`>
>>>>>> --shift-by <number-of-records>
>>>>>>
>>>>>> --to-datetime <fixed point in time: format
>>> `YYYY-MM-DDTHH:mm:SS.sss`>
>>>>>> --to-offset <absolute offset>
>>>>>>
>>>>>> As it also uses ISO format, it might be good to also use them (even
>>> if I
>>>>>> can see the appeal and simplicity of what you proposed).
>>>>>>
>>>>>>
>>>>>> I also want to add to (AM1), as there is also
>>> `Topology.AutoOffsetReset`
>>>>>> enum in Kafka Streams. I think we would need to convert this into a
>>>>>> class. While it could be done is a follow up KIP, too, it seems
>> best
>>> to
>>>>>> do this holistically in a single KIP, because KS is not something
>>> on-top
>>>>>> of Kafka, but it's part of Kafka. I am happy to help with the
>> design
>>> and
>>>>>> even PRs if necessary, but would strongly prefer to do it all in a
>>>>>> single KIP.
>>>>>>
>>>>>>
>>>>>> Btw: if we add something like "latest-local", it might also be good
>>> to
>>>>>> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
>>> works
>>>>>> slightly different, as it does commit an offset and there could be
>>> some
>>>>>> race condition between committing "latest-local", tiering, and when
>>> the
>>>>>> consumer is actually started?
>>>>>>
>>>>>>
>>>>>> -Matthias
>>>>>>
>>>>>>
>>>>>> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
>>>>>>> Hi Manikumar,
>>>>>>> Thanks for the KIP, this new strategy would be helpful in
>>> specifying
>>>>> fetch
>>>>>>> behaviour.
>>>>>>>
>>>>>>> AM1: The config `auto.offset.reset` is currently applied as per
>> the
>>>>> enum
>>>>>>> class OffsetResetStarategy which is part of kafka-clients javadoc
>>>>>>> <
>>>>>
>>> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
>>> .
>>>>>>> Are we also proposing to somehow add new definitions in the same
>>> class?
>>>>>>> However as new configurations will be a string representation
>> hence
>>>>> are we
>>>>>>> moving away from OffsetResetStartegy enum class altogether?
>> Should
>>> we
>>>>>>> include the change in the KIP as OffsetResetStarategy is part of
>>> public
>>>>>>> javadoc?
>>>>>>>
>>>>>>> AM2: While I can see the ISO-8601 format is in the rejected
>>>>> alternative,
>>>>>>> should we not follow some standard of defining duration which has
>>>>> already
>>>>>>> been adopted in other systems?
>>>>>>>
>>>>>>> AM3: We've introduced new config values using the format
>>> minus-n-hours,
>>>>>>> minus-n-days, minus-n-months, and minus-n-years. Should we
>>> explicitly
>>>>>>> define the "minus" prefix, or is it implied?
>>>>>>>
>>>>>>> AM4: When supporting duration-based resets, should we also allow
>>> users
>>>>> to
>>>>>>> specify a specific checkpoint time? For example, if a checkpoint
>>>>> occurs 2
>>>>>>> days, 5 hours and 30 minutes earlier, the current four formats
>>>>>>> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
>> might
>>> not
>>>>> be
>>>>>>> sufficient. Should we consider adding a format to accommodate
>>> specific
>>>>>>> checkpoint times, or is there a reason to limit the supported
>>> formats?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Apoorv Mittal
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
>>> manikumar.reddy@gmail.com>
>>>>> wrote:
>>>>>>>
>>>>>>>> Hi everyone,
>>>>>>>> I would like to start a discussion on KIP-1106:
>>>>>>>>
>>>>>>>>
>>>>>
>>>
>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>>>>>>>>
>>>>>>>> This KIP proposes to add an additional auto offset reset
>> strategy
>>> for
>>>>>>>> consumer clients.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Manikumar
>>>>>>>>
>>>>>>>
>>>>>
>>>
>>
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Jun,
Thanks for the Review.
JR1: makes sense. We felt earliest_local can be useful in certain use
cases. I think we can ignore it for now and add back when we have a
clear use case.
JR2: Agree. KIP-842 additionally allows to set different reset
strategies for initial offset missing and out of range scenarios.
Thanks,
On Fri, Nov 8, 2024 at 3:27 AM Jun Rao <ju...@confluent.io.invalid> wrote:
>
> Hi, Manikumar,
>
> Thanks for the KIP. A couple of comments.
>
> JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
> sense for a consumer app to bootstrap based on time. The time that a topic
> is kept locally seems irrelevant to a consumer application.
>
> JR2. I took a look at the proposal of KIP-842. It seems that this KIP
> covers the common scenario in KIP-842 and is simpler. The scenario
> described in KIP-842 is about which initial offset to use when a new
> partition is added. This is more or less the same problem for choosing the
> initial offset for existing partitions. Having a time based option provides
> more flexibility than earliest or latest, and is likely good enough for
> most usage.
>
> Jun
>
>
> On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
> wrote:
>
> > Thanks Manikumar and Andrew.
> >
> > For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> > "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
> > itself. However I agree that this is just another convenient way and not
> > necessary to support functionality. Skipping it sounds good to me.
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> > andrew_schofield_jira@outlook.com> wrote:
> >
> > > Hi Manikumar,
> > >
> > > AS7: In response to AM6, I agree that in general the combination
> > > of offsetsForTimes() and seek() will do what is required. The one case
> > that
> > > I think is more tricky is seeking to the local earliest/beginning.
> > >
> > > The Consumer API has Consumer.beginningOffsets and
> > > seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> > > Similarly there are methods for OffsetResetStrategy.LATEST.
> > >
> > > With the Consumer API, I don't think you can find the local earliest
> > > offset.
> > > That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> > > We could add equivalents of Consumer.beginningOffsets and
> > > Consumer.seekToBeginning. An application could always use the
> > > Admin API with the Consumer API.
> > >
> > > Personally, I would not complicate this KIP with these new methods when
> > > the focus is more on duration-based offset reset and configs.
> > >
> > > Thanks,
> > > Andrew
> > > ________________________________________
> > > From: Manikumar <ma...@gmail.com>
> > > Sent: 06 November 2024 04:20
> > > To: dev@kafka.apache.org <de...@kafka.apache.org>
> > > Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> > > for consumer clients
> > >
> > > Hi Apoorv,
> > >
> > > Thanks for the review.
> > >
> > > AM5: Thanks, Updated the KIP.
> > >
> > > AM6: Currently we can achieve this with the combination of
> > > offsetsForTimes() and seek() API..
> > > Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> > > Long> timestampsToSearch) if required.
> > > Let's see what others think.
> > >
> > > Thanks,
> > >
> > > On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> > > wrote:
> > > >
> > > > Hi Manikumar,
> > > > Thanks for the changes. Just minor comment and a question:
> > > >
> > > > AM5: The description "How to initialize the share-partition start
> > > offset:"
> > > > for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> > > > Should we write the details as defined in KIP-932 i.e.
> > > >
> > > > How to initialize the share-partition start offset:
> > > >
> > > > -
> > > >
> > > > "earliest" : automatically reset the offset to the earliest offset
> > > > -
> > > >
> > > > "latest" : automatically reset the offset to the latest offset
> > > > -
> > > >
> > > > "*earliest_local": *automatically resets the offset to the earliest
> > > > message stored in the local log on the broker.
> > > > -
> > > >
> > > > "*by_duration": *automatically resets the offset to the earliest
> > > offset
> > > > whose timestamp is greater than or equal to the configured duration
> > > > * (auto.offset.reset.by.duration).*
> > > >
> > > >
> > > > *or* maybe just replace ":" with "." i.e. "How to initialize the
> > > > share-partition start offset." as the details of the new configs are
> > > > defined at top in different sections as well.
> > > >
> > > > AM6: Question: KafkaConsumer has public methods defined to "seek" for
> > the
> > > > reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > > > OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
> > it
> > > > would be sensible to add additional KafkaConsumer APIs for newly
> > > introduced
> > > > strategies?
> > > >
> > > > Regards,
> > > > Apoorv Mittal
> > > >
> > > >
> > > > On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Matthias,
> > > > >
> > > > > Thanks for the review.
> > > > >
> > > > > MS1: looks like KIP-842 is stuck in the voting. Current changes
> > should
> > > > > fit into KIP-842 (few updates definitely required) as KIP-842 is
> > > > > proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > > > > and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > > > > after completing this KIP.
> > > > >
> > > > > MS2: Added support for earliest-local config to reset to oldest local
> > > > > offset and changes to kafka-consumer-group cmd.
> > > > >
> > > > > MS3: Based on suggestions, I have updated the config option to
> > support
> > > > > ISO format.
> > > > >
> > > > > MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > > > definitely need your help on refining the API/solution for KS :)
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> > > wrote:
> > > > > >
> > > > > > Thanks for the KIP.
> > > > > >
> > > > > > A somewhat orthogonal question I have is, if we should try to merge
> > > this
> > > > > > KIP with the existing KIP-842:
> > > > > >
> > > > >
> > >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > > > >
> > > > > > While KIP-842 has a different intention, ie, separating the case of
> > > "no
> > > > > > offset during initial startup" vs "offset out of bounds during
> > > > > > processing", it might still be worth it? My motivation for this
> > > question
> > > > > > is, that `auto.offset.reset` is one of the most central configs we
> > > have,
> > > > > > and thus, doing a single larger change (ie, both KIPs together)
> > > might be
> > > > > > better (less noise) than doing two independent changes? Thoughts? I
> > > know
> > > > > > it might be a little bit of a stretch, but asking cannot hurt :)
> > > > > >
> > > > > >
> > > > > > About the KIP itself, did we consider to add something like
> > > > > > "latest-local" to say reset to oldest local, but not fetch from
> > > tiered
> > > > > > storage?
> > > > > >
> > > > > > For the format of the config, did we consider what we do in
> > > > > > `bin/kafka-consumer-group.sh`? It has multiple different options
> > like
> > > > > >
> > > > > > --by-duration <duration: format `PnDTnHnMnS`>
> > > > > > --shift-by <number-of-records>
> > > > > >
> > > > > > --to-datetime <fixed point in time: format
> > > `YYYY-MM-DDTHH:mm:SS.sss`>
> > > > > > --to-offset <absolute offset>
> > > > > >
> > > > > > As it also uses ISO format, it might be good to also use them (even
> > > if I
> > > > > > can see the appeal and simplicity of what you proposed).
> > > > > >
> > > > > >
> > > > > > I also want to add to (AM1), as there is also
> > > `Topology.AutoOffsetReset`
> > > > > > enum in Kafka Streams. I think we would need to convert this into a
> > > > > > class. While it could be done is a follow up KIP, too, it seems
> > best
> > > to
> > > > > > do this holistically in a single KIP, because KS is not something
> > > on-top
> > > > > > of Kafka, but it's part of Kafka. I am happy to help with the
> > design
> > > and
> > > > > > even PRs if necessary, but would strongly prefer to do it all in a
> > > > > > single KIP.
> > > > > >
> > > > > >
> > > > > > Btw: if we add something like "latest-local", it might also be good
> > > to
> > > > > > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> > > works
> > > > > > slightly different, as it does commit an offset and there could be
> > > some
> > > > > > race condition between committing "latest-local", tiering, and when
> > > the
> > > > > > consumer is actually started?
> > > > > >
> > > > > >
> > > > > > -Matthias
> > > > > >
> > > > > >
> > > > > > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > > > > Hi Manikumar,
> > > > > > > Thanks for the KIP, this new strategy would be helpful in
> > > specifying
> > > > > fetch
> > > > > > > behaviour.
> > > > > > >
> > > > > > > AM1: The config `auto.offset.reset` is currently applied as per
> > the
> > > > > enum
> > > > > > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > > > > > <
> > > > >
> > > https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> > >.
> > > > > > > Are we also proposing to somehow add new definitions in the same
> > > class?
> > > > > > > However as new configurations will be a string representation
> > hence
> > > > > are we
> > > > > > > moving away from OffsetResetStartegy enum class altogether?
> > Should
> > > we
> > > > > > > include the change in the KIP as OffsetResetStarategy is part of
> > > public
> > > > > > > javadoc?
> > > > > > >
> > > > > > > AM2: While I can see the ISO-8601 format is in the rejected
> > > > > alternative,
> > > > > > > should we not follow some standard of defining duration which has
> > > > > already
> > > > > > > been adopted in other systems?
> > > > > > >
> > > > > > > AM3: We've introduced new config values using the format
> > > minus-n-hours,
> > > > > > > minus-n-days, minus-n-months, and minus-n-years. Should we
> > > explicitly
> > > > > > > define the "minus" prefix, or is it implied?
> > > > > > >
> > > > > > > AM4: When supporting duration-based resets, should we also allow
> > > users
> > > > > to
> > > > > > > specify a specific checkpoint time? For example, if a checkpoint
> > > > > occurs 2
> > > > > > > days, 5 hours and 30 minutes earlier, the current four formats
> > > > > > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> > might
> > > not
> > > > > be
> > > > > > > sufficient. Should we consider adding a format to accommodate
> > > specific
> > > > > > > checkpoint times, or is there a reason to limit the supported
> > > formats?
> > > > > > >
> > > > > > >
> > > > > > > Regards,
> > > > > > > Apoorv Mittal
> > > > > > >
> > > > > > >
> > > > > > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > > manikumar.reddy@gmail.com>
> > > > > wrote:
> > > > > > >
> > > > > > >> Hi everyone,
> > > > > > >> I would like to start a discussion on KIP-1106:
> > > > > > >>
> > > > > > >>
> > > > >
> > >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > > > > >>
> > > > > > >> This KIP proposes to add an additional auto offset reset
> > strategy
> > > for
> > > > > > >> consumer clients.
> > > > > > >>
> > > > > > >> Regards,
> > > > > > >> Manikumar
> > > > > > >>
> > > > > > >
> > > > >
> > >
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Jun Rao <ju...@confluent.io.INVALID>.
Hi, Manikumar,
Thanks for the KIP. A couple of comments.
JR1. It doesn't seem that we need earliest_local. Intuitively, it makes
sense for a consumer app to bootstrap based on time. The time that a topic
is kept locally seems irrelevant to a consumer application.
JR2. I took a look at the proposal of KIP-842. It seems that this KIP
covers the common scenario in KIP-842 and is simpler. The scenario
described in KIP-842 is about which initial offset to use when a new
partition is added. This is more or less the same problem for choosing the
initial offset for existing partitions. Having a time based option provides
more flexibility than earliest or latest, and is likely good enough for
most usage.
Jun
On Wed, Nov 6, 2024 at 4:00 AM Apoorv Mittal <ap...@gmail.com>
wrote:
> Thanks Manikumar and Andrew.
>
> For AM6: Though I was thinking of enhancing OffsetFetcher and adding
> "seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
> itself. However I agree that this is just another convenient way and not
> necessary to support functionality. Skipping it sounds good to me.
>
> Regards,
> Apoorv Mittal
>
>
> On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
> andrew_schofield_jira@outlook.com> wrote:
>
> > Hi Manikumar,
> >
> > AS7: In response to AM6, I agree that in general the combination
> > of offsetsForTimes() and seek() will do what is required. The one case
> that
> > I think is more tricky is seeking to the local earliest/beginning.
> >
> > The Consumer API has Consumer.beginningOffsets and
> > seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> > Similarly there are methods for OffsetResetStrategy.LATEST.
> >
> > With the Consumer API, I don't think you can find the local earliest
> > offset.
> > That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> > We could add equivalents of Consumer.beginningOffsets and
> > Consumer.seekToBeginning. An application could always use the
> > Admin API with the Consumer API.
> >
> > Personally, I would not complicate this KIP with these new methods when
> > the focus is more on duration-based offset reset and configs.
> >
> > Thanks,
> > Andrew
> > ________________________________________
> > From: Manikumar <ma...@gmail.com>
> > Sent: 06 November 2024 04:20
> > To: dev@kafka.apache.org <de...@kafka.apache.org>
> > Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> > for consumer clients
> >
> > Hi Apoorv,
> >
> > Thanks for the review.
> >
> > AM5: Thanks, Updated the KIP.
> >
> > AM6: Currently we can achieve this with the combination of
> > offsetsForTimes() and seek() API..
> > Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> > Long> timestampsToSearch) if required.
> > Let's see what others think.
> >
> > Thanks,
> >
> > On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> > wrote:
> > >
> > > Hi Manikumar,
> > > Thanks for the changes. Just minor comment and a question:
> > >
> > > AM5: The description "How to initialize the share-partition start
> > offset:"
> > > for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> > > Should we write the details as defined in KIP-932 i.e.
> > >
> > > How to initialize the share-partition start offset:
> > >
> > > -
> > >
> > > "earliest" : automatically reset the offset to the earliest offset
> > > -
> > >
> > > "latest" : automatically reset the offset to the latest offset
> > > -
> > >
> > > "*earliest_local": *automatically resets the offset to the earliest
> > > message stored in the local log on the broker.
> > > -
> > >
> > > "*by_duration": *automatically resets the offset to the earliest
> > offset
> > > whose timestamp is greater than or equal to the configured duration
> > > * (auto.offset.reset.by.duration).*
> > >
> > >
> > > *or* maybe just replace ":" with "." i.e. "How to initialize the
> > > share-partition start offset." as the details of the new configs are
> > > defined at top in different sections as well.
> > >
> > > AM6: Question: KafkaConsumer has public methods defined to "seek" for
> the
> > > reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > > OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think
> it
> > > would be sensible to add additional KafkaConsumer APIs for newly
> > introduced
> > > strategies?
> > >
> > > Regards,
> > > Apoorv Mittal
> > >
> > >
> > > On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> > wrote:
> > >
> > > > Hi Matthias,
> > > >
> > > > Thanks for the review.
> > > >
> > > > MS1: looks like KIP-842 is stuck in the voting. Current changes
> should
> > > > fit into KIP-842 (few updates definitely required) as KIP-842 is
> > > > proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > > > and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > > > after completing this KIP.
> > > >
> > > > MS2: Added support for earliest-local config to reset to oldest local
> > > > offset and changes to kafka-consumer-group cmd.
> > > >
> > > > MS3: Based on suggestions, I have updated the config option to
> support
> > > > ISO format.
> > > >
> > > > MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > > definitely need your help on refining the API/solution for KS :)
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> > wrote:
> > > > >
> > > > > Thanks for the KIP.
> > > > >
> > > > > A somewhat orthogonal question I have is, if we should try to merge
> > this
> > > > > KIP with the existing KIP-842:
> > > > >
> > > >
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > > >
> > > > > While KIP-842 has a different intention, ie, separating the case of
> > "no
> > > > > offset during initial startup" vs "offset out of bounds during
> > > > > processing", it might still be worth it? My motivation for this
> > question
> > > > > is, that `auto.offset.reset` is one of the most central configs we
> > have,
> > > > > and thus, doing a single larger change (ie, both KIPs together)
> > might be
> > > > > better (less noise) than doing two independent changes? Thoughts? I
> > know
> > > > > it might be a little bit of a stretch, but asking cannot hurt :)
> > > > >
> > > > >
> > > > > About the KIP itself, did we consider to add something like
> > > > > "latest-local" to say reset to oldest local, but not fetch from
> > tiered
> > > > > storage?
> > > > >
> > > > > For the format of the config, did we consider what we do in
> > > > > `bin/kafka-consumer-group.sh`? It has multiple different options
> like
> > > > >
> > > > > --by-duration <duration: format `PnDTnHnMnS`>
> > > > > --shift-by <number-of-records>
> > > > >
> > > > > --to-datetime <fixed point in time: format
> > `YYYY-MM-DDTHH:mm:SS.sss`>
> > > > > --to-offset <absolute offset>
> > > > >
> > > > > As it also uses ISO format, it might be good to also use them (even
> > if I
> > > > > can see the appeal and simplicity of what you proposed).
> > > > >
> > > > >
> > > > > I also want to add to (AM1), as there is also
> > `Topology.AutoOffsetReset`
> > > > > enum in Kafka Streams. I think we would need to convert this into a
> > > > > class. While it could be done is a follow up KIP, too, it seems
> best
> > to
> > > > > do this holistically in a single KIP, because KS is not something
> > on-top
> > > > > of Kafka, but it's part of Kafka. I am happy to help with the
> design
> > and
> > > > > even PRs if necessary, but would strongly prefer to do it all in a
> > > > > single KIP.
> > > > >
> > > > >
> > > > > Btw: if we add something like "latest-local", it might also be good
> > to
> > > > > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> > works
> > > > > slightly different, as it does commit an offset and there could be
> > some
> > > > > race condition between committing "latest-local", tiering, and when
> > the
> > > > > consumer is actually started?
> > > > >
> > > > >
> > > > > -Matthias
> > > > >
> > > > >
> > > > > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > > > Hi Manikumar,
> > > > > > Thanks for the KIP, this new strategy would be helpful in
> > specifying
> > > > fetch
> > > > > > behaviour.
> > > > > >
> > > > > > AM1: The config `auto.offset.reset` is currently applied as per
> the
> > > > enum
> > > > > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > > > > <
> > > >
> > https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html
> >.
> > > > > > Are we also proposing to somehow add new definitions in the same
> > class?
> > > > > > However as new configurations will be a string representation
> hence
> > > > are we
> > > > > > moving away from OffsetResetStartegy enum class altogether?
> Should
> > we
> > > > > > include the change in the KIP as OffsetResetStarategy is part of
> > public
> > > > > > javadoc?
> > > > > >
> > > > > > AM2: While I can see the ISO-8601 format is in the rejected
> > > > alternative,
> > > > > > should we not follow some standard of defining duration which has
> > > > already
> > > > > > been adopted in other systems?
> > > > > >
> > > > > > AM3: We've introduced new config values using the format
> > minus-n-hours,
> > > > > > minus-n-days, minus-n-months, and minus-n-years. Should we
> > explicitly
> > > > > > define the "minus" prefix, or is it implied?
> > > > > >
> > > > > > AM4: When supporting duration-based resets, should we also allow
> > users
> > > > to
> > > > > > specify a specific checkpoint time? For example, if a checkpoint
> > > > occurs 2
> > > > > > days, 5 hours and 30 minutes earlier, the current four formats
> > > > > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years)
> might
> > not
> > > > be
> > > > > > sufficient. Should we consider adding a format to accommodate
> > specific
> > > > > > checkpoint times, or is there a reason to limit the supported
> > formats?
> > > > > >
> > > > > >
> > > > > > Regards,
> > > > > > Apoorv Mittal
> > > > > >
> > > > > >
> > > > > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> > manikumar.reddy@gmail.com>
> > > > wrote:
> > > > > >
> > > > > >> Hi everyone,
> > > > > >> I would like to start a discussion on KIP-1106:
> > > > > >>
> > > > > >>
> > > >
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > > > >>
> > > > > >> This KIP proposes to add an additional auto offset reset
> strategy
> > for
> > > > > >> consumer clients.
> > > > > >>
> > > > > >> Regards,
> > > > > >> Manikumar
> > > > > >>
> > > > > >
> > > >
> >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Apoorv Mittal <ap...@gmail.com>.
Thanks Manikumar and Andrew.
For AM6: Though I was thinking of enhancing OffsetFetcher and adding
"seekToLocalBeginning" where OffsetFetcher does use Admin.listOffsets API
itself. However I agree that this is just another convenient way and not
necessary to support functionality. Skipping it sounds good to me.
Regards,
Apoorv Mittal
On Wed, Nov 6, 2024 at 9:12 AM Andrew Schofield <
andrew_schofield_jira@outlook.com> wrote:
> Hi Manikumar,
>
> AS7: In response to AM6, I agree that in general the combination
> of offsetsForTimes() and seek() will do what is required. The one case that
> I think is more tricky is seeking to the local earliest/beginning.
>
> The Consumer API has Consumer.beginningOffsets and
> seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
> Similarly there are methods for OffsetResetStrategy.LATEST.
>
> With the Consumer API, I don't think you can find the local earliest
> offset.
> That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
> We could add equivalents of Consumer.beginningOffsets and
> Consumer.seekToBeginning. An application could always use the
> Admin API with the Consumer API.
>
> Personally, I would not complicate this KIP with these new methods when
> the focus is more on duration-based offset reset and configs.
>
> Thanks,
> Andrew
> ________________________________________
> From: Manikumar <ma...@gmail.com>
> Sent: 06 November 2024 04:20
> To: dev@kafka.apache.org <de...@kafka.apache.org>
> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option
> for consumer clients
>
> Hi Apoorv,
>
> Thanks for the review.
>
> AM5: Thanks, Updated the KIP.
>
> AM6: Currently we can achieve this with the combination of
> offsetsForTimes() and seek() API..
> Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
> Long> timestampsToSearch) if required.
> Let's see what others think.
>
> Thanks,
>
> On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com>
> wrote:
> >
> > Hi Manikumar,
> > Thanks for the changes. Just minor comment and a question:
> >
> > AM5: The description "How to initialize the share-partition start
> offset:"
> > for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> > Should we write the details as defined in KIP-932 i.e.
> >
> > How to initialize the share-partition start offset:
> >
> > -
> >
> > "earliest" : automatically reset the offset to the earliest offset
> > -
> >
> > "latest" : automatically reset the offset to the latest offset
> > -
> >
> > "*earliest_local": *automatically resets the offset to the earliest
> > message stored in the local log on the broker.
> > -
> >
> > "*by_duration": *automatically resets the offset to the earliest
> offset
> > whose timestamp is greater than or equal to the configured duration
> > * (auto.offset.reset.by.duration).*
> >
> >
> > *or* maybe just replace ":" with "." i.e. "How to initialize the
> > share-partition start offset." as the details of the new configs are
> > defined at top in different sections as well.
> >
> > AM6: Question: KafkaConsumer has public methods defined to "seek" for the
> > reset strategy like "seekToBeginning" and "seekToEnd" which uses
> > OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think it
> > would be sensible to add additional KafkaConsumer APIs for newly
> introduced
> > strategies?
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com>
> wrote:
> >
> > > Hi Matthias,
> > >
> > > Thanks for the review.
> > >
> > > MS1: looks like KIP-842 is stuck in the voting. Current changes should
> > > fit into KIP-842 (few updates definitely required) as KIP-842 is
> > > proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > > and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > > after completing this KIP.
> > >
> > > MS2: Added support for earliest-local config to reset to oldest local
> > > offset and changes to kafka-consumer-group cmd.
> > >
> > > MS3: Based on suggestions, I have updated the config option to support
> > > ISO format.
> > >
> > > MS4: I have included the AutoOffsetReset changes to the KIP. I
> > > definitely need your help on refining the API/solution for KS :)
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> > >
> > > On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org>
> wrote:
> > > >
> > > > Thanks for the KIP.
> > > >
> > > > A somewhat orthogonal question I have is, if we should try to merge
> this
> > > > KIP with the existing KIP-842:
> > > >
> > >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > > >
> > > > While KIP-842 has a different intention, ie, separating the case of
> "no
> > > > offset during initial startup" vs "offset out of bounds during
> > > > processing", it might still be worth it? My motivation for this
> question
> > > > is, that `auto.offset.reset` is one of the most central configs we
> have,
> > > > and thus, doing a single larger change (ie, both KIPs together)
> might be
> > > > better (less noise) than doing two independent changes? Thoughts? I
> know
> > > > it might be a little bit of a stretch, but asking cannot hurt :)
> > > >
> > > >
> > > > About the KIP itself, did we consider to add something like
> > > > "latest-local" to say reset to oldest local, but not fetch from
> tiered
> > > > storage?
> > > >
> > > > For the format of the config, did we consider what we do in
> > > > `bin/kafka-consumer-group.sh`? It has multiple different options like
> > > >
> > > > --by-duration <duration: format `PnDTnHnMnS`>
> > > > --shift-by <number-of-records>
> > > >
> > > > --to-datetime <fixed point in time: format
> `YYYY-MM-DDTHH:mm:SS.sss`>
> > > > --to-offset <absolute offset>
> > > >
> > > > As it also uses ISO format, it might be good to also use them (even
> if I
> > > > can see the appeal and simplicity of what you proposed).
> > > >
> > > >
> > > > I also want to add to (AM1), as there is also
> `Topology.AutoOffsetReset`
> > > > enum in Kafka Streams. I think we would need to convert this into a
> > > > class. While it could be done is a follow up KIP, too, it seems best
> to
> > > > do this holistically in a single KIP, because KS is not something
> on-top
> > > > of Kafka, but it's part of Kafka. I am happy to help with the design
> and
> > > > even PRs if necessary, but would strongly prefer to do it all in a
> > > > single KIP.
> > > >
> > > >
> > > > Btw: if we add something like "latest-local", it might also be good
> to
> > > > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool
> works
> > > > slightly different, as it does commit an offset and there could be
> some
> > > > race condition between committing "latest-local", tiering, and when
> the
> > > > consumer is actually started?
> > > >
> > > >
> > > > -Matthias
> > > >
> > > >
> > > > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > > Hi Manikumar,
> > > > > Thanks for the KIP, this new strategy would be helpful in
> specifying
> > > fetch
> > > > > behaviour.
> > > > >
> > > > > AM1: The config `auto.offset.reset` is currently applied as per the
> > > enum
> > > > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > > > <
> > >
> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > > > > Are we also proposing to somehow add new definitions in the same
> class?
> > > > > However as new configurations will be a string representation hence
> > > are we
> > > > > moving away from OffsetResetStartegy enum class altogether? Should
> we
> > > > > include the change in the KIP as OffsetResetStarategy is part of
> public
> > > > > javadoc?
> > > > >
> > > > > AM2: While I can see the ISO-8601 format is in the rejected
> > > alternative,
> > > > > should we not follow some standard of defining duration which has
> > > already
> > > > > been adopted in other systems?
> > > > >
> > > > > AM3: We've introduced new config values using the format
> minus-n-hours,
> > > > > minus-n-days, minus-n-months, and minus-n-years. Should we
> explicitly
> > > > > define the "minus" prefix, or is it implied?
> > > > >
> > > > > AM4: When supporting duration-based resets, should we also allow
> users
> > > to
> > > > > specify a specific checkpoint time? For example, if a checkpoint
> > > occurs 2
> > > > > days, 5 hours and 30 minutes earlier, the current four formats
> > > > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might
> not
> > > be
> > > > > sufficient. Should we consider adding a format to accommodate
> specific
> > > > > checkpoint times, or is there a reason to limit the supported
> formats?
> > > > >
> > > > >
> > > > > Regards,
> > > > > Apoorv Mittal
> > > > >
> > > > >
> > > > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <
> manikumar.reddy@gmail.com>
> > > wrote:
> > > > >
> > > > >> Hi everyone,
> > > > >> I would like to start a discussion on KIP-1106:
> > > > >>
> > > > >>
> > >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > > >>
> > > > >> This KIP proposes to add an additional auto offset reset strategy
> for
> > > > >> consumer clients.
> > > > >>
> > > > >> Regards,
> > > > >> Manikumar
> > > > >>
> > > > >
> > >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Andrew Schofield <an...@outlook.com>.
Hi Manikumar,
AS7: In response to AM6, I agree that in general the combination
of offsetsForTimes() and seek() will do what is required. The one case that
I think is more tricky is seeking to the local earliest/beginning.
The Consumer API has Consumer.beginningOffsets and
seekToBeginning, which correspond to OffsetResetStrategy.EARLIEST.
Similarly there are methods for OffsetResetStrategy.LATEST.
With the Consumer API, I don't think you can find the local earliest offset.
That can be found using Admin.listOffsets with OffsetSpec.EarliestLocal.
We could add equivalents of Consumer.beginningOffsets and
Consumer.seekToBeginning. An application could always use the
Admin API with the Consumer API.
Personally, I would not complicate this KIP with these new methods when
the focus is more on duration-based offset reset and configs.
Thanks,
Andrew
________________________________________
From: Manikumar <ma...@gmail.com>
Sent: 06 November 2024 04:20
To: dev@kafka.apache.org <de...@kafka.apache.org>
Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Hi Apoorv,
Thanks for the review.
AM5: Thanks, Updated the KIP.
AM6: Currently we can achieve this with the combination of
offsetsForTimes() and seek() API..
Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
Long> timestampsToSearch) if required.
Let's see what others think.
Thanks,
On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com> wrote:
>
> Hi Manikumar,
> Thanks for the changes. Just minor comment and a question:
>
> AM5: The description "How to initialize the share-partition start offset:"
> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> Should we write the details as defined in KIP-932 i.e.
>
> How to initialize the share-partition start offset:
>
> -
>
> "earliest" : automatically reset the offset to the earliest offset
> -
>
> "latest" : automatically reset the offset to the latest offset
> -
>
> "*earliest_local": *automatically resets the offset to the earliest
> message stored in the local log on the broker.
> -
>
> "*by_duration": *automatically resets the offset to the earliest offset
> whose timestamp is greater than or equal to the configured duration
> * (auto.offset.reset.by.duration).*
>
>
> *or* maybe just replace ":" with "." i.e. "How to initialize the
> share-partition start offset." as the details of the new configs are
> defined at top in different sections as well.
>
> AM6: Question: KafkaConsumer has public methods defined to "seek" for the
> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think it
> would be sensible to add additional KafkaConsumer APIs for newly introduced
> strategies?
>
> Regards,
> Apoorv Mittal
>
>
> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com> wrote:
>
> > Hi Matthias,
> >
> > Thanks for the review.
> >
> > MS1: looks like KIP-842 is stuck in the voting. Current changes should
> > fit into KIP-842 (few updates definitely required) as KIP-842 is
> > proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > after completing this KIP.
> >
> > MS2: Added support for earliest-local config to reset to oldest local
> > offset and changes to kafka-consumer-group cmd.
> >
> > MS3: Based on suggestions, I have updated the config option to support
> > ISO format.
> >
> > MS4: I have included the AutoOffsetReset changes to the KIP. I
> > definitely need your help on refining the API/solution for KS :)
> >
> > Thanks
> >
> >
> >
> >
> >
> > On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org> wrote:
> > >
> > > Thanks for the KIP.
> > >
> > > A somewhat orthogonal question I have is, if we should try to merge this
> > > KIP with the existing KIP-842:
> > >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > >
> > > While KIP-842 has a different intention, ie, separating the case of "no
> > > offset during initial startup" vs "offset out of bounds during
> > > processing", it might still be worth it? My motivation for this question
> > > is, that `auto.offset.reset` is one of the most central configs we have,
> > > and thus, doing a single larger change (ie, both KIPs together) might be
> > > better (less noise) than doing two independent changes? Thoughts? I know
> > > it might be a little bit of a stretch, but asking cannot hurt :)
> > >
> > >
> > > About the KIP itself, did we consider to add something like
> > > "latest-local" to say reset to oldest local, but not fetch from tiered
> > > storage?
> > >
> > > For the format of the config, did we consider what we do in
> > > `bin/kafka-consumer-group.sh`? It has multiple different options like
> > >
> > > --by-duration <duration: format `PnDTnHnMnS`>
> > > --shift-by <number-of-records>
> > >
> > > --to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
> > > --to-offset <absolute offset>
> > >
> > > As it also uses ISO format, it might be good to also use them (even if I
> > > can see the appeal and simplicity of what you proposed).
> > >
> > >
> > > I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
> > > enum in Kafka Streams. I think we would need to convert this into a
> > > class. While it could be done is a follow up KIP, too, it seems best to
> > > do this holistically in a single KIP, because KS is not something on-top
> > > of Kafka, but it's part of Kafka. I am happy to help with the design and
> > > even PRs if necessary, but would strongly prefer to do it all in a
> > > single KIP.
> > >
> > >
> > > Btw: if we add something like "latest-local", it might also be good to
> > > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
> > > slightly different, as it does commit an offset and there could be some
> > > race condition between committing "latest-local", tiering, and when the
> > > consumer is actually started?
> > >
> > >
> > > -Matthias
> > >
> > >
> > > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > Hi Manikumar,
> > > > Thanks for the KIP, this new strategy would be helpful in specifying
> > fetch
> > > > behaviour.
> > > >
> > > > AM1: The config `auto.offset.reset` is currently applied as per the
> > enum
> > > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > > <
> > https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > > > Are we also proposing to somehow add new definitions in the same class?
> > > > However as new configurations will be a string representation hence
> > are we
> > > > moving away from OffsetResetStartegy enum class altogether? Should we
> > > > include the change in the KIP as OffsetResetStarategy is part of public
> > > > javadoc?
> > > >
> > > > AM2: While I can see the ISO-8601 format is in the rejected
> > alternative,
> > > > should we not follow some standard of defining duration which has
> > already
> > > > been adopted in other systems?
> > > >
> > > > AM3: We've introduced new config values using the format minus-n-hours,
> > > > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > > > define the "minus" prefix, or is it implied?
> > > >
> > > > AM4: When supporting duration-based resets, should we also allow users
> > to
> > > > specify a specific checkpoint time? For example, if a checkpoint
> > occurs 2
> > > > days, 5 hours and 30 minutes earlier, the current four formats
> > > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not
> > be
> > > > sufficient. Should we consider adding a format to accommodate specific
> > > > checkpoint times, or is there a reason to limit the supported formats?
> > > >
> > > >
> > > > Regards,
> > > > Apoorv Mittal
> > > >
> > > >
> > > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com>
> > wrote:
> > > >
> > > >> Hi everyone,
> > > >> I would like to start a discussion on KIP-1106:
> > > >>
> > > >>
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > >>
> > > >> This KIP proposes to add an additional auto offset reset strategy for
> > > >> consumer clients.
> > > >>
> > > >> Regards,
> > > >> Manikumar
> > > >>
> > > >
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Apoorv,
Thanks for the review.
AM5: Thanks, Updated the KIP.
AM6: Currently we can achieve this with the combination of
offsetsForTimes() and seek() API..
Maybe we can add a generic API like seekToTimes(Map<TopicPartition,
Long> timestampsToSearch) if required.
Let's see what others think.
Thanks,
On Wed, Nov 6, 2024 at 1:45 AM Apoorv Mittal <ap...@gmail.com> wrote:
>
> Hi Manikumar,
> Thanks for the changes. Just minor comment and a question:
>
> AM5: The description "How to initialize the share-partition start offset:"
> for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
> Should we write the details as defined in KIP-932 i.e.
>
> How to initialize the share-partition start offset:
>
> -
>
> "earliest" : automatically reset the offset to the earliest offset
> -
>
> "latest" : automatically reset the offset to the latest offset
> -
>
> "*earliest_local": *automatically resets the offset to the earliest
> message stored in the local log on the broker.
> -
>
> "*by_duration": *automatically resets the offset to the earliest offset
> whose timestamp is greater than or equal to the configured duration
> * (auto.offset.reset.by.duration).*
>
>
> *or* maybe just replace ":" with "." i.e. "How to initialize the
> share-partition start offset." as the details of the new configs are
> defined at top in different sections as well.
>
> AM6: Question: KafkaConsumer has public methods defined to "seek" for the
> reset strategy like "seekToBeginning" and "seekToEnd" which uses
> OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think it
> would be sensible to add additional KafkaConsumer APIs for newly introduced
> strategies?
>
> Regards,
> Apoorv Mittal
>
>
> On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com> wrote:
>
> > Hi Matthias,
> >
> > Thanks for the review.
> >
> > MS1: looks like KIP-842 is stuck in the voting. Current changes should
> > fit into KIP-842 (few updates definitely required) as KIP-842 is
> > proposing to add new configs (auto.offset.reset.on.no.initial.offset
> > and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> > after completing this KIP.
> >
> > MS2: Added support for earliest-local config to reset to oldest local
> > offset and changes to kafka-consumer-group cmd.
> >
> > MS3: Based on suggestions, I have updated the config option to support
> > ISO format.
> >
> > MS4: I have included the AutoOffsetReset changes to the KIP. I
> > definitely need your help on refining the API/solution for KS :)
> >
> > Thanks
> >
> >
> >
> >
> >
> > On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org> wrote:
> > >
> > > Thanks for the KIP.
> > >
> > > A somewhat orthogonal question I have is, if we should try to merge this
> > > KIP with the existing KIP-842:
> > >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> > >
> > > While KIP-842 has a different intention, ie, separating the case of "no
> > > offset during initial startup" vs "offset out of bounds during
> > > processing", it might still be worth it? My motivation for this question
> > > is, that `auto.offset.reset` is one of the most central configs we have,
> > > and thus, doing a single larger change (ie, both KIPs together) might be
> > > better (less noise) than doing two independent changes? Thoughts? I know
> > > it might be a little bit of a stretch, but asking cannot hurt :)
> > >
> > >
> > > About the KIP itself, did we consider to add something like
> > > "latest-local" to say reset to oldest local, but not fetch from tiered
> > > storage?
> > >
> > > For the format of the config, did we consider what we do in
> > > `bin/kafka-consumer-group.sh`? It has multiple different options like
> > >
> > > --by-duration <duration: format `PnDTnHnMnS`>
> > > --shift-by <number-of-records>
> > >
> > > --to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
> > > --to-offset <absolute offset>
> > >
> > > As it also uses ISO format, it might be good to also use them (even if I
> > > can see the appeal and simplicity of what you proposed).
> > >
> > >
> > > I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
> > > enum in Kafka Streams. I think we would need to convert this into a
> > > class. While it could be done is a follow up KIP, too, it seems best to
> > > do this holistically in a single KIP, because KS is not something on-top
> > > of Kafka, but it's part of Kafka. I am happy to help with the design and
> > > even PRs if necessary, but would strongly prefer to do it all in a
> > > single KIP.
> > >
> > >
> > > Btw: if we add something like "latest-local", it might also be good to
> > > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
> > > slightly different, as it does commit an offset and there could be some
> > > race condition between committing "latest-local", tiering, and when the
> > > consumer is actually started?
> > >
> > >
> > > -Matthias
> > >
> > >
> > > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > > Hi Manikumar,
> > > > Thanks for the KIP, this new strategy would be helpful in specifying
> > fetch
> > > > behaviour.
> > > >
> > > > AM1: The config `auto.offset.reset` is currently applied as per the
> > enum
> > > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > > <
> > https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > > > Are we also proposing to somehow add new definitions in the same class?
> > > > However as new configurations will be a string representation hence
> > are we
> > > > moving away from OffsetResetStartegy enum class altogether? Should we
> > > > include the change in the KIP as OffsetResetStarategy is part of public
> > > > javadoc?
> > > >
> > > > AM2: While I can see the ISO-8601 format is in the rejected
> > alternative,
> > > > should we not follow some standard of defining duration which has
> > already
> > > > been adopted in other systems?
> > > >
> > > > AM3: We've introduced new config values using the format minus-n-hours,
> > > > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > > > define the "minus" prefix, or is it implied?
> > > >
> > > > AM4: When supporting duration-based resets, should we also allow users
> > to
> > > > specify a specific checkpoint time? For example, if a checkpoint
> > occurs 2
> > > > days, 5 hours and 30 minutes earlier, the current four formats
> > > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not
> > be
> > > > sufficient. Should we consider adding a format to accommodate specific
> > > > checkpoint times, or is there a reason to limit the supported formats?
> > > >
> > > >
> > > > Regards,
> > > > Apoorv Mittal
> > > >
> > > >
> > > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com>
> > wrote:
> > > >
> > > >> Hi everyone,
> > > >> I would like to start a discussion on KIP-1106:
> > > >>
> > > >>
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > > >>
> > > >> This KIP proposes to add an additional auto offset reset strategy for
> > > >> consumer clients.
> > > >>
> > > >> Regards,
> > > >> Manikumar
> > > >>
> > > >
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Apoorv Mittal <ap...@gmail.com>.
Hi Manikumar,
Thanks for the changes. Just minor comment and a question:
AM5: The description "How to initialize the share-partition start offset:"
for "*share.auto.offset.reset*" seems incomplete as it ends with `:`.
Should we write the details as defined in KIP-932 i.e.
How to initialize the share-partition start offset:
-
"earliest" : automatically reset the offset to the earliest offset
-
"latest" : automatically reset the offset to the latest offset
-
"*earliest_local": *automatically resets the offset to the earliest
message stored in the local log on the broker.
-
"*by_duration": *automatically resets the offset to the earliest offset
whose timestamp is greater than or equal to the configured duration
* (auto.offset.reset.by.duration).*
*or* maybe just replace ":" with "." i.e. "How to initialize the
share-partition start offset." as the details of the new configs are
defined at top in different sections as well.
AM6: Question: KafkaConsumer has public methods defined to "seek" for the
reset strategy like "seekToBeginning" and "seekToEnd" which uses
OffsetResetStrategy of EARLIEST and LATEST respectively. Do you think it
would be sensible to add additional KafkaConsumer APIs for newly introduced
strategies?
Regards,
Apoorv Mittal
On Tue, Nov 5, 2024 at 6:10 PM Manikumar <ma...@gmail.com> wrote:
> Hi Matthias,
>
> Thanks for the review.
>
> MS1: looks like KIP-842 is stuck in the voting. Current changes should
> fit into KIP-842 (few updates definitely required) as KIP-842 is
> proposing to add new configs (auto.offset.reset.on.no.initial.offset
> and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
> after completing this KIP.
>
> MS2: Added support for earliest-local config to reset to oldest local
> offset and changes to kafka-consumer-group cmd.
>
> MS3: Based on suggestions, I have updated the config option to support
> ISO format.
>
> MS4: I have included the AutoOffsetReset changes to the KIP. I
> definitely need your help on refining the API/solution for KS :)
>
> Thanks
>
>
>
>
>
> On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org> wrote:
> >
> > Thanks for the KIP.
> >
> > A somewhat orthogonal question I have is, if we should try to merge this
> > KIP with the existing KIP-842:
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
> >
> > While KIP-842 has a different intention, ie, separating the case of "no
> > offset during initial startup" vs "offset out of bounds during
> > processing", it might still be worth it? My motivation for this question
> > is, that `auto.offset.reset` is one of the most central configs we have,
> > and thus, doing a single larger change (ie, both KIPs together) might be
> > better (less noise) than doing two independent changes? Thoughts? I know
> > it might be a little bit of a stretch, but asking cannot hurt :)
> >
> >
> > About the KIP itself, did we consider to add something like
> > "latest-local" to say reset to oldest local, but not fetch from tiered
> > storage?
> >
> > For the format of the config, did we consider what we do in
> > `bin/kafka-consumer-group.sh`? It has multiple different options like
> >
> > --by-duration <duration: format `PnDTnHnMnS`>
> > --shift-by <number-of-records>
> >
> > --to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
> > --to-offset <absolute offset>
> >
> > As it also uses ISO format, it might be good to also use them (even if I
> > can see the appeal and simplicity of what you proposed).
> >
> >
> > I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
> > enum in Kafka Streams. I think we would need to convert this into a
> > class. While it could be done is a follow up KIP, too, it seems best to
> > do this holistically in a single KIP, because KS is not something on-top
> > of Kafka, but it's part of Kafka. I am happy to help with the design and
> > even PRs if necessary, but would strongly prefer to do it all in a
> > single KIP.
> >
> >
> > Btw: if we add something like "latest-local", it might also be good to
> > extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
> > slightly different, as it does commit an offset and there could be some
> > race condition between committing "latest-local", tiering, and when the
> > consumer is actually started?
> >
> >
> > -Matthias
> >
> >
> > On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > > Hi Manikumar,
> > > Thanks for the KIP, this new strategy would be helpful in specifying
> fetch
> > > behaviour.
> > >
> > > AM1: The config `auto.offset.reset` is currently applied as per the
> enum
> > > class OffsetResetStarategy which is part of kafka-clients javadoc
> > > <
> https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > > Are we also proposing to somehow add new definitions in the same class?
> > > However as new configurations will be a string representation hence
> are we
> > > moving away from OffsetResetStartegy enum class altogether? Should we
> > > include the change in the KIP as OffsetResetStarategy is part of public
> > > javadoc?
> > >
> > > AM2: While I can see the ISO-8601 format is in the rejected
> alternative,
> > > should we not follow some standard of defining duration which has
> already
> > > been adopted in other systems?
> > >
> > > AM3: We've introduced new config values using the format minus-n-hours,
> > > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > > define the "minus" prefix, or is it implied?
> > >
> > > AM4: When supporting duration-based resets, should we also allow users
> to
> > > specify a specific checkpoint time? For example, if a checkpoint
> occurs 2
> > > days, 5 hours and 30 minutes earlier, the current four formats
> > > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not
> be
> > > sufficient. Should we consider adding a format to accommodate specific
> > > checkpoint times, or is there a reason to limit the supported formats?
> > >
> > >
> > > Regards,
> > > Apoorv Mittal
> > >
> > >
> > > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com>
> wrote:
> > >
> > >> Hi everyone,
> > >> I would like to start a discussion on KIP-1106:
> > >>
> > >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > >>
> > >> This KIP proposes to add an additional auto offset reset strategy for
> > >> consumer clients.
> > >>
> > >> Regards,
> > >> Manikumar
> > >>
> > >
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Matthias,
Thanks for the review.
MS1: looks like KIP-842 is stuck in the voting. Current changes should
fit into KIP-842 (few updates definitely required) as KIP-842 is
proposing to add new configs (auto.offset.reset.on.no.initial.offset
and auto.offset.reset.on.invalid.offset). I prefer to revive KIP-842
after completing this KIP.
MS2: Added support for earliest-local config to reset to oldest local
offset and changes to kafka-consumer-group cmd.
MS3: Based on suggestions, I have updated the config option to support
ISO format.
MS4: I have included the AutoOffsetReset changes to the KIP. I
definitely need your help on refining the API/solution for KS :)
Thanks
On Tue, Nov 5, 2024 at 7:26 AM Matthias J. Sax <mj...@apache.org> wrote:
>
> Thanks for the KIP.
>
> A somewhat orthogonal question I have is, if we should try to merge this
> KIP with the existing KIP-842:
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
>
> While KIP-842 has a different intention, ie, separating the case of "no
> offset during initial startup" vs "offset out of bounds during
> processing", it might still be worth it? My motivation for this question
> is, that `auto.offset.reset` is one of the most central configs we have,
> and thus, doing a single larger change (ie, both KIPs together) might be
> better (less noise) than doing two independent changes? Thoughts? I know
> it might be a little bit of a stretch, but asking cannot hurt :)
>
>
> About the KIP itself, did we consider to add something like
> "latest-local" to say reset to oldest local, but not fetch from tiered
> storage?
>
> For the format of the config, did we consider what we do in
> `bin/kafka-consumer-group.sh`? It has multiple different options like
>
> --by-duration <duration: format `PnDTnHnMnS`>
> --shift-by <number-of-records>
>
> --to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
> --to-offset <absolute offset>
>
> As it also uses ISO format, it might be good to also use them (even if I
> can see the appeal and simplicity of what you proposed).
>
>
> I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
> enum in Kafka Streams. I think we would need to convert this into a
> class. While it could be done is a follow up KIP, too, it seems best to
> do this holistically in a single KIP, because KS is not something on-top
> of Kafka, but it's part of Kafka. I am happy to help with the design and
> even PRs if necessary, but would strongly prefer to do it all in a
> single KIP.
>
>
> Btw: if we add something like "latest-local", it might also be good to
> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
> slightly different, as it does commit an offset and there could be some
> race condition between committing "latest-local", tiering, and when the
> consumer is actually started?
>
>
> -Matthias
>
>
> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > Hi Manikumar,
> > Thanks for the KIP, this new strategy would be helpful in specifying fetch
> > behaviour.
> >
> > AM1: The config `auto.offset.reset` is currently applied as per the enum
> > class OffsetResetStarategy which is part of kafka-clients javadoc
> > <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > Are we also proposing to somehow add new definitions in the same class?
> > However as new configurations will be a string representation hence are we
> > moving away from OffsetResetStartegy enum class altogether? Should we
> > include the change in the KIP as OffsetResetStarategy is part of public
> > javadoc?
> >
> > AM2: While I can see the ISO-8601 format is in the rejected alternative,
> > should we not follow some standard of defining duration which has already
> > been adopted in other systems?
> >
> > AM3: We've introduced new config values using the format minus-n-hours,
> > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > define the "minus" prefix, or is it implied?
> >
> > AM4: When supporting duration-based resets, should we also allow users to
> > specify a specific checkpoint time? For example, if a checkpoint occurs 2
> > days, 5 hours and 30 minutes earlier, the current four formats
> > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> > sufficient. Should we consider adding a format to accommodate specific
> > checkpoint times, or is there a reason to limit the supported formats?
> >
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
> >
> >> Hi everyone,
> >> I would like to start a discussion on KIP-1106:
> >>
> >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >>
> >> This KIP proposes to add an additional auto offset reset strategy for
> >> consumer clients.
> >>
> >> Regards,
> >> Manikumar
> >>
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi All,
Thanks for the inputs. I have updated the KIP based on the discussion so far.
Few of the changes:
1. I have updated the KIP to use ISO-8601 format for defining duration.
2. Add support for the earliest-local option, which will reset to
local-log-start-offset.
2. Changes to ConsumerGroupCommand to support reset to earliest-local
3. Add new config option support to Kafka Streams
I have adopted the changes suggested by Andrew to add a new config to
set the duration (auto.offset.reset.by.duration).
Let me know your thoughts.
Thanks
On Tue, Nov 5, 2024 at 7:30 PM Andrew Schofield
<an...@outlook.com> wrote:
>
> Hi Manikumar,
> Thanks for the KIP.
>
> AS1: As Apoorv points out, the values of auto.offset.reset correspond to the enum
> OffsetResetStrategy. I would say that's a useful thing to maintain and I suggest
> adding a fourth value "by.duration" (BY_DURATION), and then another configuration
> for the duration "auto.offset.reset.by.duration". This would correspond with
> kafka-consumer-groups.sh --reset-offsets --by-duration.
>
> I don't think that --reset-offsets --shift-by or --to-datetime really work as well
> for a config-based solution, and are much easier for interactive use with
> kafka-consumer-groups.sh.
>
> AS2: Typically, durations in client configs are specified as milliseconds,
> but this is unlikely to be that useable in this case where I expect the time period
> is more likely in the scale of hours or days. So, I'd like to reject your suggestion
> of a rejected alternative for ISO-8601. How about this?
>
> "auto.offset.reset.by.duration=P1D" is 1 day.
> "auto.offset.reset.by.duration=PT3H" is 3 hours.
> "auto.offset.reset.by.duration=PT1M" is 1 minute.
>
> Not that hard. The validation for this config could parse it into a Duration
> to make sure it is well formed.
>
> AS3: I like Matthias's suggestion about "latest-local". That seems very sensible
> in the context of tiered storage.
>
> Thanks,
> Andrew
> ________________________________________
> From: Matthias J. Sax <mj...@apache.org>
> Sent: 05 November 2024 01:55
> To: dev@kafka.apache.org <de...@kafka.apache.org>
> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
>
> Thanks for the KIP.
>
> A somewhat orthogonal question I have is, if we should try to merge this
> KIP with the existing KIP-842:
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
>
> While KIP-842 has a different intention, ie, separating the case of "no
> offset during initial startup" vs "offset out of bounds during
> processing", it might still be worth it? My motivation for this question
> is, that `auto.offset.reset` is one of the most central configs we have,
> and thus, doing a single larger change (ie, both KIPs together) might be
> better (less noise) than doing two independent changes? Thoughts? I know
> it might be a little bit of a stretch, but asking cannot hurt :)
>
>
> About the KIP itself, did we consider to add something like
> "latest-local" to say reset to oldest local, but not fetch from tiered
> storage?
>
> For the format of the config, did we consider what we do in
> `bin/kafka-consumer-group.sh`? It has multiple different options like
>
> --by-duration <duration: format `PnDTnHnMnS`>
> --shift-by <number-of-records>
>
> --to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
> --to-offset <absolute offset>
>
> As it also uses ISO format, it might be good to also use them (even if I
> can see the appeal and simplicity of what you proposed).
>
>
> I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
> enum in Kafka Streams. I think we would need to convert this into a
> class. While it could be done is a follow up KIP, too, it seems best to
> do this holistically in a single KIP, because KS is not something on-top
> of Kafka, but it's part of Kafka. I am happy to help with the design and
> even PRs if necessary, but would strongly prefer to do it all in a
> single KIP.
>
>
> Btw: if we add something like "latest-local", it might also be good to
> extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
> slightly different, as it does commit an offset and there could be some
> race condition between committing "latest-local", tiering, and when the
> consumer is actually started?
>
>
> -Matthias
>
>
> On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> > Hi Manikumar,
> > Thanks for the KIP, this new strategy would be helpful in specifying fetch
> > behaviour.
> >
> > AM1: The config `auto.offset.reset` is currently applied as per the enum
> > class OffsetResetStarategy which is part of kafka-clients javadoc
> > <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > Are we also proposing to somehow add new definitions in the same class?
> > However as new configurations will be a string representation hence are we
> > moving away from OffsetResetStartegy enum class altogether? Should we
> > include the change in the KIP as OffsetResetStarategy is part of public
> > javadoc?
> >
> > AM2: While I can see the ISO-8601 format is in the rejected alternative,
> > should we not follow some standard of defining duration which has already
> > been adopted in other systems?
> >
> > AM3: We've introduced new config values using the format minus-n-hours,
> > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > define the "minus" prefix, or is it implied?
> >
> > AM4: When supporting duration-based resets, should we also allow users to
> > specify a specific checkpoint time? For example, if a checkpoint occurs 2
> > days, 5 hours and 30 minutes earlier, the current four formats
> > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> > sufficient. Should we consider adding a format to accommodate specific
> > checkpoint times, or is there a reason to limit the supported formats?
> >
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
> >
> >> Hi everyone,
> >> I would like to start a discussion on KIP-1106:
> >>
> >> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >>
> >> This KIP proposes to add an additional auto offset reset strategy for
> >> consumer clients.
> >>
> >> Regards,
> >> Manikumar
> >>
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Andrew Schofield <an...@outlook.com>.
Hi Manikumar,
Thanks for the KIP.
AS1: As Apoorv points out, the values of auto.offset.reset correspond to the enum
OffsetResetStrategy. I would say that's a useful thing to maintain and I suggest
adding a fourth value "by.duration" (BY_DURATION), and then another configuration
for the duration "auto.offset.reset.by.duration". This would correspond with
kafka-consumer-groups.sh --reset-offsets --by-duration.
I don't think that --reset-offsets --shift-by or --to-datetime really work as well
for a config-based solution, and are much easier for interactive use with
kafka-consumer-groups.sh.
AS2: Typically, durations in client configs are specified as milliseconds,
but this is unlikely to be that useable in this case where I expect the time period
is more likely in the scale of hours or days. So, I'd like to reject your suggestion
of a rejected alternative for ISO-8601. How about this?
"auto.offset.reset.by.duration=P1D" is 1 day.
"auto.offset.reset.by.duration=PT3H" is 3 hours.
"auto.offset.reset.by.duration=PT1M" is 1 minute.
Not that hard. The validation for this config could parse it into a Duration
to make sure it is well formed.
AS3: I like Matthias's suggestion about "latest-local". That seems very sensible
in the context of tiered storage.
Thanks,
Andrew
________________________________________
From: Matthias J. Sax <mj...@apache.org>
Sent: 05 November 2024 01:55
To: dev@kafka.apache.org <de...@kafka.apache.org>
Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Thanks for the KIP.
A somewhat orthogonal question I have is, if we should try to merge this
KIP with the existing KIP-842:
https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
While KIP-842 has a different intention, ie, separating the case of "no
offset during initial startup" vs "offset out of bounds during
processing", it might still be worth it? My motivation for this question
is, that `auto.offset.reset` is one of the most central configs we have,
and thus, doing a single larger change (ie, both KIPs together) might be
better (less noise) than doing two independent changes? Thoughts? I know
it might be a little bit of a stretch, but asking cannot hurt :)
About the KIP itself, did we consider to add something like
"latest-local" to say reset to oldest local, but not fetch from tiered
storage?
For the format of the config, did we consider what we do in
`bin/kafka-consumer-group.sh`? It has multiple different options like
--by-duration <duration: format `PnDTnHnMnS`>
--shift-by <number-of-records>
--to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
--to-offset <absolute offset>
As it also uses ISO format, it might be good to also use them (even if I
can see the appeal and simplicity of what you proposed).
I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
enum in Kafka Streams. I think we would need to convert this into a
class. While it could be done is a follow up KIP, too, it seems best to
do this holistically in a single KIP, because KS is not something on-top
of Kafka, but it's part of Kafka. I am happy to help with the design and
even PRs if necessary, but would strongly prefer to do it all in a
single KIP.
Btw: if we add something like "latest-local", it might also be good to
extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
slightly different, as it does commit an offset and there could be some
race condition between committing "latest-local", tiering, and when the
consumer is actually started?
-Matthias
On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> Hi Manikumar,
> Thanks for the KIP, this new strategy would be helpful in specifying fetch
> behaviour.
>
> AM1: The config `auto.offset.reset` is currently applied as per the enum
> class OffsetResetStarategy which is part of kafka-clients javadoc
> <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> Are we also proposing to somehow add new definitions in the same class?
> However as new configurations will be a string representation hence are we
> moving away from OffsetResetStartegy enum class altogether? Should we
> include the change in the KIP as OffsetResetStarategy is part of public
> javadoc?
>
> AM2: While I can see the ISO-8601 format is in the rejected alternative,
> should we not follow some standard of defining duration which has already
> been adopted in other systems?
>
> AM3: We've introduced new config values using the format minus-n-hours,
> minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> define the "minus" prefix, or is it implied?
>
> AM4: When supporting duration-based resets, should we also allow users to
> specify a specific checkpoint time? For example, if a checkpoint occurs 2
> days, 5 hours and 30 minutes earlier, the current four formats
> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> sufficient. Should we consider adding a format to accommodate specific
> checkpoint times, or is there a reason to limit the supported formats?
>
>
> Regards,
> Apoorv Mittal
>
>
> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
>
>> Hi everyone,
>> I would like to start a discussion on KIP-1106:
>>
>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>>
>> This KIP proposes to add an additional auto offset reset strategy for
>> consumer clients.
>>
>> Regards,
>> Manikumar
>>
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by "Matthias J. Sax" <mj...@apache.org>.
Thanks for the KIP.
A somewhat orthogonal question I have is, if we should try to merge this
KIP with the existing KIP-842:
https://cwiki.apache.org/confluence/display/KAFKA/KIP-842%3A+Add+richer+group+offset+reset+mechanisms
While KIP-842 has a different intention, ie, separating the case of "no
offset during initial startup" vs "offset out of bounds during
processing", it might still be worth it? My motivation for this question
is, that `auto.offset.reset` is one of the most central configs we have,
and thus, doing a single larger change (ie, both KIPs together) might be
better (less noise) than doing two independent changes? Thoughts? I know
it might be a little bit of a stretch, but asking cannot hurt :)
About the KIP itself, did we consider to add something like
"latest-local" to say reset to oldest local, but not fetch from tiered
storage?
For the format of the config, did we consider what we do in
`bin/kafka-consumer-group.sh`? It has multiple different options like
--by-duration <duration: format `PnDTnHnMnS`>
--shift-by <number-of-records>
--to-datetime <fixed point in time: format `YYYY-MM-DDTHH:mm:SS.sss`>
--to-offset <absolute offset>
As it also uses ISO format, it might be good to also use them (even if I
can see the appeal and simplicity of what you proposed).
I also want to add to (AM1), as there is also `Topology.AutoOffsetReset`
enum in Kafka Streams. I think we would need to convert this into a
class. While it could be done is a follow up KIP, too, it seems best to
do this holistically in a single KIP, because KS is not something on-top
of Kafka, but it's part of Kafka. I am happy to help with the design and
even PRs if necessary, but would strongly prefer to do it all in a
single KIP.
Btw: if we add something like "latest-local", it might also be good to
extend `bin/kafka-consumer-group.sh` accordingly (even if the tool works
slightly different, as it does commit an offset and there could be some
race condition between committing "latest-local", tiering, and when the
consumer is actually started?
-Matthias
On 11/4/24 7:38 AM, Apoorv Mittal wrote:
> Hi Manikumar,
> Thanks for the KIP, this new strategy would be helpful in specifying fetch
> behaviour.
>
> AM1: The config `auto.offset.reset` is currently applied as per the enum
> class OffsetResetStarategy which is part of kafka-clients javadoc
> <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> Are we also proposing to somehow add new definitions in the same class?
> However as new configurations will be a string representation hence are we
> moving away from OffsetResetStartegy enum class altogether? Should we
> include the change in the KIP as OffsetResetStarategy is part of public
> javadoc?
>
> AM2: While I can see the ISO-8601 format is in the rejected alternative,
> should we not follow some standard of defining duration which has already
> been adopted in other systems?
>
> AM3: We've introduced new config values using the format minus-n-hours,
> minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> define the "minus" prefix, or is it implied?
>
> AM4: When supporting duration-based resets, should we also allow users to
> specify a specific checkpoint time? For example, if a checkpoint occurs 2
> days, 5 hours and 30 minutes earlier, the current four formats
> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> sufficient. Should we consider adding a format to accommodate specific
> checkpoint times, or is there a reason to limit the supported formats?
>
>
> Regards,
> Apoorv Mittal
>
>
> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
>
>> Hi everyone,
>> I would like to start a discussion on KIP-1106:
>>
>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>>
>> This KIP proposes to add an additional auto offset reset strategy for
>> consumer clients.
>>
>> Regards,
>> Manikumar
>>
>
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Andrew,
Thanks for the review.
AS4, AS5: Updated the KIP.
AS6: Yes, it applies to both. updated the KIP.
Thanks,
On Tue, Nov 5, 2024 at 10:58 PM Andrew Schofield
<an...@outlook.com> wrote:
>
> Hi Manikumar,
> Thanks for the updates. A couple of other comments.
>
> AS4: I think the AK conventions would mean the config option should be
> "earliest_local" and "by_duration", and the enum constants should be
> "EARLIEST_LOCAL" and "BY_DURATION".
>
> AS5: The example P12M is invalid. PT12M (12 minutes) is valid.
>
> AS6: Does the daylight saving comment only apply to share groups?
> If we need to say it (not sure whether we do), it needs to apply to both
> consumer groups and share groups.
>
> Thanks,
> Andrew
>
> ________________________________________
> From: Manikumar <ma...@gmail.com>
> Sent: 05 November 2024 17:09
> To: dev@kafka.apache.org <de...@kafka.apache.org>
> Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
>
> Hi Apoorv,
>
> Thanks for the review.
>
> AM1, AM3: Yes, I agree. I have added OffsetResetStarategy class changes to KIP
>
> AM2: Yes, I agree. I have updated the KIP to use ISO format
>
> AM4: With ISO format, it's more flexible now. If required, we can
> easily add support for reset to a particular datetime( similar
> consumer group command).
>
>
> Thanks,
>
>
> On Mon, Nov 4, 2024 at 9:11 PM Apoorv Mittal <ap...@gmail.com> wrote:
> >
> > Hi Manikumar,
> > Thanks for the KIP, this new strategy would be helpful in specifying fetch
> > behaviour.
> >
> > AM1: The config `auto.offset.reset` is currently applied as per the enum
> > class OffsetResetStarategy which is part of kafka-clients javadoc
> > <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> > Are we also proposing to somehow add new definitions in the same class?
> > However as new configurations will be a string representation hence are we
> > moving away from OffsetResetStartegy enum class altogether? Should we
> > include the change in the KIP as OffsetResetStarategy is part of public
> > javadoc?
> >
> > AM2: While I can see the ISO-8601 format is in the rejected alternative,
> > should we not follow some standard of defining duration which has already
> > been adopted in other systems?
> >
> > AM3: We've introduced new config values using the format minus-n-hours,
> > minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> > define the "minus" prefix, or is it implied?
> >
> > AM4: When supporting duration-based resets, should we also allow users to
> > specify a specific checkpoint time? For example, if a checkpoint occurs 2
> > days, 5 hours and 30 minutes earlier, the current four formats
> > (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> > sufficient. Should we consider adding a format to accommodate specific
> > checkpoint times, or is there a reason to limit the supported formats?
> >
> >
> > Regards,
> > Apoorv Mittal
> >
> >
> > On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
> >
> > > Hi everyone,
> > > I would like to start a discussion on KIP-1106:
> > >
> > > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> > >
> > > This KIP proposes to add an additional auto offset reset strategy for
> > > consumer clients.
> > >
> > > Regards,
> > > Manikumar
> > >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Andrew Schofield <an...@outlook.com>.
Hi Manikumar,
Thanks for the updates. A couple of other comments.
AS4: I think the AK conventions would mean the config option should be
"earliest_local" and "by_duration", and the enum constants should be
"EARLIEST_LOCAL" and "BY_DURATION".
AS5: The example P12M is invalid. PT12M (12 minutes) is valid.
AS6: Does the daylight saving comment only apply to share groups?
If we need to say it (not sure whether we do), it needs to apply to both
consumer groups and share groups.
Thanks,
Andrew
________________________________________
From: Manikumar <ma...@gmail.com>
Sent: 05 November 2024 17:09
To: dev@kafka.apache.org <de...@kafka.apache.org>
Subject: Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Hi Apoorv,
Thanks for the review.
AM1, AM3: Yes, I agree. I have added OffsetResetStarategy class changes to KIP
AM2: Yes, I agree. I have updated the KIP to use ISO format
AM4: With ISO format, it's more flexible now. If required, we can
easily add support for reset to a particular datetime( similar
consumer group command).
Thanks,
On Mon, Nov 4, 2024 at 9:11 PM Apoorv Mittal <ap...@gmail.com> wrote:
>
> Hi Manikumar,
> Thanks for the KIP, this new strategy would be helpful in specifying fetch
> behaviour.
>
> AM1: The config `auto.offset.reset` is currently applied as per the enum
> class OffsetResetStarategy which is part of kafka-clients javadoc
> <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> Are we also proposing to somehow add new definitions in the same class?
> However as new configurations will be a string representation hence are we
> moving away from OffsetResetStartegy enum class altogether? Should we
> include the change in the KIP as OffsetResetStarategy is part of public
> javadoc?
>
> AM2: While I can see the ISO-8601 format is in the rejected alternative,
> should we not follow some standard of defining duration which has already
> been adopted in other systems?
>
> AM3: We've introduced new config values using the format minus-n-hours,
> minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> define the "minus" prefix, or is it implied?
>
> AM4: When supporting duration-based resets, should we also allow users to
> specify a specific checkpoint time? For example, if a checkpoint occurs 2
> days, 5 hours and 30 minutes earlier, the current four formats
> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> sufficient. Should we consider adding a format to accommodate specific
> checkpoint times, or is there a reason to limit the supported formats?
>
>
> Regards,
> Apoorv Mittal
>
>
> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
>
> > Hi everyone,
> > I would like to start a discussion on KIP-1106:
> >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >
> > This KIP proposes to add an additional auto offset reset strategy for
> > consumer clients.
> >
> > Regards,
> > Manikumar
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Manikumar <ma...@gmail.com>.
Hi Apoorv,
Thanks for the review.
AM1, AM3: Yes, I agree. I have added OffsetResetStarategy class changes to KIP
AM2: Yes, I agree. I have updated the KIP to use ISO format
AM4: With ISO format, it's more flexible now. If required, we can
easily add support for reset to a particular datetime( similar
consumer group command).
Thanks,
On Mon, Nov 4, 2024 at 9:11 PM Apoorv Mittal <ap...@gmail.com> wrote:
>
> Hi Manikumar,
> Thanks for the KIP, this new strategy would be helpful in specifying fetch
> behaviour.
>
> AM1: The config `auto.offset.reset` is currently applied as per the enum
> class OffsetResetStarategy which is part of kafka-clients javadoc
> <https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
> Are we also proposing to somehow add new definitions in the same class?
> However as new configurations will be a string representation hence are we
> moving away from OffsetResetStartegy enum class altogether? Should we
> include the change in the KIP as OffsetResetStarategy is part of public
> javadoc?
>
> AM2: While I can see the ISO-8601 format is in the rejected alternative,
> should we not follow some standard of defining duration which has already
> been adopted in other systems?
>
> AM3: We've introduced new config values using the format minus-n-hours,
> minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
> define the "minus" prefix, or is it implied?
>
> AM4: When supporting duration-based resets, should we also allow users to
> specify a specific checkpoint time? For example, if a checkpoint occurs 2
> days, 5 hours and 30 minutes earlier, the current four formats
> (minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
> sufficient. Should we consider adding a format to accommodate specific
> checkpoint times, or is there a reason to limit the supported formats?
>
>
> Regards,
> Apoorv Mittal
>
>
> On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
>
> > Hi everyone,
> > I would like to start a discussion on KIP-1106:
> >
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
> >
> > This KIP proposes to add an additional auto offset reset strategy for
> > consumer clients.
> >
> > Regards,
> > Manikumar
> >
Re: [DISCUSS] KIP-1106: Add duration based offset reset option for consumer clients
Posted by Apoorv Mittal <ap...@gmail.com>.
Hi Manikumar,
Thanks for the KIP, this new strategy would be helpful in specifying fetch
behaviour.
AM1: The config `auto.offset.reset` is currently applied as per the enum
class OffsetResetStarategy which is part of kafka-clients javadoc
<https://javadoc.io/doc/org.apache.kafka/kafka-clients/latest/index.html>.
Are we also proposing to somehow add new definitions in the same class?
However as new configurations will be a string representation hence are we
moving away from OffsetResetStartegy enum class altogether? Should we
include the change in the KIP as OffsetResetStarategy is part of public
javadoc?
AM2: While I can see the ISO-8601 format is in the rejected alternative,
should we not follow some standard of defining duration which has already
been adopted in other systems?
AM3: We've introduced new config values using the format minus-n-hours,
minus-n-days, minus-n-months, and minus-n-years. Should we explicitly
define the "minus" prefix, or is it implied?
AM4: When supporting duration-based resets, should we also allow users to
specify a specific checkpoint time? For example, if a checkpoint occurs 2
days, 5 hours and 30 minutes earlier, the current four formats
(minus-n-hours, minus-n-days, minus-n-months, minus-n-years) might not be
sufficient. Should we consider adding a format to accommodate specific
checkpoint times, or is there a reason to limit the supported formats?
Regards,
Apoorv Mittal
On Mon, Nov 4, 2024 at 9:23 AM Manikumar <ma...@gmail.com> wrote:
> Hi everyone,
> I would like to start a discussion on KIP-1106:
>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1106%3A+Add+duration+based+offset+reset+option+for+consumer+clients
>
> This KIP proposes to add an additional auto offset reset strategy for
> consumer clients.
>
> Regards,
> Manikumar
>