You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Nilesh Kumar (Jira)" <ji...@apache.org> on 2026/10/09 21:16:00 UTC

[jira] [Assigned] (KAFKA-21204) ListOffset may return -1 when offset is available

     [ https://issues.apache.org/jira/browse/KAFKA-21204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nilesh Kumar reassigned KAFKA-21204:
------------------------------------

    Assignee: Nilesh Kumar

> ListOffset may return -1 when offset is available
> -------------------------------------------------
>
>                 Key: KAFKA-21204
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21204
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Jun Rao
>            Assignee: Nilesh Kumar
>            Priority: Major
>
> When serving a ListOffset request, the broker eventually calls FileRecords.
> searchForTimestamp(), which calls batchesFrom(). batchesFrom() bounds the iteration by the end of the segment, which could include uncommitted data. In ReplicaManger.
> fetchOffset(), we bound the returned offset by lastFetchableOffset. However, this means that the returned offset is -1, instead of the actual offset. This issue can be more likely surfaced when MAX_TIMESTAMP is used in ListOffset and records are appended in increasing timestamp order.
>  
> {code:java}
>                 if (resultHolder.lastFetchableOffset.isPresent &&
>                   timestampAndOffsetOpt.offset >= resultHolder.lastFetchableOffset.get) {
>                   resultHolder.maybeOffsetsError.map(e => throw e)
>                 } else {{code}



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