Github user steveloughran commented on a diff in the pull request: https://github.com/apache/spark/pull/15984#discussion_r89312600 --- Diff: core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala --- @@ -535,6 +535,26 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) } } + override def deleteLog(appId: String, attemptId: Option[String]): Unit = { + applications.get(appId) match { + case Some(appInfo) => + appInfo.attempts.filter { attempt => + attempt.attemptId.isEmpty || attemptId.isEmpty || attempt.attemptId.get == attemptId.get + }.foreach { attempt => + try { + fs.delete(new Path(logDir, attempt.logPath), true) + applications.remove(appId) + } catch { + case e: AccessControlException => + logInfo(s"No permission to delete ${attempt.logPath}, ignoring.") + case t: IOException => + logError(s"IOException in cleaning ${attempt.logPath}", t) + } + } + case None => logError(s"Can't delete, no application ${appId} found") --- End diff -- from a testability perspective, returning true/false allows the HistoryServerSuite to see what happens in the cases of: no matching app; no matching attempt
--- 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