prakharjain09 commented on a change in pull request #27864: [SPARK-20732][CORE] 
Decommission cache blocks to other executors when an executor is decommissioned
URL: https://github.com/apache/spark/pull/27864#discussion_r404122141
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala
 ##########
 @@ -1706,6 +1706,89 @@ class BlockManagerSuite extends SparkFunSuite with 
Matchers with BeforeAndAfterE
     verify(liveListenerBus, 
never()).post(SparkListenerBlockUpdated(BlockUpdatedInfo(updateInfo)))
   }
 
+  test("test decommissioning block manager should not accept any new block 
directly " +
+    "or indirectly (via replication)") {
+    val store = makeBlockManager(2000, "exec1")
+    val store2 = makeBlockManager(2000, "exec2")
+
+    val data1 = new Array[Byte](400)
+    val block1 = rdd(0, 0)
+    store.putSingle(block1, data1, StorageLevel.DISK_ONLY_2)
+    assert(master.getLocations(block1).size === 2, "master did not report 2 
locations for a1")
+
+    store.decommissionBlockManager()
+    val data2 = new Array[Byte](400)
+    val block2 = rdd(0, 1)
+    intercept[Exception] {
+      store.putSingle(block2, data2, StorageLevel.DISK_ONLY_2)
+    }
+    assert(master.getLocations(block2).size === 0, "block manager accepted 
blocks even" +
+      " after decommissioning")
+
+    val data3 = new Array[Byte](400)
+    val block3 = rdd(0, 2)
+    store2.putSingle(block3, data3, StorageLevel.DISK_ONLY_2)
+    assert(master.getLocations(block3).size === 1)
+  }
+
+  test("test decommission block manager should not be part of peers") {
 
 Review comment:
   Yes. Updated the code. Added new test to specifically test this scenario in 
BlockManagerDecommissionSuite.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to