Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions core/src/main/scala/kafka/server/DynamicBrokerConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ object DynamicBrokerConfig {
AllDynamicConfigs.intersect(passwordConfigs)
}

private val nonDynamicProps: Set[String] = KafkaConfig.configNames.toSet -- DynamicConfig.Broker.names.asScala

def isPasswordConfig(name: String): Boolean = DynamicBrokerConfig.DynamicPasswordConfigs.exists(name.endsWith)

def brokerConfigSynonyms(name: String, matchListenerOverride: Boolean): List[String] = {
Expand Down Expand Up @@ -168,7 +166,7 @@ object DynamicBrokerConfig {
}

private def nonDynamicConfigs(props: Properties): Set[String] = {
props.asScala.keySet.intersect(nonDynamicProps)
props.asScala.keySet.intersect(DynamicConfig.Broker.nonDynamicProps)
}

private def securityConfigsWithoutListenerPrefix(props: Properties): Set[String] = {
Expand Down Expand Up @@ -321,7 +319,7 @@ class DynamicBrokerConfig(private val kafkaConfig: KafkaConfig) extends Logging
}

private def verifyReconfigurableConfigs(configNames: Set[String]): Unit = CoreUtils.inWriteLock(lock) {
val nonDynamic = configNames.intersect(nonDynamicProps)
val nonDynamic = configNames.intersect(DynamicConfig.Broker.nonDynamicProps)
require(nonDynamic.isEmpty, s"Reconfigurable contains non-dynamic configs $nonDynamic")
}

Expand Down
14 changes: 11 additions & 3 deletions core/src/main/scala/kafka/server/DynamicConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package kafka.server

import kafka.server.DynamicBrokerConfig.AllDynamicConfigs

import java.net.{InetAddress, UnknownHostException}
import java.util.Properties
import org.apache.kafka.common.config.ConfigDef
Expand All @@ -30,10 +32,16 @@ import scala.jdk.CollectionConverters._
* and can only be set dynamically.
*/
object DynamicConfig {
object Broker {
private val brokerConfigs = {
val configs = QuotaConfigs.brokerQuotaConfigs()
KafkaConfig.configKeys
.filter { case (configName, _) => AllDynamicConfigs.contains(configName) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add comments to remind readers about the circular reference?

.foreach { case (_, config) => configs.define(config) }
configs
}

object Broker {
private val brokerConfigs = QuotaConfigs.brokerQuotaConfigs()
DynamicBrokerConfig.addDynamicConfigs(brokerConfigs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So DynamicBrokerConfig.addDynamicConfigs() is not used anymore, we can delete it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I will remove it 😄

val nonDynamicProps: Set[String] = KafkaConfig.configNames.toSet -- brokerConfigs.names.asScala

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have correct indentation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I will fix it.


def configKeys: util.Map[String, ConfigDef.ConfigKey] = brokerConfigs.configKeys

Expand Down