Skip to content

Commit e1262ec

Browse files
committed
Modified Filelogger to use unique FileSystem instance
1 parent fd9fcd2 commit e1262ec

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

core/src/main/scala/org/apache/spark/util/FileLogger.scala

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,20 @@ private[spark] class FileLogger(
5252
override def initialValue(): SimpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
5353
}
5454

55-
private val fileSystem = Utils.getHadoopFileSystem(logDir)
55+
/**
56+
* To avoid effects of FileSystem#close or FileSystem.closeAll called from other modules,
57+
* create unique FileSystem instance only for FileLogger
58+
*/
59+
private val fileSystem = {
60+
val conf = SparkHadoopUtil.get.newConfiguration()
61+
val logUri = new URI(logDir)
62+
val scheme = logUri.getScheme
63+
if (scheme == "hdfs") {
64+
conf.setBoolean("fs.hdfs.impl.disable.cache", true)
65+
}
66+
FileSystem.get(logUri, conf)
67+
}
68+
5669
var fileIndex = 0
5770

5871
// Only used if compression is enabled

0 commit comments

Comments
 (0)