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

    https://github.com/apache/spark/pull/18887#discussion_r132773332
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -720,19 +631,64 @@ private[history] class FsHistoryProvider(conf: 
SparkConf, clock: Clock)
           appId: String,
           attemptId: Option[String],
           prevFileSize: Long)(): Boolean = {
    -    lookup(appId, attemptId) match {
    -      case None =>
    -        logDebug(s"Application Attempt $appId/$attemptId not found")
    -        false
    -      case Some(latest) =>
    -        prevFileSize < latest.fileSize
    +    try {
    +      val attempt = getAttempt(appId, attemptId)
    +      val logPath = fs.makeQualified(new Path(logDir, attempt.logPath))
    +      recordedFileSize(logPath) > prevFileSize
    +    } catch {
    +      case _: NoSuchElementException => false
         }
       }
    +
    +  private def recordedFileSize(log: Path): Long = {
    +    try {
    +      listing.read(classOf[LogInfo], log.toString()).fileSize
    +    } catch {
    +      case _: NoSuchElementException => 0L
    +    }
    +  }
    +
    +  private def load(appId: String): ApplicationInfoWrapper = {
    +    listing.read(classOf[ApplicationInfoWrapper], appId)
    +  }
    +
    +  /**
    +   * Write the app's information to the given store. Serialized to avoid 
the (notedly rare) case
    +   * where two threads are processing separate attempts of the same 
application.
    +   */
    +  private def addListing(app: ApplicationInfoWrapper): Unit = 
listing.synchronized {
    +    val attempt = app.attempts.head
    +
    +    val oldApp = try {
    +      listing.read(classOf[ApplicationInfoWrapper], app.id)
    +    } catch {
    +      case _: NoSuchElementException =>
    +        app
    +    }
    +
    +    def compareAttemptInfo(a1: AttemptInfoWrapper, a2: 
AttemptInfoWrapper): Boolean = {
    +      a1.info.startTime.getTime() > a2.info.startTime.getTime()
    +    }
    +
    +    val attempts = oldApp.attempts.filter(_.info.attemptId != 
attempt.info.attemptId) ++
    +      List(attempt)
    +    val oldestAttempt = attempts.map(_.info.lastUpdated.getTime()).min
    --- End diff --
    
    Is this val used anywhere?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to