dongjoon-hyun commented on a change in pull request #29378:
URL: https://github.com/apache/spark/pull/29378#discussion_r467642033



##########
File path: core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
##########
@@ -81,17 +99,29 @@ private[spark] class DiskBlockManager(conf: SparkConf, 
deleteFilesOnStop: Boolea
     new File(subDir, filename)
   }
 
-  def getFile(blockId: BlockId): File = getFile(blockId.name)
+  /**
+   * Used only for testing.
+   */
+  private[spark] def getFile(filename: String): File =
+    getFile(localDirs, subDirs, subDirsPerLocalDir, filename)
+
+  def getFile(blockId: BlockId): File = {
+    if (containerDirEnabled && blockId.isTemp) {
+      getFile(containerDirs, subContainerDirs, subDirsPerLocalDir, 
blockId.name)
+    } else {
+      getFile(localDirs, subDirs, subDirsPerLocalDir, blockId.name)
+    }
+  }
 
   /** Check if disk block manager has a block. */
   def containsBlock(blockId: BlockId): Boolean = {
-    getFile(blockId.name).exists()

Review comment:
       Is this a performance optimization? I guess we can leave the original 
style because `def getFile(blockId: BlockId): File` still exist.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to