rite2nikhil commented on a change in pull request #9382:
URL: https://github.com/apache/kafka/pull/9382#discussion_r500743939



##########
File path: core/src/main/scala/kafka/server/AbstractFetcherThread.scala
##########
@@ -432,14 +455,22 @@ abstract class AbstractFetcherThread(name: String,
       failedPartitions.removeAll(initialFetchStates.keySet)
 
       initialFetchStates.forKeyValue { (tp, initialFetchState) =>
-        // We can skip the truncation step iff the leader epoch matches the 
existing epoch
+        // For IBP 2.7 onwards, we can rely on truncation based on diverging 
data returned in fetch responses.
+        // For older versions, we can skip the truncation step iff the leader 
epoch matches the existing epoch
         val currentState = partitionStates.stateValue(tp)
-        val updatedState = if (currentState != null && 
currentState.currentLeaderEpoch == initialFetchState.leaderEpoch) {
+        val updatedState = if (initialFetchState.offset >= 0 && 
isTruncationOnFetchSupported && initialFetchState.lastFetchedEpoch.nonEmpty) {

Review comment:
       NIT: Should this be the first check in the if () statement ?




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