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

    https://github.com/apache/spark/pull/18143#discussion_r119132090
  
    --- Diff: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/CachedKafkaConsumer.scala
 ---
    @@ -310,62 +308,45 @@ private[kafka010] object CachedKafkaConsumer extends 
Logging {
     
       private lazy val cache = {
         val conf = SparkEnv.get.conf
    -    val capacity = conf.getInt("spark.sql.kafkaConsumerCache.capacity", 64)
    -    new ju.LinkedHashMap[CacheKey, CachedKafkaConsumer](capacity, 0.75f, 
true) {
    -      override def removeEldestEntry(
    -        entry: ju.Map.Entry[CacheKey, CachedKafkaConsumer]): Boolean = {
    -        if (entry.getValue.inuse == false && this.size > capacity) {
    -          logWarning(s"KafkaConsumer cache hitting max capacity of 
$capacity, " +
    -            s"removing consumer for ${entry.getKey}")
    -          try {
    -            entry.getValue.close()
    -          } catch {
    -            case e: SparkException =>
    -              logError(s"Error closing earliest Kafka consumer for 
${entry.getKey}", e)
    -          }
    -          true
    -        } else {
    -          false
    +    val capacityConfigString: String = 
"spark.sql.kafkaConsumerCache.capacity"
    +    val capacity = conf.getInt(capacityConfigString, 64)
    +    val duration = 
conf.getTimeAsMs("spark.sql.kafkaConsumerCache.timeout", "10m")
    --- End diff --
    
    It seems like the general trend towards default configuration values is to 
make them work for the lowest common denominator use case, in which case I'd 
argue for a longer (30 min?) default timeout.


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