cmccabe commented on a change in pull request #10463: URL: https://github.com/apache/kafka/pull/10463#discussion_r612786365
########## File path: metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java ########## @@ -374,6 +381,27 @@ void deleteTopicConfigs(String name) { configData.remove(new ConfigResource(Type.TOPIC, name)); } + private boolean getBoolean(ConfigResource configResource, String key) { + TimelineHashMap<String, String> map = configData.get(configResource); + if (map == null) return false; + String value = map.getOrDefault(key, "false"); + return value.equalsIgnoreCase("true"); + } + + /** + * Check if the given topic should use an unclean leader election. + * + * @param topicName The topic name. + * @return True if the controller or topic was configured to use unclean + * leader election. + */ + boolean shouldUseUncleanLeaderElection(String topicName) { + // Check the node config, cluster config, and topic config. + return getBoolean(currentNodeResource, UNCLEAN_LEADER_ELECTION_ENABLE_CONFIG) || Review comment: So an individual topic could configure unclean leader election as false even if the node sets it to true? -- 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