You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "cmccabe (via GitHub)" <gi...@apache.org> on 2023/01/30 23:17:21 UTC

[GitHub] [kafka] cmccabe opened a new pull request, #13176: MINOR: some ZK migration code cleanups.

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

   Some minor improvements to the JavaDoc for ZkMigrationState.
   
   Rename MigrationState to MigrationDriverState to avoid confusion with ZkMigrationState.
   
   Remove ClusterImage#zkBrokers. This costs O(num_brokers) time to calculate, but is only ever used when in migration state. It should just be calculated in the migration code. (Additionally, the function ClusterImage.zkBrokers() returns something other than ClusterImage#zkBrokers, which is confusing.)
   
   Also remove ClusterDelta#liveZkBrokerIdChanges. This is only used in one place, and it's easy to calculate it there. In general we should avoid providing expensive accessors unless absolutely necessary. Expensive code should look expensive: if people want to iterate over all brokers, they can write a loop to do that rather than hiding it inside an accessor.


-- 
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] Hangleton commented on a diff in pull request #13176: MINOR: some ZK migration code cleanups.

Posted by "Hangleton (via GitHub)" <gi...@apache.org>.
Hangleton commented on code in PR #13176:
URL: https://github.com/apache/kafka/pull/13176#discussion_r1094408921


##########
core/src/main/scala/kafka/migration/MigrationPropagator.scala:
##########
@@ -79,6 +81,18 @@ class MigrationPropagator(
     _image = image
   }
 
+  /**
+   * A very expensive function that creates a map with an entry for every partition that exists, from
+   * (topic name, partition index) to partition registration.
+   */
+  def materializePartitions(topicsImage: TopicsImage): util.Map[TopicPartition, PartitionRegistration] = {

Review Comment:
   Thanks.



-- 
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] cmccabe commented on a diff in pull request #13176: MINOR: some ZK migration code cleanups.

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #13176:
URL: https://github.com/apache/kafka/pull/13176#discussion_r1093550518


##########
core/src/main/scala/kafka/migration/MigrationPropagator.scala:
##########
@@ -79,6 +81,18 @@ class MigrationPropagator(
     _image = image
   }
 
+  /**
+   * A very expensive function that creates a map with an entry for every partition that exists, from
+   * (topic name, partition index) to partition registration.
+   */
+  def materializePartitions(topicsImage: TopicsImage): util.Map[TopicPartition, PartitionRegistration] = {

Review Comment:
   Using mutable Scala maps gives a bunch of type errors (which I'm sure are fixable, but using a Java map is simple and straightforward)



-- 
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] cmccabe closed pull request #13176: MINOR: some ZK migration code cleanups.

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe closed pull request #13176: MINOR: some ZK migration code cleanups.
URL: https://github.com/apache/kafka/pull/13176


-- 
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] Hangleton commented on a diff in pull request #13176: MINOR: some ZK migration code cleanups.

Posted by "Hangleton (via GitHub)" <gi...@apache.org>.
Hangleton commented on code in PR #13176:
URL: https://github.com/apache/kafka/pull/13176#discussion_r1091621015


##########
core/src/main/scala/kafka/migration/MigrationPropagator.scala:
##########
@@ -79,6 +81,18 @@ class MigrationPropagator(
     _image = image
   }
 
+  /**
+   * A very expensive function that creates a map with an entry for every partition that exists, from
+   * (topic name, partition index) to partition registration.
+   */
+  def materializePartitions(topicsImage: TopicsImage): util.Map[TopicPartition, PartitionRegistration] = {

Review Comment:
   Curious - what is the reason for using `util.Map` instead of one of scala map DS?



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