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 2022/05/13 09:55:07 UTC

[GitHub] [kafka] bozhao12 opened a new pull request, #12158: MINOR:A few code cleanUps in KafkaController

bozhao12 opened a new pull request, #12158:
URL: https://github.com/apache/kafka/pull/12158

   Following variables in kafkaController are used for metric statistics:
   ```
      offlinePartitionCount 
       preferredReplicaImbalanceCount
       globalTopicCount 
       globalPartitionCount
       topicsToDeleteCount 
       replicasToDeleteCount 
       ineligibleTopicsToDeleteCount 
       ineligibleReplicasToDeleteCount 
   ```
   When Controller goes from active to non-active, these variables will be reset to 0.
   Currently, we will perform reset operations in `KafkaController.onControllerResignation() `and `KafkaController.updateMetrics()` .
   in fact, whether it is an active controller or a non-active controller, as long as it  receives events related to controller change, The method` KafkaController.updateMetrics()` will be executed, and decide whether to reset the above variables. So the reset operations in `KafkaController.onControllerResignation() ` can actually be removed.
   


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

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


[GitHub] [kafka] bozhao12 commented on a diff in pull request #12158: MINOR:A few code cleanUps in KafkaController

Posted by GitBox <gi...@apache.org>.
bozhao12 commented on code in PR #12158:
URL: https://github.com/apache/kafka/pull/12158#discussion_r874295581


##########
core/src/main/scala/kafka/controller/KafkaController.scala:
##########
@@ -468,14 +468,6 @@ class KafkaController(val config: KafkaConfig,
 
     // shutdown leader rebalance scheduler
     kafkaScheduler.shutdown()
-    offlinePartitionCount = 0

Review Comment:
   @hachikuji Thanks for your suggestion, I updated the code.



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

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


[GitHub] [kafka] hachikuji merged pull request #12158: MINOR:A few code cleanUps in KafkaController

Posted by GitBox <gi...@apache.org>.
hachikuji merged PR #12158:
URL: https://github.com/apache/kafka/pull/12158


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

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


[GitHub] [kafka] hachikuji commented on a diff in pull request #12158: MINOR:A few code cleanUps in KafkaController

Posted by GitBox <gi...@apache.org>.
hachikuji commented on code in PR #12158:
URL: https://github.com/apache/kafka/pull/12158#discussion_r873958800


##########
core/src/main/scala/kafka/controller/KafkaController.scala:
##########
@@ -468,14 +468,6 @@ class KafkaController(val config: KafkaConfig,
 
     // shutdown leader rebalance scheduler
     kafkaScheduler.shutdown()
-    offlinePartitionCount = 0

Review Comment:
   The way `updateMetrics` is written is a little annoying. While we're at it, would it be any clearer to revise `updateMetrics` to the following structure:
   ```scala
   if (isActive) {
     offlinePartitionCount = controllerContext.offlinePartitionCount
     ...
   } else {
     offlinePartitionCount = 0
     ...
   }
   ```



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

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