Skip to content

Commit

Permalink
[SPARK-3062] [SPARK-2970] [SQL] spark-sql script ends with IOExceptio…
Browse files Browse the repository at this point in the history
…n when EventLogging is enabled

apache#1891 was to avoid IOException when EventLogging is enabled.
The solution used ShutdownHookManager but it was defined only Hadoop 2.x. Hadoop 1.x don't have ShutdownHookManager so apache#1891 doesn't compile on Hadoop 1.x

Now, I had a compromised solution for both Hadoop 1.x and 2.x.
Only for FileLogger, an unique FileSystem object is created.

Author: Kousuke Saruta <sarutak@oss.nttdata.co.jp>

Closes apache#1970 from sarutak/SPARK-2970 and squashes the following commits:

240c91e [Kousuke Saruta] Merge branch 'master' of git://git.apache.org/spark into SPARK-2970
0e7b45d [Kousuke Saruta] Revert "[SPARK-2970] [SQL] spark-sql script ends with IOException when EventLogging is enabled"
e1262ec [Kousuke Saruta] Modified Filelogger to use unique FileSystem instance
  • Loading branch information
sarutak authored and marmbrus committed Aug 20, 2014
1 parent cf46e72 commit 0ea46ac
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 0ea46ac

Please sign in to comment.