yikf commented on a change in pull request #31648:
URL: https://github.com/apache/spark/pull/31648#discussion_r582866333



##########
File path: 
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleManager.scala
##########
@@ -154,7 +154,7 @@ private[spark] class SortShuffleManager(conf: SparkConf) 
extends ShuffleManager
       metrics: ShuffleWriteMetricsReporter): ShuffleWriter[K, V] = {
     val mapTaskIds = taskIdMapsForShuffle.computeIfAbsent(
       handle.shuffleId, _ => new OpenHashSet[Long](16))
-    mapTaskIds.synchronized { mapTaskIds.add(context.taskAttemptId()) }

Review comment:
       For more convenient review:
   
   ShuffleMapTask#runTask
   `val mapId = if 
(SparkEnv.get.conf.get(config.SHUFFLE_USE_OLD_FETCH_PROTOCOL)) {
         partitionId
       } else context.taskAttemptId()`
   
   SortShuffleManager#getWriter
   `val mapTaskIds = taskIdMapsForShuffle.computeIfAbsent(
         handle.shuffleId, _ => new OpenHashSet[Long](16))
       mapTaskIds.synchronized { mapTaskIds.add(context.taskAttemptId()) }`
   
   SortShuffleManager#unregisterShuffle
   `Option(taskIdMapsForShuffle.remove(shuffleId)).foreach { mapTaskIds =>
         mapTaskIds.iterator.foreach { mapTaskId =>
           shuffleBlockResolver.removeDataByMap(shuffleId, mapTaskId)
         }
       }`
   




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

Reply via email to