mumrah commented on a change in pull request #11179:
URL: https://github.com/apache/kafka/pull/11179#discussion_r683552057
##########
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:
I think we need an additional check that the voter list is not empty if
`process.roles` is set. Otherwise we will skip the validation that `node.id` is
included in the voter list when we are a controller.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]