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

    https://github.com/apache/spark/pull/15285#discussion_r83812701
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1448,14 +1452,70 @@ private[spark] object Utils extends Logging {
         CallSite(shortForm, longForm)
       }
     
    +  val UNCOMPRESSED_LOG_FILE_LENGTH_CACHE_SIZE = 
"spark.worker.ui.compressedLogFileLengthCacheSize"
    +  val DEFAULT_UNCOMPRESSED_LOG_FILE_LENGTH_CACHE_SIZE = 100
    +  private var compressedLogFileLengthCache: LoadingCache[String, 
java.lang.Long] = null
    +  private def getCompressedLogFileLengthCache(
    +      sparkConf: SparkConf): LoadingCache[String, java.lang.Long] = 
this.synchronized {
    +    if (compressedLogFileLengthCache == null) {
    +      val compressedLogFileLengthCacheSize = sparkConf.getInt(
    +        UNCOMPRESSED_LOG_FILE_LENGTH_CACHE_SIZE,
    +        DEFAULT_UNCOMPRESSED_LOG_FILE_LENGTH_CACHE_SIZE)
    +      compressedLogFileLengthCache = CacheBuilder.newBuilder()
    +        .maximumSize(compressedLogFileLengthCacheSize)
    +        .build[String, java.lang.Long](new CacheLoader[String, 
java.lang.Long]() {
    +        override def load(path: String): java.lang.Long = {
    +          Utils.getFileLength(new File(path))
    +        }
    +      })
    +    }
    +    compressedLogFileLengthCache
    +  }
    +
    +  def getFileLength(file: File, sparkConf: SparkConf): Long = {
    --- End diff --
    
    Add docs. Specify why conf is needed.
    Rename sparkConf to more specific workerConf.


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