junrao commented on a change in pull request #11255:
URL: https://github.com/apache/kafka/pull/11255#discussion_r696035745



##########
File path: core/src/main/scala/kafka/controller/KafkaController.scala
##########
@@ -630,7 +630,7 @@ class KafkaController(val config: KafkaConfig,
 
     // If replica failure did not require leader re-election, inform brokers 
of the offline brokers
     // Note that during leader re-election, brokers update their metadata
-    if (partitionsWithOfflineLeader.isEmpty) {
+    if (newOfflineReplicas.isEmpty) {

Review comment:
       Good catch. There are two cases where we need to send 
UpdateMetadataRequest.
   
   1. If the broker doesn't host any replicas. This is the new case that you 
identified since we won't send any UpdateMetadataRequest in 
PartitionStateMachine and we want to propagate the offline broker to other 
brokers.
   2. If partitionsWithOfflineLeader is not empty, 
partitionStateMachine.triggerOnlinePartitionStateChange() would send 
UpdateMetadataRequest as part of the transitioning of those partitions to 
online. So, we don't need to send UpdateMetadataRequest again. If 
partitionsWithOfflineLeader is empty, we do want to send UpdateMetadataRequest 
to propagate the offline broker.
   
   So, it seem that the check should be if (newOfflineReplicas.isEmpty || 
partitionsWithOfflineLeader.isEmpty). It would be useful to adjust the comment 
above accordingly.




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