diff options
author | Kousuke Saruta <sarutak@oss.nttdata.co.jp> | 2014-07-14 23:55:39 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-07-14 23:55:39 -0700 |
commit | c6d75745de58ff1445912bf72a58b6ad2b3f863c (patch) | |
tree | 56c02b805ecac8f4e94986eafbdaf34abd294844 /core/src | |
parent | a2aa7bebae31e1e7ec23d31aaa436283743b283b (diff) | |
download | spark-c6d75745de58ff1445912bf72a58b6ad2b3f863c.tar.gz spark-c6d75745de58ff1445912bf72a58b6ad2b3f863c.tar.bz2 spark-c6d75745de58ff1445912bf72a58b6ad2b3f863c.zip |
[SPARK-2390] Files in staging directory cannot be deleted and wastes the space of HDFS
When running jobs with YARN Cluster mode and using HistoryServer, the files in the Staging Directory (~/.sparkStaging on HDFS) cannot be deleted.
HistoryServer uses directory where event log is written, and the directory is represented as a instance of o.a.h.f.FileSystem created by using FileSystem.get.
On the other hand, ApplicationMaster has a instance named fs, which also created by using FileSystem.get.
FileSystem.get returns cached same instance when URI passed to the method represents same file system and the method is called by same user.
Because of the behavior, when the directory for event log is on HDFS, fs of ApplicationMaster and fileSystem of FileLogger is same instance.
When shutting down ApplicationMaster, fileSystem.close is called in FileLogger#stop, which is invoked by SparkContext#stop indirectly.
And ApplicationMaster#cleanupStagingDir also called by JVM shutdown hook. In this method, fs.delete(stagingDirPath) is invoked.
Because fs.delete in ApplicationMaster is called after fileSystem.close in FileLogger, fs.delete fails and results not deleting files in the staging directory.
I think, calling fileSystem.delete is not needed.
Author: Kousuke Saruta <sarutak@oss.nttdata.co.jp>
Closes #1326 from sarutak/SPARK-2390 and squashes the following commits:
10e1a88 [Kousuke Saruta] Removed fileSystem.close from FileLogger.scala not to prevent any other FileSystem operation
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/FileLogger.scala | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/FileLogger.scala b/core/src/main/scala/org/apache/spark/util/FileLogger.scala index 6a95dc06e1..9dcdafdd63 100644 --- a/core/src/main/scala/org/apache/spark/util/FileLogger.scala +++ b/core/src/main/scala/org/apache/spark/util/FileLogger.scala @@ -196,6 +196,5 @@ private[spark] class FileLogger( def stop() { hadoopDataStream.foreach(_.close()) writer.foreach(_.close()) - fileSystem.close() } } |