stanislavkozlovski commented on a change in pull request #8724: URL: https://github.com/apache/kafka/pull/8724#discussion_r432986275
########## File path: core/src/main/scala/kafka/controller/ControllerContext.scala ########## @@ -391,6 +404,54 @@ class ControllerContext { partitionsForTopic(topic).filter { partition => states.contains(partitionState(partition)) }.toSet } + def putLeadershipInfo(partition: TopicPartition, leaderIsrAndControllerEpoch: LeaderIsrAndControllerEpoch): Unit = { + val previous = partitionLeadershipInfo.put(partition, leaderIsrAndControllerEpoch) + val replicaAssignment = partitionFullReplicaAssignment(partition) + updatePreferredReplicaImbalanceMetric(partition, Some(replicaAssignment), previous, + Some(replicaAssignment), Some(leaderIsrAndControllerEpoch)) + } + + private def updatePreferredReplicaImbalanceMetric(partition: TopicPartition, + oldReplicaAssignment: Option[ReplicaAssignment], + oldLeadershipInfo: Option[LeaderIsrAndControllerEpoch], + newReplicaAssignment: Option[ReplicaAssignment], Review comment: nit: I think this exact argument doesn't need to be an Option ---------------------------------------------------------------- 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