Github user sryza commented on a diff in the pull request: https://github.com/apache/spark/pull/4020#discussion_r23057341 --- Diff: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala --- @@ -240,10 +284,18 @@ class ShuffleWriteMetrics extends Serializable { /** * Number of bytes written for the shuffle by this task */ - @volatile var shuffleBytesWritten: Long = _ - + @volatile private var _shuffleBytesWritten: Long = _ + def shuffleBytesWritten = _shuffleBytesWritten + private[spark] def incShuffleBytesWritten(value: Long) = _shuffleBytesWritten += value + private[spark] def decShuffleBytesWritten(value: Long) = _shuffleBytesWritten -= value + /** * Time the task spent blocking on writes to disk or buffer cache, in nanoseconds */ - @volatile var shuffleWriteTime: Long = _ --- End diff -- `_shuffleWriteTime` can only get incremented from a single thread. It's marked volatile so that other threads can read from it. Using an `AtomicLong` would unnecessarily bloat the size of the task results. I probably should have documented this access pattern better.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org