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/04/21 09:12:29 UTC
[GitHub] [kafka] stanislavkozlovski commented on a change in pull request #8524: KAFKA-9866: Avoid election for topics where preferred leader is not in ISR
stanislavkozlovski commented on a change in pull request #8524:
URL: https://github.com/apache/kafka/pull/8524#discussion_r412014026
##########
File path: core/src/main/scala/kafka/controller/KafkaController.scala
##########
@@ -1066,6 +1066,7 @@ class KafkaController(val config: KafkaConfig,
// do this check only if the broker is live and there are no partitions being reassigned currently
// and preferred replica election is not in progress
val candidatePartitions = topicsNotInPreferredReplica.keys.filter(tp => controllerContext.isReplicaOnline(leaderBroker, tp) &&
+ controllerContext.partitionLeadershipInfo(tp).leaderAndIsr.isr.contains(leaderBroker) &&
Review comment:
I think we should do this check last. We also want to use an option to avoid any potential NPEs. e.g:
```
controllerContext.partitionLeadershipInfo.get(partition).forall(...)
```
----------------------------------------------------------------
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