ijuma commented on a change in pull request #9883: URL: https://github.com/apache/kafka/pull/9883#discussion_r557058822
########## File path: core/src/main/scala/kafka/server/KafkaRaftBroker.scala ########## @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kafka.server + +class KafkaRaftBroker { Review comment: Maybe we can add a brief comment explaining that this is a stub and not used yet. Similar for KafkaRaftController. ########## File path: clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java ########## @@ -404,13 +404,47 @@ public ConfigDef define(String name, Type type, Importance importance, String do * @param name The name of the config parameter * @param type The type of the config * @param defaultValue The default value to use if this config isn't present - * @param importance + * @param importance The importance of this config (i.e. is this something you will likely need to change?) * @return This ConfigDef so you can chain calls */ public ConfigDef defineInternal(final String name, final Type type, final Object defaultValue, final Importance importance) { return define(new ConfigKey(name, type, defaultValue, null, importance, "", "", -1, Width.NONE, name, Collections.<String>emptyList(), null, true)); } + /** + * Define a new internal configuration. Internal configuration won't show up in the docs and aren't + * intended for general use. + * @param name The name of the config parameter + * @param type The type of the config + * @param defaultValue The default value to use if this config isn't present + * @param validator the validator to use in checking the correctness of the config + * @param importance The importance of this config (i.e. is this something you will likely need to change?) + * @return This ConfigDef so you can chain calls + */ + public ConfigDef defineInternal( + final String name, + final Type type, + final Object defaultValue, + final Validator validator, + final Importance importance + ) { + return define(new ConfigKey( + name, + type, + defaultValue, + validator, + importance, + "", + "", + -1, + Width.NONE, + name, + Collections.<String>emptyList(), + null, + true + )); + } Review comment: Nit: it looks pretty odd to have widely differing code styles in the same file. ########## File path: core/src/main/scala/kafka/server/KafkaRaftController.scala ########## @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kafka.server + +class KafkaRaftController { Review comment: Do you think the `Kafka` prefix adds much value? Would `RaftController`, `RaftBroker` and `RaftServer` be confusing/less clear? ########## File path: core/src/main/scala/kafka/server/KafkaConfig.scala ########## @@ -1453,6 +1456,21 @@ class KafkaConfig(val props: java.util.Map[_, _], doLog: Boolean, dynamicConfigO val brokerIdGenerationEnable: Boolean = getBoolean(KafkaConfig.BrokerIdGenerationEnableProp) val maxReservedBrokerId: Int = getInt(KafkaConfig.MaxReservedBrokerIdProp) var brokerId: Int = getInt(KafkaConfig.BrokerIdProp) + val processRoles = parseProcessRoles() + + private def parseProcessRoles(): Set[ProcessRole] = { + val roles = getList(KafkaConfig.ProcessRolesProp).asScala.map { + case "broker" => BrokerRole + case "controller" => ControllerRole + case role => throw new ConfigException(s"Unknown process role $role") + } + + if (roles.distinct.length != roles.size) { Review comment: This duplicates the work done in `roles.toSet`, seems like we can assign that to a variable to avoid that. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org