{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/366118441","pull_request_review_id":342249727,"id":366118441,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM2NjExODQ0MQ==","diff_hunk":"@@ -1586,22 +1588,20 @@ class KafkaController(val config: KafkaConfig,\n     }\n   }\n \n-  private def replicasAreValid(topicPartition: TopicPartition, replicasOpt: Option[Seq[Int]]): Boolean = {\n-    replicasOpt match {\n-      case Some(replicas) =>\n-        val replicaSet = replicas.toSet\n-        if (replicas.isEmpty || replicas.size != replicaSet.size)\n-          false\n-        else if (replicas.exists(_ < 0))\n-          false\n-        else {\n-          // Ensure that any new replicas are among the live brokers\n-          val currentAssignment = controllerContext.partitionFullReplicaAssignment(topicPartition)\n-          val newAssignment = currentAssignment.reassignTo(replicas)\n-          newAssignment.addingReplicas.toSet.subsetOf(controllerContext.liveBrokerIds)\n-        }\n-\n-      case None => true\n+  private def validateReplicas(topicPartition: TopicPartition, replicas: Seq[Int]): Option[ApiError] = {\n+    val replicaSet = replicas.toSet\n+    if (replicas.isEmpty || replicas.size != replicaSet.size)","path":"core/src/main/scala/kafka/controller/KafkaController.scala","position":45,"original_position":45,"commit_id":"594a0eaf1489456bc9ec2edb06d4a74064394be4","original_commit_id":"594a0eaf1489456bc9ec2edb06d4a74064394be4","user":{"login":"hachikuji","id":12502538,"node_id":"MDQ6VXNlcjEyNTAyNTM4","avatar_url":"https://avatars3.githubusercontent.com/u/12502538?v=4","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"body":"Is it worth checking these cases separately so that we can return a clearer message?","created_at":"2020-01-14T01:49:29Z","updated_at":"2020-01-14T01:57:26Z","html_url":"https://github.com/apache/kafka/pull/7865#discussion_r366118441","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/7865","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/366118441"},"html":{"href":"https://github.com/apache/kafka/pull/7865#discussion_r366118441"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/7865"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/7865","id":356458391,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU2NDU4Mzkx","html_url":"https://github.com/apache/kafka/pull/7865","diff_url":"https://github.com/apache/kafka/pull/7865.diff","patch_url":"https://github.com/apache/kafka/pull/7865.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/7865","number":7865,"state":"open","locked":false,"title":"KAFKA-9329. KafkaController::replicasAreValid should return error","user":{"login":"soondenana","id":50422828,"node_id":"MDQ6VXNlcjUwNDIyODI4","avatar_url":"https://avatars0.githubusercontent.com/u/50422828?v=4","gravatar_id":"","url":"https://api.github.com/users/soondenana","html_url":"https://github.com/soondenana","followers_url":"https://api.github.com/users/soondenana/followers","following_url":"https://api.github.com/users/soondenana/following{/other_user}","gists_url":"https://api.github.com/users/soondenana/gists{/gist_id}","starred_url":"https://api.github.com/users/soondenana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soondenana/subscriptions","organizations_url":"https://api.github.com/users/soondenana/orgs","repos_url":"https://api.github.com/users/soondenana/repos","events_url":"https://api.github.com/users/soondenana/events{/privacy}","received_events_url":"https://api.github.com/users/soondenana/received_events","type":"User","site_admin":false},"body":"The `KafkaController::replicasAreValid` method currently returns a\r\nboolean indicating if replicas are valid or not. But the failure\r\ncondition loses any context on why replicas are not valid. This change\r\nupdates the metod to return the error conition if validation fails. This\r\nallows caller to report the error to the client.\r\n\r\nThe change also renames the `replicasAreValid` method to\r\n`validateReplicas` to reflect updated semantics.\r\n\r\n*More detailed description of your change,\r\nif necessary. The PR title and PR message become\r\nthe squashed commit message, so use a separate\r\ncomment to ping reviewers.*\r\n\r\n*Summary of testing strategy (including rationale)\r\nfor the feature or bug fix. Unit and/or integration\r\ntests are expected for any behaviour change and\r\nsystem tests should be considered for larger changes.*\r\n\r\n### Committer Checklist (excluded from commit message)\r\n- [ ] Verify design and implementation \r\n- [ ] Verify test coverage and CI build status\r\n- [ ] Verify documentation (including upgrade notes)\r\n","created_at":"2019-12-23T21:36:39Z","updated_at":"2020-01-14T01:57:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79478b68bd51f2b19f57d3798ebf80d08798735f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/7865/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/7865/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/7865/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/594a0eaf1489456bc9ec2edb06d4a74064394be4","head":{"label":"soondenana:KAFKA-9329","ref":"KAFKA-9329","sha":"594a0eaf1489456bc9ec2edb06d4a74064394be4","user":{"login":"soondenana","id":50422828,"node_id":"MDQ6VXNlcjUwNDIyODI4","avatar_url":"https://avatars0.githubusercontent.com/u/50422828?v=4","gravatar_id":"","url":"https://api.github.com/users/soondenana","html_url":"https://github.com/soondenana","followers_url":"https://api.github.com/users/soondenana/followers","following_url":"https://api.github.com/users/soondenana/following{/other_user}","gists_url":"https://api.github.com/users/soondenana/gists{/gist_id}","starred_url":"https://api.github.com/users/soondenana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soondenana/subscriptions","organizations_url":"https://api.github.com/users/soondenana/orgs","repos_url":"https://api.github.com/users/soondenana/repos","events_url":"https://api.github.com/users/soondenana/events{/privacy}","received_events_url":"https://api.github.com/users/soondenana/received_events","type":"User","site_admin":false},"repo":{"id":186471776,"node_id":"MDEwOlJlcG9zaXRvcnkxODY0NzE3NzY=","name":"kafka","full_name":"soondenana/kafka","private":false,"owner":{"login":"soondenana","id":50422828,"node_id":"MDQ6VXNlcjUwNDIyODI4","avatar_url":"https://avatars0.githubusercontent.com/u/50422828?v=4","gravatar_id":"","url":"https://api.github.com/users/soondenana","html_url":"https://github.com/soondenana","followers_url":"https://api.github.com/users/soondenana/followers","following_url":"https://api.github.com/users/soondenana/following{/other_user}","gists_url":"https://api.github.com/users/soondenana/gists{/gist_id}","starred_url":"https://api.github.com/users/soondenana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soondenana/subscriptions","organizations_url":"https://api.github.com/users/soondenana/orgs","repos_url":"https://api.github.com/users/soondenana/repos","events_url":"https://api.github.com/users/soondenana/events{/privacy}","received_events_url":"https://api.github.com/users/soondenana/received_events","type":"User","site_admin":false},"html_url":"https://github.com/soondenana/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/soondenana/kafka","forks_url":"https://api.github.com/repos/soondenana/kafka/forks","keys_url":"https://api.github.com/repos/soondenana/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/soondenana/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/soondenana/kafka/teams","hooks_url":"https://api.github.com/repos/soondenana/kafka/hooks","issue_events_url":"https://api.github.com/repos/soondenana/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/soondenana/kafka/events","assignees_url":"https://api.github.com/repos/soondenana/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/soondenana/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/soondenana/kafka/tags","blobs_url":"https://api.github.com/repos/soondenana/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/soondenana/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/soondenana/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/soondenana/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/soondenana/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/soondenana/kafka/languages","stargazers_url":"https://api.github.com/repos/soondenana/kafka/stargazers","contributors_url":"https://api.github.com/repos/soondenana/kafka/contributors","subscribers_url":"https://api.github.com/repos/soondenana/kafka/subscribers","subscription_url":"https://api.github.com/repos/soondenana/kafka/subscription","commits_url":"https://api.github.com/repos/soondenana/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/soondenana/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/soondenana/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/soondenana/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/soondenana/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/soondenana/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/soondenana/kafka/merges","archive_url":"https://api.github.com/repos/soondenana/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/soondenana/kafka/downloads","issues_url":"https://api.github.com/repos/soondenana/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/soondenana/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/soondenana/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/soondenana/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/soondenana/kafka/labels{/name}","releases_url":"https://api.github.com/repos/soondenana/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/soondenana/kafka/deployments","created_at":"2019-05-13T18:08:57Z","updated_at":"2019-08-26T19:00:09Z","pushed_at":"2020-01-07T19:58:35Z","git_url":"git://github.com/soondenana/kafka.git","ssh_url":"git@github.com:soondenana/kafka.git","clone_url":"https://github.com/soondenana/kafka.git","svn_url":"https://github.com/soondenana/kafka","homepage":null,"size":92205,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"03f763df8a8d9482d8c099806336f00cf2521465","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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":2211243,"node_id":"MDEwOlJlcG9zaXRvcnkyMjExMjQz","name":"kafka","full_name":"apache/kafka","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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},"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2020-01-14T01:13:42Z","pushed_at":"2020-01-13T23:32:18Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":93607,"stargazers_count":14685,"watchers_count":14685,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7777,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":726,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":7777,"open_issues":726,"watchers":14685,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/7865"},"html":{"href":"https://github.com/apache/kafka/pull/7865"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/7865"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/7865/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/7865/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/7865/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/594a0eaf1489456bc9ec2edb06d4a74064394be4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hachikuji"}}