srowen commented on code in PR #36424:
URL: https://github.com/apache/spark/pull/36424#discussion_r866785032
##########
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala:
##########
@@ -631,37 +631,38 @@ private[history] class FsHistoryProvider(conf: SparkConf,
clock: Clock)
private def cleanAppData(appId: String, attemptId: Option[String], logPath:
String): Unit = {
try {
- val app = load(appId)
- val (attempt, others) = app.attempts.partition(_.info.attemptId ==
attemptId)
-
- assert(attempt.isEmpty || attempt.size == 1)
- val isStale = attempt.headOption.exists { a =>
- if (a.logPath != new Path(logPath).getName()) {
- // If the log file name does not match, then probably the old log
file was from an
- // in progress application. Just return that the app should be left
alone.
- false
- } else {
- val maybeUI = synchronized {
- activeUIs.remove(appId -> attemptId)
- }
-
- maybeUI.foreach { ui =>
- ui.invalidate()
- ui.ui.store.close()
+ var isStale = false
+ listing.synchronized {
+ val app = load(appId)
+ val (attempt, others) = app.attempts.partition(_.info.attemptId ==
attemptId)
+
+ assert(attempt.isEmpty || attempt.size == 1)
+ isStale = attempt.headOption.exists { a =>
+ if (a.logPath != new Path(logPath).getName()) {
+ // If the log file name does not match, then probably the old log
file was from an
+ // in progress application. Just return that the app should be
left alone.
+ false
+ } else {
+ if (others.nonEmpty) {
+ val newAppInfo = new ApplicationInfoWrapper(app.info, others)
+ listing.write(newAppInfo)
+ } else {
+ listing.delete(classOf[ApplicationInfoWrapper], appId)
+ }
+ true
}
-
- diskManager.foreach(_.release(appId, attemptId, delete = true))
- true
}
}
- if (isStale) {
- if (others.nonEmpty) {
- val newAppInfo = new ApplicationInfoWrapper(app.info, others)
- listing.write(newAppInfo)
- } else {
- listing.delete(classOf[ApplicationInfoWrapper], appId)
+ if(isStale) {
Review Comment:
Nit: space after if
This looks OK - finer-grained but not nesting locks now.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]