Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/1222#discussion_r15478371
--- Diff:
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
@@ -192,20 +236,50 @@ private[history] class FsHistoryProvider(conf:
SparkConf) extends ApplicationHis
(appInfo, ui)
}
- /** 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 loadOldLoggingInfo(dir: Path): EventLoggingInfo = {
+ val children = fs.listStatus(dir)
+ var eventLogPath: Path = null
+ var sparkVersion: String = null
+ var codecName: String = null
+ var applicationCompleted: Boolean = false
+
+ children.foreach(child => child.getPath().getName() match {
+ case name if name.startsWith(LOG_PREFIX) =>
+ eventLogPath = child.getPath()
+
+ case ver if ver.startsWith(SPARK_VERSION_PREFIX) =>
+ sparkVersion = ver.substring(SPARK_VERSION_PREFIX.length())
+
+ case codec if codec.startsWith(COMPRESSION_CODEC_PREFIX) =>
+ codecName = codec.substring(COMPRESSION_CODEC_PREFIX.length())
+
+ case complete if complete == APPLICATION_COMPLETE =>
+ applicationCompleted = true
+
+ case _ =>
+ })
--- End diff --
nit: could you format this as follows:
```
children.foreach { child =>
child.getPath.getName match {
case ...
case ...
...
}
}
```
---
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.
---