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

    https://github.com/apache/spark/pull/15371#discussion_r82470766
  
    --- Diff: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala 
---
    @@ -344,15 +338,20 @@ private[spark] class BlockStatusesAccumulator
       override def add(v: (BlockId, BlockStatus)): Unit = _seq.add(v)
     
       override def merge(
    -    other: AccumulatorV2[(BlockId, BlockStatus), java.util.List[(BlockId, 
BlockStatus)]]): Unit = {
    +    other: AccumulatorV2[(BlockId, BlockStatus), List[(BlockId, 
BlockStatus)]]): Unit = {
         other match {
    -      case o: BlockStatusesAccumulator => _seq.addAll(o.value)
    +      case o: BlockStatusesAccumulator => o.value.foreach(_seq.add)
           case _ => throw new UnsupportedOperationException(
             s"Cannot merge ${this.getClass.getName} with 
${other.getClass.getName}")
         }
       }
     
    -  override def value: java.util.List[(BlockId, BlockStatus)] = _seq
    +  // `asScala` accesses the internal values using `java.util.Iterator` so 
needs to be synchronized
    +  override def value: List[(BlockId, BlockStatus)] = {
    +    _seq.synchronized {
    --- End diff --
    
    Regarding #2, I take a look at `CollectionAccumulator` as well and it seems 
like a good idea.  Let me give it a try.


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