gaborgsomogyi commented on a change in pull request #23764: [SPARK-26825][SS]
Fix temp checkpoint creation in cluster mode when default filesystem is not
local.
URL: https://github.com/apache/spark/pull/23764#discussion_r266355256
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryManager.scala
##########
@@ -222,12 +222,14 @@ class StreamingQueryManager private[sql] (sparkSession:
SparkSession) extends Lo
}.getOrElse {
if (useTempCheckpointLocation) {
deleteCheckpointOnStop = true
- val tempDir = Utils.createTempDir(namePrefix =
s"temporary").getCanonicalPath
+ val tempDir = System.getProperty("java.io.tmpdir")
+ val cpTempDir = new Path("file://" + tempDir + "/temporary-"
+ + UUID.randomUUID.toString).toString
Review comment:
> I'm not sure why Utils.createTempDir doesn't work here? What is the
problem with mkdir being called twice?
`Utils.createTempDir` would work but an optional fix not to do it twice. The
main problem is filesystem changes all of a sudden when default fs is not
local. Please see the added test.
> Also I'm not sure I understand why you're not using `.toUri`.
```
scala> import org.apache.hadoop.fs.Path
import org.apache.hadoop.fs.Path
scala> val f = new java.io.File("/tmp/chk %#chk")
f: java.io.File = /tmp/chk %#chk
scala> new Path(new Path(f.toURI()), "foo").toString
res0: String = file:/tmp/chk %#chk/foo
scala> new Path(new Path(f.toURI()), "foo").toUri.toString
res1: String = file:/tmp/chk%20%25%23chk/foo
```
I know it can happen rarely but since it's discovered and we know the
solution it's better to prepare the code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]