diff options
author | zuotingbing <zuo.tingbing9@zte.com.cn> | 2017-02-07 12:21:36 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2017-02-07 12:21:36 +0000 |
commit | 8fd178d2151da53c0edc7ed3a92ebd01780d7702 (patch) | |
tree | 6a8cc298b6bfd84e59bd538ff457198ea12b31dd /core | |
parent | aee2bd2c7ee97a58f0adec82ec52e5625b39e804 (diff) | |
download | spark-8fd178d2151da53c0edc7ed3a92ebd01780d7702.tar.gz spark-8fd178d2151da53c0edc7ed3a92ebd01780d7702.tar.bz2 spark-8fd178d2151da53c0edc7ed3a92ebd01780d7702.zip |
[SPARK-19260] Spaces or "%20" in path parameter are not correctly handled with…
JIRA Issue: https://issues.apache.org/jira/browse/SPARK-19260
## What changes were proposed in this pull request?
1. “spark.history.fs.logDirectory” supports with space character and “%20” characters.
2. As usually, if the run classpath includes hdfs-site.xml and core-site.xml files, the supplied path eg."/test" which does not contain a scheme should be taken as a HDFS path rather than a local path since the path parameter is a Hadoop dir.
## How was this patch tested?
Update Unit Test and take some manual tests
local:
.sbin/start-history-server.sh "file:/a b"
.sbin/start-history-server.sh "/abc%20c" (without hdfs-site.xml,core-site.xml)
.sbin/start-history-server.sh "/a b" (without hdfs-site.xml,core-site.xml)
.sbin/start-history-server.sh "/a b/a bc%20c" (without hdfs-site.xml,core-site.xml)
hdfs:
.sbin/start-history-server.sh "hdfs:/namenode:9000/a b"
.sbin/start-history-server.sh "/a b" (with hdfs-site.xml,core-site.xml)
.sbin/start-history-server.sh "/a b/a bc%20c" (with hdfs-site.xml,core-site.xml)
Author: zuotingbing <zuo.tingbing9@zte.com.cn>
Closes #16614 from zuotingbing/SPARK-19260.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala | 3 | ||||
-rw-r--r-- | core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala index cd241d6d22..9012736bc2 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala @@ -94,7 +94,6 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) Math.ceil(Runtime.getRuntime.availableProcessors() / 4f).toInt) private val logDir = conf.getOption("spark.history.fs.logDirectory") - .map { d => Utils.resolveURI(d).toString } .getOrElse(DEFAULT_LOG_DIR) private val HISTORY_UI_ACLS_ENABLE = conf.getBoolean("spark.history.ui.acls.enable", false) @@ -105,7 +104,7 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) "; groups with admin permissions" + HISTORY_UI_ADMIN_ACLS_GROUPS.toString) private val hadoopConf = SparkHadoopUtil.get.newConfiguration(conf) - private val fs = Utils.getHadoopFileSystem(logDir, hadoopConf) + private val fs = new Path(logDir).getFileSystem(hadoopConf) // Used by check event thread and clean log thread. // Scheduled thread pool size must be one, otherwise it will have concurrent issues about fs diff --git a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala index 8cb359ed45..ec580a44b8 100644 --- a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala +++ b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala @@ -47,7 +47,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc private var testDir: File = null before { - testDir = Utils.createTempDir() + testDir = Utils.createTempDir(namePrefix = s"a b%20c+d") } after { |