mridulm commented on a change in pull request #30164:
URL: https://github.com/apache/spark/pull/30164#discussion_r523237127
##########
File path:
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala
##########
@@ -657,6 +688,38 @@ class BlockManagerMasterEndpoint(
}
}
+ private def getShufflePushMergerLocations(
+ numMergersNeeded: Int,
+ hostsToFilter: Set[String]): Seq[BlockManagerId] = {
+ val blockManagersWithExecutors =
blockManagerIdByExecutor.groupBy(_._2.host)
+ .mapValues(_.head).values.map(_._2).toSet
+ val filteredBlockManagersWithExecutors = blockManagersWithExecutors
+ .filterNot(x => hostsToFilter.contains(x.host))
+ val filteredMergersWithExecutors = filteredBlockManagersWithExecutors.map(
+ x => BlockManagerId(x.executorId, x.host,
StorageUtils.externalShuffleServicePort(conf)))
+
+ // Enough mergers are available as part of active executors list
+ if (filteredMergersWithExecutors.size >= numMergersNeeded) {
+ filteredMergersWithExecutors.toSeq
+ } else {
+ // Delta mergers added from inactive mergers list to the active mergers
list
+ val filteredMergersWithExecutorsHosts =
filteredMergersWithExecutors.map(_.host)
+ // Pick random hosts instead of preferring the top of the list
+ val randomizedShuffleMergerLocations =
Utils.randomize(shuffleMergerLocations.values.toSeq)
Review comment:
If I am not wrong, @Ngone51's suggestion is following:
```
// remove randomizedShuffleMergerLocations
val filteredMergersWithoutExecutors = filteredMergersWithExecutorsHosts
.filterNot(x => hostsToFilter.contains(x.host))
.filterNot(x => filteredMergersWithExecutorsHosts.contains(x.host))
// We can skip randomize if filteredMergersWithoutExecutors.size <=
numMergersNeeded - filteredMergersWithExecutors.size
val randomizedFilteredLocations =
Utils.randomize(filteredMergersWithoutExecutors)
return filteredMergersWithExecutors.toSeq ++ randomizedFilteredLocations
.take(numMergersNeeded - filteredMergersWithExecutors.size)
```
----------------------------------------------------------------
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]