Skip to content

Commit c52010a

Browse files
committed
[SPARK-26094][CORE][STREAMING] createNonEcFile creates parent dirs.
We explicitly avoid files with hdfs erasure coding for the streaming WAL and for event logs, as hdfs EC does not support all relevant apis. However, the new builder api used has different semantics -- it does not create parent dirs, and it does not resolve relative paths. This updates createNonEcFile to have similar semantics to the old api.
1 parent 99cbc51 commit c52010a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,11 @@ object SparkHadoopUtil {
471471
try {
472472
// Use reflection as this uses apis only avialable in hadoop 3
473473
val builderMethod = fs.getClass().getMethod("createFile", classOf[Path])
474-
val builder = builderMethod.invoke(fs, path)
474+
// the builder api does not resolve relative paths, nor does it create parent dirs, while
475+
// the old api does.
476+
fs.mkdirs(path.getParent())
477+
val qualifiedPath = fs.makeQualified(path)
478+
val builder = builderMethod.invoke(fs, qualifiedPath)
475479
val builderCls = builder.getClass()
476480
// this may throw a NoSuchMethodException if the path is not on hdfs
477481
val replicateMethod = builderCls.getMethod("replicate")

0 commit comments

Comments
 (0)