You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Hangleton (via GitHub)" <gi...@apache.org> on 2023/02/21 08:47:56 UTC

[GitHub] [kafka] Hangleton commented on a diff in pull request #13268: MINOR: Introduce OffsetAndEpoch in LeaderEndpoint interface return values

Hangleton commented on code in PR #13268:
URL: https://github.com/apache/kafka/pull/13268#discussion_r1112735419


##########
core/src/main/scala/kafka/server/AbstractFetcherThread.scala:
##########
@@ -704,18 +708,18 @@ abstract class AbstractFetcherThread(name: String,
        * Putting the two cases together, the follower should fetch from the higher one of its replica log end offset
        * and the current leader's (local-log-start-offset or) log start offset.
        */
-      val (epoch, leaderStartOffset) = if (fetchFromLocalLogStartOffset)
+      val offsetAndEpoch = if (fetchFromLocalLogStartOffset)
         leader.fetchEarliestLocalOffset(topicPartition, currentLeaderEpoch) else
         leader.fetchEarliestOffset(topicPartition, currentLeaderEpoch)
-
+      val leaderStartOffset = offsetAndEpoch.offset
       warn(s"Reset fetch offset for partition $topicPartition from $replicaEndOffset to current " +
         s"leader's start offset $leaderStartOffset")
       val offsetToFetch =
         if (leaderStartOffset > replicaEndOffset) {
           // Only truncate log when current leader's log start offset (local log start offset if >= 3.4 version incaseof
           // OffsetMovedToTieredStorage error) is greater than follower's log end offset.
           // truncateAndBuild returns offset value from which it needs to start fetching.
-          truncateAndBuild(epoch, leaderStartOffset)
+          truncateAndBuild(offsetAndEpoch.leaderEpoch, leaderStartOffset)

Review Comment:
   Minor - maybe the argument of `truncateAndBuild` could be the `offsetAndEpoch` itself?



-- 
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.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org