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

    https://github.com/apache/spark/pull/16006#discussion_r91002372
  
    --- Diff: 
external/kafka-0-10/src/main/scala/org/apache/spark/streaming/kafka010/DirectKafkaInputDStream.scala
 ---
    @@ -143,9 +147,14 @@ private[spark] class DirectKafkaInputDStream[K, V](
     
             lagPerPartition.map { case (tp, lag) =>
               val maxRateLimitPerPartition = ppc.maxRatePerPartition(tp)
    -          val backpressureRate = Math.round(lag / totalLag.toFloat * rate)
    -          tp -> (if (maxRateLimitPerPartition > 0) {
    -            Math.min(backpressureRate, maxRateLimitPerPartition)} else 
backpressureRate)
    +          val backpressureRate =
    +            if (rate >= 0) {
    +              val estimateRate = Math.round(lag / totalLag.toFloat * rate)
    +              if (estimateRate > maxRateLimitPerPartition && 
maxRateLimitPerPartition > 0) {
    +                maxRateLimitPerPartition
    +              } else estimateRate
    +            } else math.min(backpressureInitialRate, 
maxRateLimitPerPartition)
    --- End diff --
    
    I don't think these units are comparable, one is records / sec, and the 
other is records / sec / partition.


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