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 2021/02/01 08:49:39 UTC

[GitHub] [kafka] showuon commented on a change in pull request #9777: KAFKA-7940: wait until we've got the expected partition size

showuon commented on a change in pull request #9777:
URL: https://github.com/apache/kafka/pull/9777#discussion_r567650065



##########
File path: core/src/test/scala/unit/kafka/utils/TestUtils.scala
##########
@@ -885,6 +891,24 @@ object TestUtils extends Logging {
     ), "Timed out waiting for broker metadata to propagate to all servers", timeout)
   }
 
+  /**
+   * Wait until the expected number of partitions is in the metadata cache in each broker.
+   *
+   * @param servers The list of servers that the metadata should reach to
+   * @param topic The topic name
+   * @param expectedNumPartitions The expected number of partitions
+   */
+  def waitUntilMetadataIsPropagatedWithExpectedSize(servers: Seq[KafkaServer], topic: String, expectedNumPartitions: Int): Unit = {
+    waitUntilTrue(
+      () => servers.forall { server =>
+        server.dataPlaneRequestProcessor.metadataCache.numPartitions(topic) match {

Review comment:
       Good suggestion. Updated.

##########
File path: core/src/test/scala/unit/kafka/utils/TestUtils.scala
##########
@@ -885,6 +891,24 @@ object TestUtils extends Logging {
     ), "Timed out waiting for broker metadata to propagate to all servers", timeout)
   }
 
+  /**
+   * Wait until the expected number of partitions is in the metadata cache in each broker.
+   *
+   * @param servers The list of servers that the metadata should reach to
+   * @param topic The topic name
+   * @param expectedNumPartitions The expected number of partitions
+   */
+  def waitUntilMetadataIsPropagatedWithExpectedSize(servers: Seq[KafkaServer], topic: String, expectedNumPartitions: Int): Unit = {

Review comment:
       Good suggestion. Updated.




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