{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/177222641","pull_request_review_id":107059269,"id":177222641,"diff_hunk":"@@ -246,6 +251,38 @@ class BlockManagerMasterEndpoint(\n     blockManagerIdByExecutor.get(execId).foreach(removeBlockManager)\n   }\n \n+  private def recoverLatestRDDBlock(\n+      execId: String,\n+      excludeExecutors: Seq[String],\n+      context: RpcCallContext): Unit = {\n+    logDebug(s\"Replicating first cached block on $execId\")\n+    val excluded = excludeExecutors.flatMap(blockManagerIdByExecutor.get)\n+    val response: Option[Future[Boolean]] = for {\n+      blockManagerId <- blockManagerIdByExecutor.get(execId)\n+      info <- blockManagerInfo.get(blockManagerId)\n+      blocks = info.cachedBlocks.collect { case r: RDDBlockId => r }\n+      // we assume blocks from the latest rdd are most relevant\n+      firstBlock <- if (blocks.isEmpty) None else Some(blocks.max[RDDBlockId](Ordering.by(_.rddId)))\n+      replicaSet <- blockLocations.asScala.get(firstBlock)\n+      // Add 2 below because you need the number of replicas, plus one for the original, plus one\n+      // for the new replica.\n+      maxReps = replicaSet.size + 2","path":"core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala","position":null,"original_position":47,"commit_id":"c4e9a80b5fba5bcd06c63c71bbfeee080c8580dc","original_commit_id":"f637f4164ac341c56c163d9051889b61aea6255b","user":{"login":"brad-kaiser","id":15015399,"avatar_url":"https://avatars2.githubusercontent.com/u/15015399?v=4","gravatar_id":"","url":"https://api.github.com/users/brad-kaiser","html_url":"https://github.com/brad-kaiser","followers_url":"https://api.github.com/users/brad-kaiser/followers","following_url":"https://api.github.com/users/brad-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/brad-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-kaiser/subscriptions","organizations_url":"https://api.github.com/users/brad-kaiser/orgs","repos_url":"https://api.github.com/users/brad-kaiser/repos","events_url":"https://api.github.com/users/brad-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/brad-kaiser/received_events","type":"User","site_admin":false},"body":"Oh, you're right it does already include the original. TBH blockManager.replicate subtracts one from the number i put here and I'm not sure what the logic is behind that. I have updated the comment to reflect that we have to add 2 to get a replica on one new executor.","created_at":"2018-03-26T20:24:55Z","updated_at":"2018-03-26T20:24:55Z","html_url":"https://github.com/apache/spark/pull/19041#discussion_r177222641","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/19041","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/177222641"},"html":{"href":"https://github.com/apache/spark/pull/19041#discussion_r177222641"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/19041"}},"in_reply_to_id":165207798},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/19041","id":137476070,"html_url":"https://github.com/apache/spark/pull/19041","diff_url":"https://github.com/apache/spark/pull/19041.diff","patch_url":"https://github.com/apache/spark/pull/19041.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/19041","number":19041,"state":"open","locked":false,"title":"[SPARK-21097][CORE] Add option to recover cached data","user":{"login":"brad-kaiser","id":15015399,"avatar_url":"https://avatars2.githubusercontent.com/u/15015399?v=4","gravatar_id":"","url":"https://api.github.com/users/brad-kaiser","html_url":"https://github.com/brad-kaiser","followers_url":"https://api.github.com/users/brad-kaiser/followers","following_url":"https://api.github.com/users/brad-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/brad-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-kaiser/subscriptions","organizations_url":"https://api.github.com/users/brad-kaiser/orgs","repos_url":"https://api.github.com/users/brad-kaiser/repos","events_url":"https://api.github.com/users/brad-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/brad-kaiser/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nAdd an option to to recover cached data when using dynamic allocation.  Currently when dynamic allocation decommissions an idle executor, any cached RDD blocks on that executor will be lost. Saving that data has the potential for a real performance boost for shared instances of spark.\r\n\r\nIf there are any problems saving cached data, this change falls back to regular dynamic allocation behavior and drops the blocks. \r\n\r\n## How was this patch tested?\r\n\r\nThere are unit tests in RecoverCacheShutdownSuite and integration tests in RecoverCachedDataSuite. There are also benchmark results available here: https://docs.google.com/document/d/1E6_rhAAJB8Ww0n52-LYcFTO1zhJBWgfIXzNjLi29730/edit?usp=sharing\r\n","created_at":"2017-08-24T15:00:09Z","updated_at":"2018-03-26T20:24:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"affff24269391296de49da56c6b686c2dcba2a44","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/19041/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/19041/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/19041/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/c4e9a80b5fba5bcd06c63c71bbfeee080c8580dc","head":{"label":"brad-kaiser:recover-cached","ref":"recover-cached","sha":"c4e9a80b5fba5bcd06c63c71bbfeee080c8580dc","user":{"login":"brad-kaiser","id":15015399,"avatar_url":"https://avatars2.githubusercontent.com/u/15015399?v=4","gravatar_id":"","url":"https://api.github.com/users/brad-kaiser","html_url":"https://github.com/brad-kaiser","followers_url":"https://api.github.com/users/brad-kaiser/followers","following_url":"https://api.github.com/users/brad-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/brad-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-kaiser/subscriptions","organizations_url":"https://api.github.com/users/brad-kaiser/orgs","repos_url":"https://api.github.com/users/brad-kaiser/repos","events_url":"https://api.github.com/users/brad-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/brad-kaiser/received_events","type":"User","site_admin":false},"repo":{"id":85858304,"name":"spark","full_name":"brad-kaiser/spark","owner":{"login":"brad-kaiser","id":15015399,"avatar_url":"https://avatars2.githubusercontent.com/u/15015399?v=4","gravatar_id":"","url":"https://api.github.com/users/brad-kaiser","html_url":"https://github.com/brad-kaiser","followers_url":"https://api.github.com/users/brad-kaiser/followers","following_url":"https://api.github.com/users/brad-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/brad-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-kaiser/subscriptions","organizations_url":"https://api.github.com/users/brad-kaiser/orgs","repos_url":"https://api.github.com/users/brad-kaiser/repos","events_url":"https://api.github.com/users/brad-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/brad-kaiser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brad-kaiser/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/brad-kaiser/spark","forks_url":"https://api.github.com/repos/brad-kaiser/spark/forks","keys_url":"https://api.github.com/repos/brad-kaiser/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brad-kaiser/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brad-kaiser/spark/teams","hooks_url":"https://api.github.com/repos/brad-kaiser/spark/hooks","issue_events_url":"https://api.github.com/repos/brad-kaiser/spark/issues/events{/number}","events_url":"https://api.github.com/repos/brad-kaiser/spark/events","assignees_url":"https://api.github.com/repos/brad-kaiser/spark/assignees{/user}","branches_url":"https://api.github.com/repos/brad-kaiser/spark/branches{/branch}","tags_url":"https://api.github.com/repos/brad-kaiser/spark/tags","blobs_url":"https://api.github.com/repos/brad-kaiser/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brad-kaiser/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brad-kaiser/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/brad-kaiser/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brad-kaiser/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/brad-kaiser/spark/languages","stargazers_url":"https://api.github.com/repos/brad-kaiser/spark/stargazers","contributors_url":"https://api.github.com/repos/brad-kaiser/spark/contributors","subscribers_url":"https://api.github.com/repos/brad-kaiser/spark/subscribers","subscription_url":"https://api.github.com/repos/brad-kaiser/spark/subscription","commits_url":"https://api.github.com/repos/brad-kaiser/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/brad-kaiser/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/brad-kaiser/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/brad-kaiser/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/brad-kaiser/spark/contents/{+path}","compare_url":"https://api.github.com/repos/brad-kaiser/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brad-kaiser/spark/merges","archive_url":"https://api.github.com/repos/brad-kaiser/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brad-kaiser/spark/downloads","issues_url":"https://api.github.com/repos/brad-kaiser/spark/issues{/number}","pulls_url":"https://api.github.com/repos/brad-kaiser/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/brad-kaiser/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/brad-kaiser/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brad-kaiser/spark/labels{/name}","releases_url":"https://api.github.com/repos/brad-kaiser/spark/releases{/id}","deployments_url":"https://api.github.com/repos/brad-kaiser/spark/deployments","created_at":"2017-03-22T17:42:29Z","updated_at":"2017-03-22T17:42:56Z","pushed_at":"2018-03-26T20:19:41Z","git_url":"git://github.com/brad-kaiser/spark.git","ssh_url":"git@github.com:brad-kaiser/spark.git","clone_url":"https://github.com/brad-kaiser/spark.git","svn_url":"https://github.com/brad-kaiser/spark","homepage":null,"size":261322,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"fb3636b482be3d0940345b1528c1d5090bbc25e6","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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://avatars0.githubusercontent.com/u/47359?v=4","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}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2018-03-26T20:22:12Z","pushed_at":"2018-03-26T20:19:45Z","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":269669,"stargazers_count":16660,"watchers_count":16660,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15306,"mirror_url":null,"archived":false,"open_issues_count":481,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":15306,"open_issues":481,"watchers":16660,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/19041"},"html":{"href":"https://github.com/apache/spark/pull/19041"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/19041"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/19041/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/19041/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/19041/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/c4e9a80b5fba5bcd06c63c71bbfeee080c8580dc"}},"author_association":"NONE"}}
{"actor":{"display_login":"brad-kaiser"}}