Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4537#discussion_r29533746
  
    --- Diff: 
external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaTestUtils.scala
 ---
    @@ -227,10 +229,34 @@ private class KafkaTestUtils extends Logging {
         tryAgain(1)
       }
     
    +  /** wait until the leader offset for the given topic/partition equals 
the specified offset */
    +  def waitUntilLeaderOffset(
    +      topic: String,
    +      partition: Int,
    +      offset: Long): Unit = {
    +    eventually(Time(10000), Time(100)) {
    +      val kc = new KafkaCluster(Map("metadata.broker.list" -> 
brokerAddress))
    +      val tp = TopicAndPartition(topic, partition)
    +      val llo = 
kc.getLatestLeaderOffsets(Set(tp)).right.get.apply(tp).offset
    +      assert(
    +        llo == offset,
    +        s"$topic $partition $offset not reached after timeout")
    +    }
    +  }
    +
       private def waitUntilMetadataIsPropagated(topic: String, partition: 
Int): Unit = {
         eventually(Time(10000), Time(100)) {
           assert(
    -        server.apis.metadataCache.containsTopicAndPartition(topic, 
partition),
    +        server.apis.metadataCache.getPartitionInfo(topic, partition) match 
{
    --- End diff --
    
    And also explain in a comment what this code does? For example, I am not 
sure what is `isr` in `leaderAndIsr`. And what are all these conditions &&-ed 
together.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to