kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Rao <jun...@gmail.com>
Subject Re: Confused about offsets
Date Fri, 19 Aug 2011 22:47:34 GMT
Carlo,

GetOffsetShell doesn't return the offset of every message. It returns the
offset of the first message in every segment file. If you provide a time,
the offsets you get back are based on the last modified time of the segment
files. There is a jira kafka-87 that tries to improve that.

The second problem is likely fixed in trunk.

Jun



On Fri, Aug 19, 2011 at 3:30 PM, Carlo Cabanilla <carlo@datadoghq.com>wrote:

>  Hello,
>
> I'm trying to wrap my head around how requesting offsets works.
>
> If I run this:
>
> $ kafka-producer-shell.sh --server kafka://localhost:9092 --topic test
> yo
> sent: yo (11 bytes)
> sup
> sent: sup (12 bytes)
>
>
> I'd expect to have 3 offsets: 0, 11 and 23. Instead, I have only two:
>
> $ kafka-run-class.sh kafka.tools.GetOffsetShell --server
> kafka://localhost:9092 --topic test --time -1 --offsets 3
> get 2 results
> 23
> 0
>
>
> Why is this the case?
>
> Also, querying by timestamp does not seem to be working:
>
> $ kafka-run-class.sh kafka.tools.GetOffsetShell --server
> kafka://localhost:9092 --topic test --time $(date +%s) --offsets 3
> get 0 results
>
>
> This is from the 0.6 release.
>
> .Carlo
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message