[ 
https://issues.apache.org/jira/browse/KAFKA-13154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869819#comment-17869819
 ] 

Ksolves India Limited commented on KAFKA-13154:
-----------------------------------------------

Based on my analysis, the current behavior of OffsetSpec.latest() when 
retrieving the latest offsets per partition on a topic is misleading. The 
returned result represents the count of offsets in the topic, not the actual 
latest offset.
For example:
 * For an empty topic, the latest offset is 0 (instead of -1, similar to the 
behavior of OffsetSpec.forTimestamp).
 * For a topic with 1 message per partition, the latest offset is 1 (instead of 
0).

We have implemented changes to correct this behavior. Please review and merge 
the PR here: [https://github.com/apache/kafka/pull/16729].

> Misleading behaviour of OffsetSpec.latest()
> -------------------------------------------
>
>                 Key: KAFKA-13154
>                 URL: https://issues.apache.org/jira/browse/KAFKA-13154
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 2.5.1
>            Reporter: Gabi Pi.
>            Priority: Minor
>
> When using `OffsetSpec.latest()` to get latest offsets per partition on 
> topic, the return result represents count of offsets in topic and not the 
> latest offset.
> For example:
>  * For empty topic, the latest offset will be 0 (instead of -1, similar to 
> `OffsetSpec.forTimestamp` method)
>  * For topic with 1 message per partition, the latest returned offset will be 
> 1 (instead of 0)
> The method described in the docs in the following way:
> _Used to retrieve the latest offset of a partition_
> According to this description, I think that the current behaviour is 
> misleading.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to