Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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: 5 additions & 1 deletion core/src/main/scala/kafka/server/KafkaConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ import scala.jdk.OptionConverters.RichOptional
object KafkaConfig {

def main(args: Array[String]): Unit = {
System.out.println(configDef.toHtml(4, (config: String) => "brokerconfigs_" + config,
val combined = new ConfigDef(configDef)
// Broker quota configs are dynamic-only and not defined in AbstractKafkaConfig.CONFIG_DEF,
// so we need to add them explicitly here for the generated HTML documentation.
QuotaConfig.brokerQuotaConfigs().configKeys().forEach((_, v) => combined.define(v))
Copy link
Member

Choose a reason for hiding this comment

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

would you mind adding comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that would be good idea, I have added comment there.

System.out.println(combined.toHtml(4, (config: String) => "brokerconfigs_" + config,
JDynamicBrokerConfig.dynamicConfigUpdateModes))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static ConfigDef brokerQuotaConfigs() {
ConfigDef.Importance.MEDIUM, QuotaConfig.REPLICA_ALTER_LOG_DIRS_IO_MAX_BYTES_PER_SECOND_DOC);
}

public static final Set<String> BROKER_QUOTA_CONFIGS = Set.copyOf(brokerQuotaConfigs().names());
public static final Set<String> BROKER_QUOTA_CONFIGS = Set.copyOf(brokerQuotaConfigs().names());

public static ConfigDef userAndClientQuotaConfigs() {
ConfigDef configDef = new ConfigDef();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public class DynamicBrokerConfig {
DynamicReplicationConfig.RECONFIGURABLE_CONFIGS,
List.of(AbstractConfig.CONFIG_PROVIDERS_CONFIG),
GroupCoordinatorConfig.RECONFIGURABLE_CONFIGS,
ShareCoordinatorConfig.RECONFIGURABLE_CONFIGS,
QuotaConfig.BROKER_QUOTA_CONFIGS)
DynamicQuotaConfig.RECONFIGURABLE_CONFIGS,
ShareCoordinatorConfig.RECONFIGURABLE_CONFIGS)
.flatMap(Collection::stream)
.collect(Collectors.toUnmodifiableSet());

Expand Down Expand Up @@ -279,4 +279,8 @@ public static class DynamicReplicationConfig {
public static final Set<String> RECONFIGURABLE_CONFIGS = Set.of(
ReplicationConfigs.FOLLOWER_FETCH_LAST_TIERED_OFFSET_ENABLE_CONFIG);
}

public static class DynamicQuotaConfig {
Copy link
Member

Choose a reason for hiding this comment

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

Is it a kind of decoration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it make code more readable at least for me. Like I didn't want to re-write all these properties into Dynamic<class-name>.java:

public static final Set<String> ALL_DYNAMIC_CONFIGS = Stream.of(
            DYNAMIC_SECURITY_CONFIGS,
            LogCleaner.RECONFIGURABLE_CONFIGS,
            DynamicLogConfig.RECONFIGURABLE_CONFIGS,
            DynamicThreadPool.RECONFIGURABLE_CONFIGS,
            List.of(MetricConfigs.METRIC_REPORTER_CLASSES_CONFIG),
            DynamicListenerConfig.RECONFIGURABLE_CONFIGS,
            SocketServer.RECONFIGURABLE_CONFIGS,
            DYNAMIC_PRODUCER_STATE_MANAGER_CONFIGS,
            DynamicRemoteLogConfig.RECONFIGURABLE_CONFIGS,
            DynamicReplicationConfig.RECONFIGURABLE_CONFIGS,
            List.of(AbstractConfig.CONFIG_PROVIDERS_CONFIG),
            GroupCoordinatorConfig.RECONFIGURABLE_CONFIGS,
            DynamicQuotaConfig.RECONFIGURABLE_CONFIGS,
            ShareCoordinatorConfig.RECONFIGURABLE_CONFIGS)
        .flatMap(Collection::stream)
        .collect(Collectors.toUnmodifiableSet());

because you can see that some of them using that pattern DynamicThreadPool.RECONFIGURABLE_CONFIGS or DynamicLogConfig.RECONFIGURABLE_CONFIGS. Like for instance when seeing QuotaConfig.BROKER_QUOTA_CONFIGS it doesn't give me a feeling that it's dynamic configuration I have to go deep into the code to see it actually.... (maybe I am just too picky sorry :D)

public static final Set<String> RECONFIGURABLE_CONFIGS = QuotaConfig.BROKER_QUOTA_CONFIGS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import java.util.Set;

/**
* Class used to hold dynamic configs. These are configs which have no physical manifestation in the server.properties
* and can only be set dynamically.
* Holds dynamic configs, including both dynamic-only configs which have no physical manifestation in server.properties and
* can only be set dynamically (i.e., {@link QuotaConfig#brokerQuotaConfigs()}), and dual-mode configs that can be set
* statically or dynamically.
*/
public class DynamicConfig {

Expand Down