You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/10 09:38:45 UTC

[GitHub] [kafka] dajac commented on a change in pull request #9689: KAFKA-10740; Replace OffsetsForLeaderEpochRequest.PartitionData with automated protocol

dajac commented on a change in pull request #9689:
URL: https://github.com/apache/kafka/pull/9689#discussion_r540016662



##########
File path: core/src/main/scala/kafka/server/AbstractFetcherThread.scala
##########
@@ -268,11 +271,12 @@ abstract class AbstractFetcherThread(name: String,
             fetchOffsets.put(tp, offsetTruncationState)
 
         case Errors.FENCED_LEADER_EPOCH =>
-          if (onPartitionFenced(tp, latestEpochsForPartitions.get(tp).flatMap {
-            p =>
-              if (p.currentLeaderEpoch.isPresent) Some(p.currentLeaderEpoch.get())
-              else None
-          })) partitionsWithError += tp
+          val currentLeaderEpoch = latestEpochsForPartitions.get(tp) match {

Review comment:
       We could but that would require two conversions instead of one:
   ```
   val currentLeaderEpoch = latestEpochsForPartitions.get(tp).flatMap { p =>
       RequestUtils.getLeaderEpoch(p.currentLeaderEpoch).asScala
   }.asJava
   ```
   I have a small preference for the current approach to avoid this.




----------------------------------------------------------------
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:
users@infra.apache.org