[ https://issues.apache.org/jira/browse/KAFKA-6857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16463224#comment-16463224 ]
ASF GitHub Bot commented on KAFKA-6857: --------------------------------------- apovzner opened a new pull request #4967: KAFKA-6857: Leader must always reply with undefined offset if undefined leader epoch requested URL: https://github.com/apache/kafka/pull/4967 The leader must explicitly check if requested leader epoch is undefined, and return undefined offset so that the follower can fall back to truncating to high watermark. Otherwise, if the leader also is not tracking leader epochs, it may return its LEO, which will the follower to truncate to the incorrect offset. Added unit test to verify the behavior. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > LeaderEpochFileCache.endOffsetFor() should check for UNDEFINED_EPOCH > explicitly > ------------------------------------------------------------------------------- > > Key: KAFKA-6857 > URL: https://issues.apache.org/jira/browse/KAFKA-6857 > Project: Kafka > Issue Type: Bug > Components: core > Affects Versions: 0.11.0.0 > Reporter: Jun Rao > Assignee: Anna Povzner > Priority: Major > > In LeaderEpochFileCache.endOffsetFor() , we have the following code. > > > {code:java} > if (requestedEpoch == latestEpoch) { > leo().messageOffset > {code} > > In the case when the requestedEpoch is UNDEFINED_EPOCH and latestEpoch is > also UNDEFINED_EPOCH, we return leo. This will cause the follower to truncate > to a wrong offset. If requestedEpoch is UNDEFINED_EPOCH, we need to request > UNDEFINED_EPOCH_OFFSET. -- This message was sent by Atlassian JIRA (v7.6.3#76005)