Skip to content

Commit 5de7eb4

Browse files
committed
[SPARK-6313] Add config option to disable file locks/fetchFile cache to support NFS mounts
1 parent aa6536f commit 5de7eb4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ private[spark] object Utils extends Logging {
403403
useCache: Boolean) {
404404
val fileName = url.split("/").last
405405
val targetFile = new File(targetDir, fileName)
406-
if (useCache) {
406+
val fetchCacheEnabled = conf.getBoolean("spark.files.useFetchCache", defaultValue = true)
407+
if (useCache && fetchCacheEnabled) {
407408
val cachedFileName = s"${url.hashCode}${timestamp}_cache"
408409
val lockFileName = s"${url.hashCode}${timestamp}_lock"
409410
val localDir = new File(getLocalDir(conf))

docs/configuration.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,18 @@ Apart from these, the following properties are also available, and may be useful
745745
the driver, in seconds.
746746
</td>
747747
</tr>
748+
<tr>
749+
<td><code>spark.files.useFetchCache</code></td>
750+
<td>true</td>
751+
<td>
752+
If file fetching should use local caching. The improves performance when running multiple
753+
executors on the one host and is enabled by default (see
754+
<a href="https://issues.apache.org/jira/browse/SPARK-6313">SPARK-6313</a> for more details).
755+
When set to true (default) caching is enabled. When set to false, caching optimizations are
756+
switched off and no lock files are created, this allows fetchFiles store to reside on a NFS
757+
mount.
758+
</td>
759+
</tr>
748760
<tr>
749761
<td><code>spark.files.overwrite</code></td>
750762
<td>false</td>

0 commit comments

Comments
 (0)