You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/08 18:29:44 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #25072: [SPARK-28294][CORE] Support `spark.history.fs.cleaner.maxNum` configuration

dongjoon-hyun commented on a change in pull request #25072: [SPARK-28294][CORE] Support `spark.history.fs.cleaner.maxNum` configuration
URL: https://github.com/apache/spark/pull/25072#discussion_r301239836
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala
 ##########
 @@ -851,10 +836,62 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)
         listing.delete(classOf[LogInfo], log.logPath)
       }
     }
+
+    // If the number of files is bigger than MAX_LOG_NUM,
+    // clean up all completed attempts per application one by one.
+    val num = listing.view(classOf[LogInfo]).index("lastProcessed").asScala.count(_ => true)
+    var count = num - maxNum
+    if (count > 0) {
+      logInfo(s"Try to delete $count old event logs to keep $maxNum logs in total.")
+      val oldAttempts = listing.view(classOf[ApplicationInfoWrapper])
+        .index("oldestAttempt")
+        .asScala
+        .toList
 
 Review comment:
   The existing one has different order. For example, `expired` is `reversed` and starts from `maxTime`. Do you mean something other?

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


With regards,
Apache Git Services

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