chia7712 commented on code in PR #18632:
URL: https://github.com/apache/kafka/pull/18632#discussion_r1926841078


##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -1050,28 +1050,23 @@ class Partition(val topicPartition: TopicPartition,
   }
 
   private def isReplicaIsrEligible(followerReplicaId: Int): Boolean = {
-    metadataCache match {
-      // In KRaft mode, only a replica which meets all of the following 
requirements is allowed to join the ISR.
-      // 1. It is not fenced.
-      // 2. It is not in controlled shutdown.
-      // 3. Its metadata cached broker epoch matches its Fetch request broker 
epoch. Or the Fetch
-      //    request broker epoch is -1 which bypasses the epoch verification.
-      case kRaftMetadataCache: KRaftMetadataCache =>
-        val mayBeReplica = getReplica(followerReplicaId)
-        // The topic is already deleted and we don't have any replica 
information. In this case, we can return false
-        // so as to avoid NPE
-        if (mayBeReplica.isEmpty) {
-          warn(s"The replica state of replica ID:[$followerReplicaId] doesn't 
exist in the leader node. It might because the topic is already deleted.")
-          return false
-        }
-        val storedBrokerEpoch = mayBeReplica.get.stateSnapshot.brokerEpoch
-        val cachedBrokerEpoch = 
kRaftMetadataCache.getAliveBrokerEpoch(followerReplicaId)
-        !kRaftMetadataCache.isBrokerFenced(followerReplicaId) &&
-          !kRaftMetadataCache.isBrokerShuttingDown(followerReplicaId) &&
-          isBrokerEpochIsrEligible(storedBrokerEpoch, cachedBrokerEpoch)
-
-      case _ => true
+    // In KRaft mode, only a replica which meets all of the following 
requirements is allowed to join the ISR.

Review Comment:
   Maybe we can remove "In KRaft mode"?



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to