rajinisivaram commented on a change in pull request #9434:
URL: https://github.com/apache/kafka/pull/9434#discussion_r505698143



##########
File path: core/src/main/scala/kafka/cluster/Partition.scala
##########
@@ -1162,6 +1162,13 @@ class Partition(val topicPartition: TopicPartition,
     localLog.fetchOffsetSnapshot
   }
 
+  def hasDivergingEpoch(currentLeaderEpoch: Optional[Integer],
+                        lastFetchedEpoch: Int,
+                        fetchOffset: Long): Boolean = {
+    val epochEndOffset = lastOffsetForLeaderEpoch(currentLeaderEpoch, 
lastFetchedEpoch, fetchOnlyFromLeader = false)

Review comment:
       @hachikuji Thanks for the review. I took the check from 
`Partition.readRecords`, but we throw exceptions there to return appropriate 
errors. I was thinking we would return true here for undefined epochs because 
of the check below and that would go through the other code path to return the 
appropriate errors or diverging epoch. Do you think we should do the same error 
handling hchecks ere as in readRecords to make the flow more obvious?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Reply via email to