...
We will also have a new API to support seeking to an offset and leader epoch. This is required in order to support storage of offsets in an external store. When the consumer is initialized, the user will call seekToCommitted
with seek() with the offset and leader epoch that was stored. The consumer will initialize the position of the consumer using this API. If the log has been truncated since the time the offsets were stored, the next call to poll()
will raise a LogTruncationException
as described above.
Code Block |
---|
/** * Seek to a committedan offset takingand intoinitialize accountthe leader epoch (if informationpresent). */ void seekToCommittedseek(TopicPartition partition, OffsetAndMetadata offset); |
...
Code Block | ||
---|---|---|
| ||
OffsetForLeaderEpochRequest => [Topic] Topic => TopicName [Partition] TopicName => STRING Partition => PartitionId CurrentLeaderEpochLeaderEpoch LeaderEpochLeaderEpochQuery PartitionId => INT32 CurrentLeaderEpochLeaderEpoch => INT32 // New LeaderEpochLeaderEpochQuery => INT32 |
If the current leader epoch does not match that of the leader, then we will send either FENCED_REPLICA or UNKNOWN_LEADER_EPOCH as we do for the Fetch API.
...