Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6648#discussion_r32019406
  
    --- Diff: core/src/main/scala/org/apache/spark/shuffle/ShuffleManager.scala 
---
    @@ -62,4 +88,31 @@ private[spark] trait ShuffleManager {
     
       /** Shut down this ShuffleManager. */
       def stop(): Unit
    +
    +  private[this] val shuffleToAttempts = new ConcurrentHashMap[Int, 
ConcurrentHashMap[Int, Int]]()
    +
    +  /**
    +   * Register a stage attempt for the given shuffle, so we can clean up 
all attempts when
    +   * the shuffle is unregistered
    +   */
    +  protected def addShuffleAttempt(shuffleId: Int, stageAttemptId: Int): 
Unit = {
    +    shuffleToAttempts.putIfAbsent(shuffleId, new ConcurrentHashMap[Int, 
Int]())
    +    shuffleToAttempts.get(shuffleId).putIfAbsent(stageAttemptId, 
stageAttemptId)
    --- End diff --
    
    good point, `CopyOnWriteArraySet` makes more sense.
    
    this actually might get called concurrently for the same shuffle -- the 
shuffle manager is shared by all threads of an executor, and each shuffle map 
task will call this method.  (It is rare that this will get called concurrently 
with different `stageAttemptId`s.)  `CopyOnWriteArraySet` is a good fit, though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to