junrao commented on a change in pull request #9631: URL: https://github.com/apache/kafka/pull/9631#discussion_r529070546
########## File path: core/src/main/scala/kafka/cluster/Partition.scala ########## @@ -947,9 +947,10 @@ class Partition(val topicPartition: TopicPartition, leaderEndOffset: Long, currentTimeMs: Long, maxLagMs: Long): Boolean = { - val followerReplica = getReplicaOrException(replicaId) - followerReplica.logEndOffset != leaderEndOffset && - (currentTimeMs - followerReplica.lastCaughtUpTimeMs) > maxLagMs + getReplica(replicaId).fold(true) { followerReplica => Review comment: For the reassignment case, once the controller shrinks the assigned replica set, the next step is for the controller to remove the remove replica from ISR and bump up the leader epoch. The shrunk isr will then be propagated to the leader. With `fold(true)`, we allow to leader to shrink ISR immediately. This might be ok, but is unnecessary work since the controller will be doing that soon. Another option is to use `fold(false)`. This way, the leader won't shrink the removed replica from ISR. Only the controller will do. ---------------------------------------------------------------- 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