Skip to content

Commit

Permalink
Modified Filelogger to use unique FileSystem instance
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Aug 15, 2014
1 parent fd9fcd2 commit e1262ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/src/main/scala/org/apache/spark/util/FileLogger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,20 @@ private[spark] class FileLogger(
override def initialValue(): SimpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
}

private val fileSystem = Utils.getHadoopFileSystem(logDir)
/**
* To avoid effects of FileSystem#close or FileSystem.closeAll called from other modules,
* create unique FileSystem instance only for FileLogger
*/
private val fileSystem = {
val conf = SparkHadoopUtil.get.newConfiguration()
val logUri = new URI(logDir)
val scheme = logUri.getScheme
if (scheme == "hdfs") {
conf.setBoolean("fs.hdfs.impl.disable.cache", true)
}
FileSystem.get(logUri, conf)
}

var fileIndex = 0

// Only used if compression is enabled
Expand Down

0 comments on commit e1262ec

Please sign in to comment.