dtarima commented on a change in pull request #33251:
URL: https://github.com/apache/spark/pull/33251#discussion_r667172347



##########
File path: core/src/main/scala/org/apache/spark/storage/BlockManager.scala
##########
@@ -255,7 +255,9 @@ private[spark] class BlockManager(
   // specified memory threshold. Files will be deleted automatically based on 
weak reference.
   // Exposed for test
   private[storage] val remoteBlockTempFileManager =
-    new BlockManager.RemoteBlockDownloadFileManager(this)
+    new BlockManager.RemoteBlockDownloadFileManager(

Review comment:
       The test was failing with `NullPointerException` cause the 
`SparkEnv.get` wasn't initialized.
   Considering that the `RemoteBlockDownloadFileManager` accepts an instance of 
`BlockManager` which already has `SecurityManager` it seemed logical to just 
pass the `encryptionKey` too so it didn't rely on the static env in the lazy 
val.
   
   As I understand the alternative would be to construct a mock environment and 
call the static `SparkEnv.set` and I see that this approach is taken in other 
places, but I do not understand how it works reliably without removing it after 
use - it's just left there. Hence I decided to remove the reliance on the 
static env so it's easier to test.




-- 
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]

Reply via email to