You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Sarang Deshpande <sa...@gmail.com> on 2015/03/30 23:35:19 UTC

[Kafka Spout] - EarliestTime vs. forceFromStart

Hello storm users,
There are two variables in the Kafka spout config, startOffsetTime and
forceFromStart. If I set these as follows -

config.forceFromStart = *false*;
config.startOffsetTime = OffsetRequest.EarliestTime();

Kafka spout reads only the newly published messages (from latest offset)
and DOES NOT read from start as one would expect. Only when config is set
as follows, Kafka spout reads from the beginning.

config.forceFromStart = *true*;
config.startOffsetTime = OffsetRequest.EarliestTime();

Can someone explain what is the logical difference between forceFromStart
and startOffsetTime being EarliestTime?

Thanks much
~Sarang

PS: Note that on the other hand, if forceFromStart is true and
startOffsetTime is LatestTime(), that is if they contradict with each
other, then spout reads only newly published messages.

Re: [Kafka Spout] - EarliestTime vs. forceFromStart

Posted by Andrew Neilson <ar...@gmail.com>.
Not exactly.. forceFromStart=true will tell the spout to start reading from
whatever is set in startOffsetTime (available options are the earliest
offset or the latest offset). If forceFromStart=false then startOffsetTime
is not used at all and the offset is just retrieved from zookeeper, if it's
available.

The "Start" in "forceFromStart" has nothing to do with consuming from the
beginning of the topic. I interpret it as referring to whether you are
going to force starting consumption from a different offset.

I really suggest looking at the code too. Here's an example of how these
values are used:
https://github.com/apache/storm/blob/0eb5f30e95f29a02d88935850527ddb3bd23237b/external/storm-kafka/src/jvm/storm/kafka/PartitionManager.java#L94

On Tue, Mar 31, 2015 at 9:34 AM Sarang Deshpande <sa...@gmail.com>
wrote:

> Thanks everyone for the response. To summarize, config.forceFromStart
> lets kafka spout start consuming from the topic's beginning  (the earliest
> offset available for consumption) and config.startOffsetTime =earliestTime()
> is the offset where spout left off consuming last time.
>
> On Mon, Mar 30, 2015 at 3:03 PM, P. Taylor Goetz <pt...@gmail.com>
> wrote:
>
>> The naming of config.forceFromStart is a little confusing, but in a
>> nutshell if true, it enables the config.startOffsetTime setting.
>>
>> If false, the spout will look for an offset in ZK (if any) and start from
>> there. If there's no offset in ZK, it will start from the end.
>>
>> -Taylor
>>
>>
>> On Mar 30, 2015, at 5:35 PM, Sarang Deshpande <sa...@gmail.com>
>> wrote:
>>
>> Hello storm users,
>> There are two variables in the Kafka spout config, startOffsetTime and
>> forceFromStart. If I set these as follows -
>>
>> config.forceFromStart = *false*;
>> config.startOffsetTime = OffsetRequest.EarliestTime();
>>
>> Kafka spout reads only the newly published messages (from latest offset)
>> and DOES NOT read from start as one would expect. Only when config is set
>> as follows, Kafka spout reads from the beginning.
>>
>> config.forceFromStart = *true*;
>> config.startOffsetTime = OffsetRequest.EarliestTime();
>>
>> Can someone explain what is the logical difference between forceFromStart
>> and startOffsetTime being EarliestTime?
>>
>> Thanks much
>> ~Sarang
>>
>> PS: Note that on the other hand, if forceFromStart is true and
>> startOffsetTime is LatestTime(), that is if they contradict with each
>> other, then spout reads only newly published messages.
>>
>>
>

Re: [Kafka Spout] - EarliestTime vs. forceFromStart

Posted by Sarang Deshpande <sa...@gmail.com>.
Thanks everyone for the response. To summarize, config.forceFromStart lets
kafka spout start consuming from the topic's beginning  (the earliest
offset available for consumption) and config.startOffsetTime =earliestTime()
is the offset where spout left off consuming last time.

On Mon, Mar 30, 2015 at 3:03 PM, P. Taylor Goetz <pt...@gmail.com> wrote:

> The naming of config.forceFromStart is a little confusing, but in a
> nutshell if true, it enables the config.startOffsetTime setting.
>
> If false, the spout will look for an offset in ZK (if any) and start from
> there. If there's no offset in ZK, it will start from the end.
>
> -Taylor
>
>
> On Mar 30, 2015, at 5:35 PM, Sarang Deshpande <sa...@gmail.com>
> wrote:
>
> Hello storm users,
> There are two variables in the Kafka spout config, startOffsetTime and
> forceFromStart. If I set these as follows -
>
> config.forceFromStart = *false*;
> config.startOffsetTime = OffsetRequest.EarliestTime();
>
> Kafka spout reads only the newly published messages (from latest offset)
> and DOES NOT read from start as one would expect. Only when config is set
> as follows, Kafka spout reads from the beginning.
>
> config.forceFromStart = *true*;
> config.startOffsetTime = OffsetRequest.EarliestTime();
>
> Can someone explain what is the logical difference between forceFromStart
> and startOffsetTime being EarliestTime?
>
> Thanks much
> ~Sarang
>
> PS: Note that on the other hand, if forceFromStart is true and
> startOffsetTime is LatestTime(), that is if they contradict with each
> other, then spout reads only newly published messages.
>
>

Re: [Kafka Spout] - EarliestTime vs. forceFromStart

Posted by "P. Taylor Goetz" <pt...@gmail.com>.
The naming of config.forceFromStart is a little confusing, but in a nutshell if true, it enables the config.startOffsetTime setting.

If false, the spout will look for an offset in ZK (if any) and start from there. If there's no offset in ZK, it will start from the end.

-Taylor


> On Mar 30, 2015, at 5:35 PM, Sarang Deshpande <sa...@gmail.com> wrote:
> 
> Hello storm users,
> There are two variables in the Kafka spout config, startOffsetTime and forceFromStart. If I set these as follows -
> 
> config.forceFromStart = false;
> config.startOffsetTime = OffsetRequest.EarliestTime();
> 
> Kafka spout reads only the newly published messages (from latest offset) and DOES NOT read from start as one would expect. Only when config is set as follows, Kafka spout reads from the beginning. 
> 
> config.forceFromStart = true;
> config.startOffsetTime = OffsetRequest.EarliestTime();
> 
> Can someone explain what is the logical difference between forceFromStart and startOffsetTime being EarliestTime?
> 
> Thanks much
> ~Sarang
> 
> PS: Note that on the other hand, if forceFromStart is true and startOffsetTime is LatestTime(), that is if they contradict with each other, then spout reads only newly published messages.

Re: [Kafka Spout] - EarliestTime vs. forceFromStart

Posted by Shivendra Singh <SS...@walmartlabs.com>.
Hi Sarang,

I have used
config.startOffsetTime to go back to a previous offset ( not necessary earliest),
ad as you mentioned it works only if config.forceFromStart = true;

I think naming is little wrong, read it as config.forceStartFromGivenOffset.

Regards,
Shivendra


From: Sarang Deshpande <sa...@gmail.com>>
Reply-To: "user@storm.apache.org<ma...@storm.apache.org>" <us...@storm.apache.org>>
Date: Monday, March 30, 2015 at 2:35 PM
To: "user@storm.apache.org<ma...@storm.apache.org>" <us...@storm.apache.org>>
Subject: [Kafka Spout] - EarliestTime vs. forceFromStart

Hello storm users,
There are two variables in the Kafka spout config, startOffsetTime and forceFromStart. If I set these as follows -

config.forceFromStart = false;
config.startOffsetTime = OffsetRequest.EarliestTime();

Kafka spout reads only the newly published messages (from latest offset) and DOES NOT read from start as one would expect. Only when config is set as follows, Kafka spout reads from the beginning.

config.forceFromStart = true;
config.startOffsetTime = OffsetRequest.EarliestTime();

Can someone explain what is the logical difference between forceFromStart and startOffsetTime being EarliestTime?

Thanks much
~Sarang

PS: Note that on the other hand, if forceFromStart is true and startOffsetTime is LatestTime(), that is if they contradict with each other, then spout reads only newly published messages.

Re: [Kafka Spout] - EarliestTime vs. forceFromStart

Posted by Michael Rose <mi...@fullcontact.com>.
startOffsetTime has to do with when you don't already have saved offsets,
or your offsets are invalid for some reason (e.g. your consumer was down
long enough that Kafka has deleted the relevant offsets from disk). The
first time your consumer starts it'll use startOffsetTime as advisement
(start at beginning of topic, or end?).

forceFromStart ignores your saved offsets. I'm unclear if it actually
forces from start, or if it'd reset to the end of the topic if your
startOffsetTime
was set to latest.

*Michael Rose*
Senior Software Engineer, Data Science
*Full*Contact | fullcontact.com
<https://www.fullcontact.com/?utm_source=FullContact%20-%20Email%20Signatures&utm_medium=email&utm_content=Signature%20Link&utm_campaign=FullContact%20-%20Email%20Signatures>
m: +1.720.837.1357 | t: @xorlev


All Your Contacts, Updated and In One Place.
Try FullContact for Free
<https://www.fullcontact.com/?utm_source=FullContact%20-%20Email%20Signatures&utm_medium=email&utm_content=Signature%20Link&utm_campaign=FullContact%20-%20Email%20Signatures>

On Mon, Mar 30, 2015 at 3:35 PM, Sarang Deshpande <
sarang.deshpande@gmail.com> wrote:

> Hello storm users,
> There are two variables in the Kafka spout config, startOffsetTime and
> forceFromStart. If I set these as follows -
>
> config.forceFromStart = *false*;
> config.startOffsetTime = OffsetRequest.EarliestTime();
>
> Kafka spout reads only the newly published messages (from latest offset)
> and DOES NOT read from start as one would expect. Only when config is set
> as follows, Kafka spout reads from the beginning.
>
> config.forceFromStart = *true*;
> config.startOffsetTime = OffsetRequest.EarliestTime();
>
> Can someone explain what is the logical difference between forceFromStart
> and startOffsetTime being EarliestTime?
>
> Thanks much
> ~Sarang
>
> PS: Note that on the other hand, if forceFromStart is true and
> startOffsetTime is LatestTime(), that is if they contradict with each
> other, then spout reads only newly published messages.
>