mridulm commented on code in PR #38467:
URL: https://github.com/apache/spark/pull/38467#discussion_r1013165931
##########
core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala:
##########
@@ -115,7 +119,9 @@ private[spark] class DiskBlockManager(
Files.setPosixFilePermissions(path, currentPerms)
}
}
- subDirs(dirId)(subDirId) = newDir
+ if (newDir.exists()) {
Review Comment:
Can we avoid multiple calls to `exists` ?
Something like:
```
val newDir = new File ...
val alreadyExists = newDir.exists()
if (!alreadyExists && needCreate) {
...
}
// If needCreate is set, exception is thrown if directory cannot be created.
if (alreadyExists || needCreate) {
subDirs(dirId) ...
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]