dongjoon-hyun commented on a change in pull request #30046:
URL: https://github.com/apache/spark/pull/30046#discussion_r505163764
##########
File path:
core/src/test/scala/org/apache/spark/storage/BlockManagerDecommissionUnitSuite.scala
##########
@@ -161,7 +167,79 @@ class BlockManagerDecommissionUnitSuite extends
SparkFunSuite with Matchers {
.thenReturn(Seq(BlockManagerId("exec2", "host2", 12345)))
// Verify the decom manager handles this correctly
- validateDecommissionTimestamps(sparkConf, bm,
migratableShuffleBlockResolver)
+ validateDecommissionTimestamps(sparkConf, bm)
+ }
+
+ test("block decom manager does not re-add removed shuffle files") {
+ // Set up the mocks so we return one shuffle block
+ val bm = mock(classOf[BlockManager])
+ val migratableShuffleBlockResolver = mock(classOf[MigratableResolver])
+ registerShuffleBlocks(migratableShuffleBlockResolver, Set())
+ when(bm.migratableResolver).thenReturn(migratableShuffleBlockResolver)
+ when(bm.getMigratableRDDBlocks())
+ .thenReturn(Seq())
+ when(bm.getPeers(mc.any()))
+ .thenReturn(Seq(BlockManagerId("exec2", "host2", 12345)))
+ val bmDecomManager = new BlockManagerDecommissioner(sparkConf, bm)
+ bmDecomManager.migratingShuffles += ShuffleBlockInfo(10, 10)
+
+ validateDecommissionTimestampsOnManager(bmDecomManager)
+ }
+
+ test("block decom manager handles IO failures") {
+ // Set up the mocks so we return one shuffle block
+ val bm = mock(classOf[BlockManager])
+ val migratableShuffleBlockResolver = mock(classOf[MigratableResolver])
+ registerShuffleBlocks(migratableShuffleBlockResolver, Set((1, 1L, 1)))
+ when(bm.migratableResolver).thenReturn(migratableShuffleBlockResolver)
+ when(bm.getMigratableRDDBlocks())
+ .thenReturn(Seq())
+ when(bm.getPeers(mc.any()))
+ .thenReturn(Seq(BlockManagerId("exec2", "host2", 12345)))
+
+ val blockTransferService = mock(classOf[BlockTransferService])
+ // Simulate an ambiguous IO error (e.g. block could be gone, connection
failed, etc.)
+ when(blockTransferService.uploadBlockSync(
+ mc.any(), mc.any(), mc.any(), mc.any(), mc.any(), mc.any(),
mc.isNull())).thenThrow(
+ new java.io.IOException("boop")
+ )
+
+ when(bm.blockTransferService).thenReturn(blockTransferService)
+
+ // Verify the decom manager handles this correctly
+ val bmDecomManager = new BlockManagerDecommissioner(sparkConf, bm)
+ validateDecommissionTimestampsOnManager(bmDecomManager, fail = false)
+ }
+
+ test("block decom manager short circuits removed blocks") {
+ // Set up the mocks so we return one shuffle block
+ val bm = mock(classOf[BlockManager])
+ val migratableShuffleBlockResolver = mock(classOf[MigratableResolver])
+ // First call get blocks, then empty list simulating a delete.
+ when(migratableShuffleBlockResolver.getMigrationBlocks(mc.any()))
+ .thenReturn(List(
+ (ShuffleIndexBlockId(1, 1, 1), mock(classOf[ManagedBuffer])),
+ (ShuffleDataBlockId(1, 1, 1), mock(classOf[ManagedBuffer]))))
+ .thenReturn(List())
+
+ when(bm.migratableResolver).thenReturn(migratableShuffleBlockResolver)
+ when(bm.getMigratableRDDBlocks())
+ .thenReturn(Seq())
+ when(bm.getPeers(mc.any()))
+ .thenReturn(Seq(BlockManagerId("exec2", "host2", 12345)))
+
+ val blockTransferService = mock(classOf[BlockTransferService])
+ // Simulate an ambiguous IO error (e.g. block could be gone, connection
failed, etc.)
+ when(blockTransferService.uploadBlockSync(
+ mc.any(), mc.any(), mc.any(), mc.any(), mc.any(), mc.any(),
mc.isNull())).thenThrow(
+ new java.io.IOException("boop")
+ )
+
+ when(bm.blockTransferService).thenReturn(blockTransferService)
+
+ // Verify the decom manager handles this correctly
+ val bmDecomManager = new BlockManagerDecommissioner(sparkConf, bm)
+ validateDecommissionTimestampsOnManager(bmDecomManager, fail = false,
numShuffles=Some(1))
Review comment:
Could you fix the scalastyle to run CI?
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]