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

    https://github.com/apache/spark/pull/2471#discussion_r18737439
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -145,43 +186,48 @@ private[history] class FsHistoryProvider(conf: 
SparkConf) extends ApplicationHis
       private def checkForLogs() = {
         lastLogCheckTimeMs = getMonotonicTimeMs()
         logDebug("Checking for logs. Time is now 
%d.".format(lastLogCheckTimeMs))
    -    try {
    -      val logStatus = fs.listStatus(new Path(resolvedLogDir))
    -      val logDirs = if (logStatus != null) logStatus.filter(_.isDir).toSeq 
else Seq[FileStatus]()
    +    var logInfos: Seq[FsApplicationHistoryInfo] = null
     
    -      // Load all new logs from the log directory. Only directories that 
have a modification time
    -      // later than the last known log directory will be loaded.
    -      var newLastModifiedTime = lastModifiedTime
    -      val logInfos = logDirs
    -        .filter { dir =>
    -          if (fs.isFile(new Path(dir.getPath(), 
EventLoggingListener.APPLICATION_COMPLETE))) {
    -            val modTime = getModificationTime(dir)
    -            newLastModifiedTime = math.max(newLastModifiedTime, modTime)
    -            modTime > lastModifiedTime
    -          } else {
    -            false
    +    // Load all new logs from the log directory. Only directories that 
have a modification time
    +    // later than the last known log directory will be loaded.
    +    var newLastModifiedTime = lastModifiedTime
    +    
    +    try {
    +      fs.synchronized {
    --- End diff --
    
    What's this synchronization trying to achieve?
    
    If there's really a need for the two tasks to never run concurrently, I'd 
say it's better to use a `ScheduledExecutorService` with a single worker thread.


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