{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/comments/26256769","id":26256769,"diff_hunk":"@@ -158,24 +158,27 @@ public void removeTask(@NotNull final String taskId, Protos.TaskStatus status) {\n         List<CassandraNode> newNodes = new ArrayList<>(nodes.size());\n         boolean changed = false;\n         for (CassandraNode cassandraNode : nodes) {\n-            if (cassandraNode.hasMetadataTask() && cassandraNode.getMetadataTask().getTaskId().equals(taskId)) {\n-                // TODO shouldn't we also assume that the server task is no longer running ??\n-                // TODO do we need to remove the executor metadata ??\n-\n-                changed = true;\n-                removeExecutorMetadata(cassandraNode.getMetadataTask().getExecutorId());\n-                newNodes.add(CassandraNode.newBuilder(cassandraNode)\n-                        .clearMetadataTask()\n-                        .clearServerTask()\n-                        .build());\n-            } else if (cassandraNode.hasServerTask() && cassandraNode.getServerTask().getTaskId().equals(taskId)) {\n-                changed = true;\n-                newNodes.add(CassandraNode.newBuilder(cassandraNode)\n-                        .clearServerTask()\n-                        .build());\n-            } else {\n+            CassandraNodeTask nodeTask = CassandraFrameworkProtosUtils.getTaskForNode(cassandraNode, taskId);\n+            if (nodeTask == null) {\n                 newNodes.add(cassandraNode);\n+                continue;\n+            }\n+            CassandraNode.Builder builder = CassandraFrameworkProtosUtils.removeTask(cassandraNode, nodeTask);\n+            changed = true;\n+            switch (nodeTask.getTaskType()) {\n+                case METADATA:\n+                    // TODO shouldn't we also assume that the server task is no longer running ??","path":"cassandra-scheduler/src/main/java/io/mesosphere/mesos/frameworks/cassandra/CassandraCluster.java","position":29,"original_position":29,"commit_id":"64f194a194e99e79b02c76b735bbac28e44bb4d8","original_commit_id":"64f194a194e99e79b02c76b735bbac28e44bb4d8","user":{"login":"BenWhitehead","id":1754037,"avatar_url":"https://avatars.githubusercontent.com/u/1754037?v=3","gravatar_id":"","url":"https://api.github.com/users/BenWhitehead","html_url":"https://github.com/BenWhitehead","followers_url":"https://api.github.com/users/BenWhitehead/followers","following_url":"https://api.github.com/users/BenWhitehead/following{/other_user}","gists_url":"https://api.github.com/users/BenWhitehead/gists{/gist_id}","starred_url":"https://api.github.com/users/BenWhitehead/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenWhitehead/subscriptions","organizations_url":"https://api.github.com/users/BenWhitehead/orgs","repos_url":"https://api.github.com/users/BenWhitehead/repos","events_url":"https://api.github.com/users/BenWhitehead/events{/privacy}","received_events_url":"https://api.github.com/users/BenWhitehead/received_events","type":"User","site_admin":false},"body":"Removing of executor info and taking the server with it should be handled by the status update from `executorLost` so that once `executorLost` is fixed in mesos it can still be handled there.","created_at":"2015-03-11T21:18:46Z","updated_at":"2015-03-11T21:18:46Z","html_url":"https://github.com/mesosphere/cassandra-mesos/pull/45#discussion_r26256769","pull_request_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/comments/26256769"},"html":{"href":"https://github.com/mesosphere/cassandra-mesos/pull/45#discussion_r26256769"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45","id":30894761,"html_url":"https://github.com/mesosphere/cassandra-mesos/pull/45","diff_url":"https://github.com/mesosphere/cassandra-mesos/pull/45.diff","patch_url":"https://github.com/mesosphere/cassandra-mesos/pull/45.patch","issue_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/45","number":45,"state":"open","locked":false,"title":"C node restart","user":{"login":"snazy","id":957468,"avatar_url":"https://avatars.githubusercontent.com/u/957468?v=3","gravatar_id":"","url":"https://api.github.com/users/snazy","html_url":"https://github.com/snazy","followers_url":"https://api.github.com/users/snazy/followers","following_url":"https://api.github.com/users/snazy/following{/other_user}","gists_url":"https://api.github.com/users/snazy/gists{/gist_id}","starred_url":"https://api.github.com/users/snazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snazy/subscriptions","organizations_url":"https://api.github.com/users/snazy/orgs","repos_url":"https://api.github.com/users/snazy/repos","events_url":"https://api.github.com/users/snazy/events{/privacy}","received_events_url":"https://api.github.com/users/snazy/received_events","type":"User","site_admin":false},"body":"Adds:\r\n* Cassandra server shutdown\r\n* Cassandra server start\r\n* Cassandra server restart\r\n\r\nTo do that, a `TargetRunState` enum is introduced. It knows three states: `RUN`=node has to run, `STOP`=node should not run, `RESTART`=stop and start node (sets state to `RUN` afterwards)\r\n\r\nSince a new task ID (`shutdown`) is being introduced (and a follow-up PR introduces a new state `TERMINATE` along with another new task `terminate`) I've change refactored the `metadataTask` and `serverTask` fields to a general-purpose list of `CassandraNode.tasks`.","created_at":"2015-03-10T21:32:42Z","updated_at":"2015-03-11T21:18:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbc9e944f13b44eacd7d442fd21a1d025774a7fe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45/commits","review_comments_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45/comments","review_comment_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/45/comments","statuses_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/statuses/64f194a194e99e79b02c76b735bbac28e44bb4d8","head":{"label":"snazy:c-node-restart","ref":"c-node-restart","sha":"64f194a194e99e79b02c76b735bbac28e44bb4d8","user":{"login":"snazy","id":957468,"avatar_url":"https://avatars.githubusercontent.com/u/957468?v=3","gravatar_id":"","url":"https://api.github.com/users/snazy","html_url":"https://github.com/snazy","followers_url":"https://api.github.com/users/snazy/followers","following_url":"https://api.github.com/users/snazy/following{/other_user}","gists_url":"https://api.github.com/users/snazy/gists{/gist_id}","starred_url":"https://api.github.com/users/snazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snazy/subscriptions","organizations_url":"https://api.github.com/users/snazy/orgs","repos_url":"https://api.github.com/users/snazy/repos","events_url":"https://api.github.com/users/snazy/events{/privacy}","received_events_url":"https://api.github.com/users/snazy/received_events","type":"User","site_admin":false},"repo":{"id":30885937,"name":"cassandra-mesos","full_name":"snazy/cassandra-mesos","owner":{"login":"snazy","id":957468,"avatar_url":"https://avatars.githubusercontent.com/u/957468?v=3","gravatar_id":"","url":"https://api.github.com/users/snazy","html_url":"https://github.com/snazy","followers_url":"https://api.github.com/users/snazy/followers","following_url":"https://api.github.com/users/snazy/following{/other_user}","gists_url":"https://api.github.com/users/snazy/gists{/gist_id}","starred_url":"https://api.github.com/users/snazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snazy/subscriptions","organizations_url":"https://api.github.com/users/snazy/orgs","repos_url":"https://api.github.com/users/snazy/repos","events_url":"https://api.github.com/users/snazy/events{/privacy}","received_events_url":"https://api.github.com/users/snazy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/snazy/cassandra-mesos","description":"Cassandra on Mesos","fork":true,"url":"https://api.github.com/repos/snazy/cassandra-mesos","forks_url":"https://api.github.com/repos/snazy/cassandra-mesos/forks","keys_url":"https://api.github.com/repos/snazy/cassandra-mesos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snazy/cassandra-mesos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snazy/cassandra-mesos/teams","hooks_url":"https://api.github.com/repos/snazy/cassandra-mesos/hooks","issue_events_url":"https://api.github.com/repos/snazy/cassandra-mesos/issues/events{/number}","events_url":"https://api.github.com/repos/snazy/cassandra-mesos/events","assignees_url":"https://api.github.com/repos/snazy/cassandra-mesos/assignees{/user}","branches_url":"https://api.github.com/repos/snazy/cassandra-mesos/branches{/branch}","tags_url":"https://api.github.com/repos/snazy/cassandra-mesos/tags","blobs_url":"https://api.github.com/repos/snazy/cassandra-mesos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snazy/cassandra-mesos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snazy/cassandra-mesos/git/refs{/sha}","trees_url":"https://api.github.com/repos/snazy/cassandra-mesos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snazy/cassandra-mesos/statuses/{sha}","languages_url":"https://api.github.com/repos/snazy/cassandra-mesos/languages","stargazers_url":"https://api.github.com/repos/snazy/cassandra-mesos/stargazers","contributors_url":"https://api.github.com/repos/snazy/cassandra-mesos/contributors","subscribers_url":"https://api.github.com/repos/snazy/cassandra-mesos/subscribers","subscription_url":"https://api.github.com/repos/snazy/cassandra-mesos/subscription","commits_url":"https://api.github.com/repos/snazy/cassandra-mesos/commits{/sha}","git_commits_url":"https://api.github.com/repos/snazy/cassandra-mesos/git/commits{/sha}","comments_url":"https://api.github.com/repos/snazy/cassandra-mesos/comments{/number}","issue_comment_url":"https://api.github.com/repos/snazy/cassandra-mesos/issues/comments{/number}","contents_url":"https://api.github.com/repos/snazy/cassandra-mesos/contents/{+path}","compare_url":"https://api.github.com/repos/snazy/cassandra-mesos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snazy/cassandra-mesos/merges","archive_url":"https://api.github.com/repos/snazy/cassandra-mesos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snazy/cassandra-mesos/downloads","issues_url":"https://api.github.com/repos/snazy/cassandra-mesos/issues{/number}","pulls_url":"https://api.github.com/repos/snazy/cassandra-mesos/pulls{/number}","milestones_url":"https://api.github.com/repos/snazy/cassandra-mesos/milestones{/number}","notifications_url":"https://api.github.com/repos/snazy/cassandra-mesos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snazy/cassandra-mesos/labels{/name}","releases_url":"https://api.github.com/repos/snazy/cassandra-mesos/releases{/id}","created_at":"2015-02-16T20:08:31Z","updated_at":"2015-03-02T14:32:54Z","pushed_at":"2015-03-11T21:07:14Z","git_url":"git://github.com/snazy/cassandra-mesos.git","ssh_url":"git@github.com:snazy/cassandra-mesos.git","clone_url":"https://github.com/snazy/cassandra-mesos.git","svn_url":"https://github.com/snazy/cassandra-mesos","homepage":null,"size":1213,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"rewrite"}},"base":{"label":"mesosphere:rewrite","ref":"rewrite","sha":"594bb10f4b5973fc335b23e786a0cb9c600171d6","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":15693035,"name":"cassandra-mesos","full_name":"mesosphere/cassandra-mesos","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/cassandra-mesos","description":"Cassandra on Mesos","fork":false,"url":"https://api.github.com/repos/mesosphere/cassandra-mesos","forks_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/forks","keys_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/teams","hooks_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/events","assignees_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/tags","blobs_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/languages","stargazers_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/subscription","commits_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/merges","archive_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/downloads","issues_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/cassandra-mesos/releases{/id}","created_at":"2014-01-07T02:27:47Z","updated_at":"2015-03-03T04:59:07Z","pushed_at":"2015-03-11T02:34:05Z","git_url":"git://github.com/mesosphere/cassandra-mesos.git","ssh_url":"git@github.com:mesosphere/cassandra-mesos.git","clone_url":"https://github.com/mesosphere/cassandra-mesos.git","svn_url":"https://github.com/mesosphere/cassandra-mesos","homepage":null,"size":1620,"stargazers_count":85,"watchers_count":85,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":20,"forks":17,"open_issues":20,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45"},"html":{"href":"https://github.com/mesosphere/cassandra-mesos/pull/45"},"issue":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/45"},"comments":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/cassandra-mesos/statuses/64f194a194e99e79b02c76b735bbac28e44bb4d8"}}}}