You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "tanjialiang (Jira)" <ji...@apache.org> on 2023/09/25 10:52:00 UTC

[jira] [Closed] (FLINK-33153) Kafka using latest-offset maybe missing data

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

tanjialiang closed FLINK-33153.
-------------------------------
    Release Note: realte to https://issues.apache.org/jira/browse/FLINK-28303
      Resolution: Duplicate

> Kafka using latest-offset maybe missing data
> --------------------------------------------
>
>                 Key: FLINK-33153
>                 URL: https://issues.apache.org/jira/browse/FLINK-33153
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Kafka
>    Affects Versions: kafka-4.1.0
>            Reporter: tanjialiang
>            Priority: Minor
>
> When Kafka start with the latest-offset strategy, it does not fetch the latest snapshot offset and specify it for consumption. Instead, it sets the startingOffset to -1 (KafkaPartitionSplit.LATEST_OFFSET, which makes currentOffset = -1, and call the KafkaConsumer's  seekToEnd API). The currentOffset is only set to the consumed offset + 1 when the task consumes data, and this currentOffset is stored in the state during checkpointing. If there are very few messages in Kafka and a partition has not consumed any data, and I stop the task with a savepoint, then write data to that partition, and start the task with the savepoint, the task will resume from the saved state. Due to the startingOffset in the state being -1, it will cause the task to miss the data that was written before the recovery point.



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