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

    https://github.com/apache/spark/pull/1507#discussion_r15238860
  
    --- Diff: 
core/src/main/scala/org/apache/spark/shuffle/hash/HashShuffleReader.scala ---
    @@ -35,8 +37,15 @@ class HashShuffleReader[K, C](
     
       /** Read the combined key-values for this reduce task */
       override def read(): Iterator[Product2[K, C]] = {
    +    val readMetrics = new ShuffleReadMetrics()
    +    context.taskMetrics.synchronized {
    +      if (context.taskMetrics.depsShuffleReadMetrics == null) {
    +        context.taskMetrics.depsShuffleReadMetrics = new 
ArrayBuffer[ShuffleReadMetrics]()
    +      }
    +      context.taskMetrics.depsShuffleReadMetrics += readMetrics
    +    }
    --- End diff --
    
    Can we make getNewShuffleReadMetrics() or something a function in 
TaskMetrics that does this?  I think it would be better to have TaskMetrics 
handle the synchronization, because it makes it more obvious to someone reading 
/ modifying the code later what the concurrency properties of 
depsShuffleReadMetrics are.


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

Reply via email to