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

    https://github.com/apache/spark/pull/1222#discussion_r18535127
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -214,29 +231,64 @@ private[history] class FsHistoryProvider(conf: 
SparkConf) extends ApplicationHis
         }
       }
     
    -  private def createReplayBus(logDir: FileStatus): (ReplayListenerBus, 
ApplicationEventListener) = {
    -    val path = logDir.getPath()
    -    val elogInfo = EventLoggingListener.parseLoggingInfo(path, fs)
    -    val replayBus = new ReplayListenerBus(elogInfo.logPaths, fs, 
elogInfo.compressionCodec)
    -    val appListener = new ApplicationEventListener
    -    replayBus.addListener(appListener)
    -    (replayBus, appListener)
    +  private def replay(logPath: FileStatus, bus: ReplayListenerBus): 
ApplicationEventListener = {
    +    val (logInput, sparkVersion) =
    +      if (logPath.isDir()) {
    +        openOldLog(logPath.getPath())
    +      } else {
    +        EventLoggingListener.openEventLog(logPath.getPath(), fs)
    +      }
    +    try {
    +      val appListener = new ApplicationEventListener
    +      bus.addListener(appListener)
    +      bus.replay(logInput, sparkVersion)
    +      appListener
    +    } finally {
    +      logInput.close()
    +    }
       }
     
    -  /** Return when this directory was last modified. */
    -  private def getModificationTime(dir: FileStatus): Long = {
    -    try {
    -      val logFiles = fs.listStatus(dir.getPath)
    -      if (logFiles != null && !logFiles.isEmpty) {
    -        logFiles.map(_.getModificationTime).max
    -      } else {
    -        dir.getModificationTime
    +  /**
    +   * Load the app log information from a Spark 1.0.0 log directory, for 
backwards compatibility.
    +   * This assumes that the log directory contains a single event log file, 
which is the case for
    +   * directories generated by the code in that release.
    +   */
    +  private[history] def openOldLog(dir: Path): (InputStream, String) = {
    --- End diff --
    
    Why? EventLoggingListener nor any of its callers need to deal with legacy 
event logs.


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