{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/30115034","id":30115034,"diff_hunk":"@@ -95,8 +94,23 @@ private[spark] class TachyonBlockManager() extends ExternalBlockManager with Log\n   override def putBytes(blockId: BlockId, bytes: ByteBuffer): Unit = {\n     val file = getFile(blockId)\n     val os = file.getOutStream(WriteType.TRY_CACHE)\n-    os.write(bytes.array())\n-    os.close()\n+    try {\n+      os.write(bytes.array())\n+      os.close()","path":"core/src/main/scala/org/apache/spark/storage/TachyonBlockManager.scala","position":25,"original_position":25,"commit_id":"ac2aed36afea19476f78613ee7fff8825d32159a","original_commit_id":"219e8197277c288be83edfb64350dccdb01a1441","user":{"login":"shimingfei","id":2638130,"avatar_url":"https://avatars.githubusercontent.com/u/2638130?v=3","gravatar_id":"","url":"https://api.github.com/users/shimingfei","html_url":"https://github.com/shimingfei","followers_url":"https://api.github.com/users/shimingfei/followers","following_url":"https://api.github.com/users/shimingfei/following{/other_user}","gists_url":"https://api.github.com/users/shimingfei/gists{/gist_id}","starred_url":"https://api.github.com/users/shimingfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimingfei/subscriptions","organizations_url":"https://api.github.com/users/shimingfei/orgs","repos_url":"https://api.github.com/users/shimingfei/repos","events_url":"https://api.github.com/users/shimingfei/events{/privacy}","received_events_url":"https://api.github.com/users/shimingfei/received_events","type":"User","site_admin":false},"body":"The logic here is that: if any exception happens in write() or close(),  cancel the block file. And current code is able to cache all exceptions.\r\nThe OutStream is realized in Tachyon, not common OutStream in Java.","created_at":"2015-05-12T08:48:00Z","updated_at":"2015-05-12T08:48:00Z","html_url":"https://github.com/apache/spark/pull/5908#discussion_r30115034","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/5908","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/30115034"},"html":{"href":"https://github.com/apache/spark/pull/5908#discussion_r30115034"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/5908"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5908","id":34710372,"html_url":"https://github.com/apache/spark/pull/5908","diff_url":"https://github.com/apache/spark/pull/5908.diff","patch_url":"https://github.com/apache/spark/pull/5908.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/5908","number":5908,"state":"open","locked":false,"title":"[SPARK-7389] [core]Tachyon integration improvement","user":{"login":"shimingfei","id":2638130,"avatar_url":"https://avatars.githubusercontent.com/u/2638130?v=3","gravatar_id":"","url":"https://api.github.com/users/shimingfei","html_url":"https://github.com/shimingfei","followers_url":"https://api.github.com/users/shimingfei/followers","following_url":"https://api.github.com/users/shimingfei/following{/other_user}","gists_url":"https://api.github.com/users/shimingfei/gists{/gist_id}","starred_url":"https://api.github.com/users/shimingfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimingfei/subscriptions","organizations_url":"https://api.github.com/users/shimingfei/orgs","repos_url":"https://api.github.com/users/shimingfei/repos","events_url":"https://api.github.com/users/shimingfei/events{/privacy}","received_events_url":"https://api.github.com/users/shimingfei/received_events","type":"User","site_admin":false},"body":"Two main changes:\r\n\r\nAdd two functions in ExternalBlockManager, which are putValues and getValues\r\nbecause the implementation may not rely on the putBytes and getBytes\r\n\r\nimprove Tachyon integration.\r\nCurrently, when putting data into Tachyon, Spark first serialize all data in one partition into a ByteBuffer, and then write into Tachyon, this will uses much memory and increase GC overhead\r\n\r\nwhen get data from Tachyon, getValues depends on getBytes, which also read all data into On heap byte arry, and result in much memory usage.\r\nThis PR changes the approach of the two functions, make them read / write data by stream to reduce memory usage.\r\n\r\nIn our testing,  when data size is huge, this patch reduces about 30% GC time and 70% full GC time, and total execution time reduces about 10% \r\n\r\n","created_at":"2015-05-05T10:06:33Z","updated_at":"2015-05-12T08:48:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"639686c339d771f58a79f0d50078f5d2b3ec418f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/5908/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/5908/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/5908/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/ac2aed36afea19476f78613ee7fff8825d32159a","head":{"label":"shimingfei:Tachyon-integration-rebase","ref":"Tachyon-integration-rebase","sha":"ac2aed36afea19476f78613ee7fff8825d32159a","user":{"login":"shimingfei","id":2638130,"avatar_url":"https://avatars.githubusercontent.com/u/2638130?v=3","gravatar_id":"","url":"https://api.github.com/users/shimingfei","html_url":"https://github.com/shimingfei","followers_url":"https://api.github.com/users/shimingfei/followers","following_url":"https://api.github.com/users/shimingfei/following{/other_user}","gists_url":"https://api.github.com/users/shimingfei/gists{/gist_id}","starred_url":"https://api.github.com/users/shimingfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimingfei/subscriptions","organizations_url":"https://api.github.com/users/shimingfei/orgs","repos_url":"https://api.github.com/users/shimingfei/repos","events_url":"https://api.github.com/users/shimingfei/events{/privacy}","received_events_url":"https://api.github.com/users/shimingfei/received_events","type":"User","site_admin":false},"repo":{"id":26702942,"name":"spark","full_name":"shimingfei/spark","owner":{"login":"shimingfei","id":2638130,"avatar_url":"https://avatars.githubusercontent.com/u/2638130?v=3","gravatar_id":"","url":"https://api.github.com/users/shimingfei","html_url":"https://github.com/shimingfei","followers_url":"https://api.github.com/users/shimingfei/followers","following_url":"https://api.github.com/users/shimingfei/following{/other_user}","gists_url":"https://api.github.com/users/shimingfei/gists{/gist_id}","starred_url":"https://api.github.com/users/shimingfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimingfei/subscriptions","organizations_url":"https://api.github.com/users/shimingfei/orgs","repos_url":"https://api.github.com/users/shimingfei/repos","events_url":"https://api.github.com/users/shimingfei/events{/privacy}","received_events_url":"https://api.github.com/users/shimingfei/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shimingfei/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/shimingfei/spark","forks_url":"https://api.github.com/repos/shimingfei/spark/forks","keys_url":"https://api.github.com/repos/shimingfei/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shimingfei/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shimingfei/spark/teams","hooks_url":"https://api.github.com/repos/shimingfei/spark/hooks","issue_events_url":"https://api.github.com/repos/shimingfei/spark/issues/events{/number}","events_url":"https://api.github.com/repos/shimingfei/spark/events","assignees_url":"https://api.github.com/repos/shimingfei/spark/assignees{/user}","branches_url":"https://api.github.com/repos/shimingfei/spark/branches{/branch}","tags_url":"https://api.github.com/repos/shimingfei/spark/tags","blobs_url":"https://api.github.com/repos/shimingfei/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shimingfei/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shimingfei/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/shimingfei/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shimingfei/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/shimingfei/spark/languages","stargazers_url":"https://api.github.com/repos/shimingfei/spark/stargazers","contributors_url":"https://api.github.com/repos/shimingfei/spark/contributors","subscribers_url":"https://api.github.com/repos/shimingfei/spark/subscribers","subscription_url":"https://api.github.com/repos/shimingfei/spark/subscription","commits_url":"https://api.github.com/repos/shimingfei/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/shimingfei/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/shimingfei/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/shimingfei/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/shimingfei/spark/contents/{+path}","compare_url":"https://api.github.com/repos/shimingfei/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shimingfei/spark/merges","archive_url":"https://api.github.com/repos/shimingfei/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shimingfei/spark/downloads","issues_url":"https://api.github.com/repos/shimingfei/spark/issues{/number}","pulls_url":"https://api.github.com/repos/shimingfei/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/shimingfei/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/shimingfei/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shimingfei/spark/labels{/name}","releases_url":"https://api.github.com/repos/shimingfei/spark/releases{/id}","created_at":"2014-11-16T03:52:08Z","updated_at":"2014-11-16T04:01:04Z","pushed_at":"2015-05-12T02:38:46Z","git_url":"git://github.com/shimingfei/spark.git","ssh_url":"git@github.com:shimingfei/spark.git","clone_url":"https://github.com/shimingfei/spark.git","svn_url":"https://github.com/shimingfei/spark","homepage":null,"size":100577,"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":"a4669443999dc13a1bb34509c827d8b9096ea84f","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-05-12T06:50:56Z","pushed_at":"2015-05-12T08:43:27Z","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":1652436,"stargazers_count":3931,"watchers_count":3931,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3457,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":303,"forks":3457,"open_issues":303,"watchers":3931,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/5908"},"html":{"href":"https://github.com/apache/spark/pull/5908"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/5908"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/5908/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/5908/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/5908/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/ac2aed36afea19476f78613ee7fff8825d32159a"}}}}