{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/23058543","id":23058543,"diff_hunk":"@@ -240,10 +284,18 @@ class ShuffleWriteMetrics extends Serializable {\n   /**\n    * Number of bytes written for the shuffle by this task\n    */\n-  @volatile var shuffleBytesWritten: Long = _\n-\n+  @volatile private var _shuffleBytesWritten: Long = _\n+  def shuffleBytesWritten = _shuffleBytesWritten\n+  private[spark] def incShuffleBytesWritten(value: Long) = _shuffleBytesWritten += value\n+  private[spark] def decShuffleBytesWritten(value: Long) = _shuffleBytesWritten -= value\n+  \n   /**\n    * Time the task spent blocking on writes to disk or buffer cache, in nanoseconds\n    */\n-  @volatile var shuffleWriteTime: Long = _","path":"core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala","position":188,"original_position":188,"commit_id":"e446287b866eedeb74e68c2f800acf29250d2a76","original_commit_id":"e446287b866eedeb74e68c2f800acf29250d2a76","user":{"login":"ksakellis","id":6590087,"avatar_url":"https://avatars.githubusercontent.com/u/6590087?v=3","gravatar_id":"","url":"https://api.github.com/users/ksakellis","html_url":"https://github.com/ksakellis","followers_url":"https://api.github.com/users/ksakellis/followers","following_url":"https://api.github.com/users/ksakellis/following{/other_user}","gists_url":"https://api.github.com/users/ksakellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ksakellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksakellis/subscriptions","organizations_url":"https://api.github.com/users/ksakellis/orgs","repos_url":"https://api.github.com/users/ksakellis/repos","events_url":"https://api.github.com/users/ksakellis/events{/privacy}","received_events_url":"https://api.github.com/users/ksakellis/received_events","type":"User","site_admin":false},"body":"Fair enough, but it is hard to guarantee that only one thread will increment the value. We could mark the class as not thread safe by docs but it might be a ticking time bomb. Is the overhead of AtomicLong that concerning to risk concurrency issues down the line?\r\n\r\nSpeaking of shuffleMetrics, can we get rid of the array of shuffleReadMetrics (depsShuffleReadMetrics) and the merge step in favor of using AtomicLongs in ShuffleReadMetrics? That way the TaskMetrics can just return the same threadsafe ShuffleReadMetrics to the tasks and there wouldn't need to be a need to call updateShuffleReadMetrics periodically in the Executor heartbeat code.","created_at":"2015-01-16T01:38:26Z","updated_at":"2015-01-16T01:38:26Z","html_url":"https://github.com/apache/spark/pull/4020#discussion_r23058543","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/4020","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/23058543"},"html":{"href":"https://github.com/apache/spark/pull/4020#discussion_r23058543"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/4020"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/4020","id":27290063,"html_url":"https://github.com/apache/spark/pull/4020","diff_url":"https://github.com/apache/spark/pull/4020.diff","patch_url":"https://github.com/apache/spark/pull/4020.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/4020","number":4020,"state":"open","locked":false,"title":"[SPARK-3288] All fields in TaskMetrics should be private and use getters/setters","user":{"login":"ilganeli","id":1483345,"avatar_url":"https://avatars.githubusercontent.com/u/1483345?v=3","gravatar_id":"","url":"https://api.github.com/users/ilganeli","html_url":"https://github.com/ilganeli","followers_url":"https://api.github.com/users/ilganeli/followers","following_url":"https://api.github.com/users/ilganeli/following{/other_user}","gists_url":"https://api.github.com/users/ilganeli/gists{/gist_id}","starred_url":"https://api.github.com/users/ilganeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilganeli/subscriptions","organizations_url":"https://api.github.com/users/ilganeli/orgs","repos_url":"https://api.github.com/users/ilganeli/repos","events_url":"https://api.github.com/users/ilganeli/events{/privacy}","received_events_url":"https://api.github.com/users/ilganeli/received_events","type":"User","site_admin":false},"body":"I've updated the fields and all usages of these fields in the Spark code. I've verified that this did not break anything on my local repo. ","created_at":"2015-01-13T17:49:09Z","updated_at":"2015-01-16T01:38:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"865b4b752fdc14012f94f3faa802f1fffaebcbdc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/4020/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/4020/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments/{number}","comments_url":"https://api.github.com/repos/apache/spark/issues/4020/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/e446287b866eedeb74e68c2f800acf29250d2a76","head":{"label":"ilganeli:SPARK-3288","ref":"SPARK-3288","sha":"e446287b866eedeb74e68c2f800acf29250d2a76","user":{"login":"ilganeli","id":1483345,"avatar_url":"https://avatars.githubusercontent.com/u/1483345?v=3","gravatar_id":"","url":"https://api.github.com/users/ilganeli","html_url":"https://github.com/ilganeli","followers_url":"https://api.github.com/users/ilganeli/followers","following_url":"https://api.github.com/users/ilganeli/following{/other_user}","gists_url":"https://api.github.com/users/ilganeli/gists{/gist_id}","starred_url":"https://api.github.com/users/ilganeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilganeli/subscriptions","organizations_url":"https://api.github.com/users/ilganeli/orgs","repos_url":"https://api.github.com/users/ilganeli/repos","events_url":"https://api.github.com/users/ilganeli/events{/privacy}","received_events_url":"https://api.github.com/users/ilganeli/received_events","type":"User","site_admin":false},"repo":{"id":24374828,"name":"spark","full_name":"ilganeli/spark","owner":{"login":"ilganeli","id":1483345,"avatar_url":"https://avatars.githubusercontent.com/u/1483345?v=3","gravatar_id":"","url":"https://api.github.com/users/ilganeli","html_url":"https://github.com/ilganeli","followers_url":"https://api.github.com/users/ilganeli/followers","following_url":"https://api.github.com/users/ilganeli/following{/other_user}","gists_url":"https://api.github.com/users/ilganeli/gists{/gist_id}","starred_url":"https://api.github.com/users/ilganeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilganeli/subscriptions","organizations_url":"https://api.github.com/users/ilganeli/orgs","repos_url":"https://api.github.com/users/ilganeli/repos","events_url":"https://api.github.com/users/ilganeli/events{/privacy}","received_events_url":"https://api.github.com/users/ilganeli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ilganeli/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/ilganeli/spark","forks_url":"https://api.github.com/repos/ilganeli/spark/forks","keys_url":"https://api.github.com/repos/ilganeli/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ilganeli/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ilganeli/spark/teams","hooks_url":"https://api.github.com/repos/ilganeli/spark/hooks","issue_events_url":"https://api.github.com/repos/ilganeli/spark/issues/events{/number}","events_url":"https://api.github.com/repos/ilganeli/spark/events","assignees_url":"https://api.github.com/repos/ilganeli/spark/assignees{/user}","branches_url":"https://api.github.com/repos/ilganeli/spark/branches{/branch}","tags_url":"https://api.github.com/repos/ilganeli/spark/tags","blobs_url":"https://api.github.com/repos/ilganeli/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ilganeli/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ilganeli/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/ilganeli/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ilganeli/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/ilganeli/spark/languages","stargazers_url":"https://api.github.com/repos/ilganeli/spark/stargazers","contributors_url":"https://api.github.com/repos/ilganeli/spark/contributors","subscribers_url":"https://api.github.com/repos/ilganeli/spark/subscribers","subscription_url":"https://api.github.com/repos/ilganeli/spark/subscription","commits_url":"https://api.github.com/repos/ilganeli/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/ilganeli/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/ilganeli/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/ilganeli/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/ilganeli/spark/contents/{+path}","compare_url":"https://api.github.com/repos/ilganeli/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ilganeli/spark/merges","archive_url":"https://api.github.com/repos/ilganeli/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ilganeli/spark/downloads","issues_url":"https://api.github.com/repos/ilganeli/spark/issues{/number}","pulls_url":"https://api.github.com/repos/ilganeli/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/ilganeli/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/ilganeli/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ilganeli/spark/labels{/name}","releases_url":"https://api.github.com/repos/ilganeli/spark/releases{/id}","created_at":"2014-09-23T14:30:54Z","updated_at":"2014-12-17T18:17:41Z","pushed_at":"2015-01-16T01:06:06Z","git_url":"git://github.com/ilganeli/spark.git","ssh_url":"git@github.com:ilganeli/spark.git","clone_url":"https://github.com/ilganeli/spark.git","svn_url":"https://github.com/ilganeli/spark","homepage":null,"size":87355,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"1881431dd50e93a6948e4966d33742727f27e917","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-01-16T01:08:04Z","pushed_at":"2015-01-16T01:08:04Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1143317,"stargazers_count":2569,"watchers_count":2569,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2273,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":310,"forks":2273,"open_issues":310,"watchers":2569,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/4020"},"html":{"href":"https://github.com/apache/spark/pull/4020"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/4020"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/4020/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/4020/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/4020/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/e446287b866eedeb74e68c2f800acf29250d2a76"}}}}