Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,13 @@ class BlockManagerMasterEndpoint(
val blockIdsToDel = blocksToDeleteByShuffleService.getOrElseUpdate(bmIdForShuffleService,
new mutable.HashSet[RDDBlockId]())
blockIdsToDel += blockId
blockStatusByShuffleService.get(bmIdForShuffleService).foreach { blockStatus =>
blockStatus.remove(blockId)
blockStatusByShuffleService.get(bmIdForShuffleService).foreach { blockStatusForId =>
blockStatusForId.remove(blockId)
// when all blocks are removed from the block statuses then for this BM Id the whole
// blockStatusByShuffleService entry can be removed to avoid leaking memory
if (blockStatusForId.isEmpty) {
blockStatusByShuffleService.remove(bmIdForShuffleService)
}
}
}
}
Expand Down Expand Up @@ -309,6 +314,7 @@ class BlockManagerMasterEndpoint(

Future.sequence(removeRddFromExecutorsFutures ++ removeRddBlockViaExtShuffleServiceFutures)
}

private def removeShuffle(shuffleId: Int): Future[Seq[Boolean]] = {
// Nothing to do in the BlockManagerMasterEndpoint data structures
val removeMsg = RemoveShuffle(shuffleId)
Expand Down Expand Up @@ -665,7 +671,7 @@ class BlockManagerMasterEndpoint(
val locations = Option(blockLocations.get(blockId)).map(_.toSeq).getOrElse(Seq.empty)
val status = locations.headOption.flatMap { bmId =>
if (externalShuffleServiceRddFetchEnabled && bmId.port == externalShuffleServicePort) {
Option(blockStatusByShuffleService(bmId).get(blockId))
blockStatusByShuffleService.get(bmId).flatMap(m => Option(m.get(blockId)))
Copy link
Contributor Author

@attilapiros attilapiros Jun 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this PR blockStatusByShuffleService.get(bmId) can be None and even when it has some value for the key then even m.get(blockId) can be null as m is a Java HashMap.

} else {
aliveBlockManagerInfo(bmId).flatMap(_.getStatus(blockId))
}
Expand Down