Skip to content

Commit e1d839e

Browse files
Christophe PréaudJoshRosen
Christophe Préaud
authored andcommitted
[SPARK-4764] Ensure that files are fetched atomically
tempFile is created in the same directory than targetFile, so that the move from tempFile to targetFile is always atomic Author: Christophe Préaud <christophe.preaud@kelkoo.com> Closes #2855 from preaudc/master and squashes the following commits: 9ba89ca [Christophe Préaud] Ensure that files are fetched atomically 54419ae [Christophe Préaud] Merge remote-tracking branch 'upstream/master' c6a5590 [Christophe Préaud] Revert commit 8ea871f 7456a33 [Christophe Préaud] Merge remote-tracking branch 'upstream/master' 8ea871f [Christophe Préaud] Ensure that files are fetched atomically (cherry picked from commit ab2abcb) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
1 parent 2f00a29 commit e1d839e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ private[spark] object Utils extends Logging {
425425
conf: SparkConf,
426426
securityMgr: SecurityManager,
427427
hadoopConf: Configuration) {
428-
val tempDir = getLocalDir(conf)
429-
val tempFile = File.createTempFile("fetchFileTemp", null, new File(tempDir))
428+
val tempFile = File.createTempFile("fetchFileTemp", null, new File(targetDir.getAbsolutePath))
430429
val targetFile = new File(targetDir, filename)
431430
val uri = new URI(url)
432431
val fileOverwrite = conf.getBoolean("spark.files.overwrite", defaultValue = false)

0 commit comments

Comments
 (0)