mumrah commented on a change in pull request #11179:
URL: https://github.com/apache/kafka/pull/11179#discussion_r683654444



##########
File path: core/src/main/scala/kafka/server/KafkaConfig.scala
##########
@@ -1949,6 +1951,17 @@ class KafkaConfig(val props: java.util.Map[_, _], doLog: 
Boolean, dynamicConfigO
       )
     }
 
+    val voterIds: Set[Integer] = if (usesSelfManagedQuorum) 
RaftConfig.parseVoterConnections(quorumVoters).asScala.keySet.toSet else 
Set.empty
+    if (voterIds.nonEmpty) {
+      if (processRoles.contains(ControllerRole)) {
+        // Ensure that controllers use their node.id as a voter in 
controller.quorum.voters 
+        require(voterIds.contains(nodeId), s"If 
${KafkaConfig.ProcessRolesProp} contains the 'controller' role, the node id 
$nodeId must be included in the set of voters 
${RaftConfig.QUORUM_VOTERS_CONFIG}=$voterIds")
+      } else {
+        // Ensure that the broker's node.id is not an id in 
controller.quorum.voters
+        require(!voterIds.contains(nodeId), s"If 
${KafkaConfig.ProcessRolesProp} does not contain the 'controller' role, the 
node id $nodeId must not be included in the set of voters 
${RaftConfig.QUORUM_VOTERS_CONFIG}=$voterIds")
+      }
+    }
+

Review comment:
       Right, but if the voters list _is_ empty, and we are in self-managed 
mode, I believe we should throw an error.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to