Skip to content

Commit

Permalink
[SPARK-26094][CORE][STREAMING] createNonEcFile creates parent dirs.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
squito committed Nov 16, 2018
1 parent 99cbc51 commit c52010a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ object SparkHadoopUtil {
try {
// Use reflection as this uses apis only avialable in hadoop 3
val builderMethod = fs.getClass().getMethod("createFile", classOf[Path])
val builder = builderMethod.invoke(fs, path)
// the builder api does not resolve relative paths, nor does it create parent dirs, while
// the old api does.
fs.mkdirs(path.getParent())
val qualifiedPath = fs.makeQualified(path)
val builder = builderMethod.invoke(fs, qualifiedPath)
val builderCls = builder.getClass()
// this may throw a NoSuchMethodException if the path is not on hdfs
val replicateMethod = builderCls.getMethod("replicate")
Expand Down

0 comments on commit c52010a

Please sign in to comment.