jsancio commented on a change in pull request #11416:
URL: https://github.com/apache/kafka/pull/11416#discussion_r744007754
##########
File path:
metadata/src/test/java/org/apache/kafka/controller/ConfigurationControlManagerTest.java
##########
@@ -72,6 +73,14 @@
define("ghi", ConfigDef.Type.BOOLEAN, true,
ConfigDef.Importance.HIGH, "ghi"));
}
+ static class ExampleConfigurationValidator implements
ConfigurationValidator {
+ static final ExampleConfigurationValidator INSTANCE = new
ExampleConfigurationValidator();
+
+ @Override
+ public void validate(ConfigResource resource, Map<String, String>
config) {
+ }
Review comment:
Did you plan to implement this? If you not, you can use the trick you
are doing in other places. E.g.
```java
static ConfigurationValidator NOOP_VALIDATOR = (_, __) -> {};
```
##########
File path:
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
##########
@@ -215,6 +216,11 @@ public Builder
setAlterConfigPolicy(Optional<AlterConfigPolicy> alterConfigPolic
return this;
}
+ public Builder setConfigurationValidator(ConfigurationValidator
configurationValidator) {
+ this.configurationValidator = configurationValidator;
+ return this;
+ }
Review comment:
This method is never called in this PR. Are we missing changes?
##########
File path:
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java
##########
@@ -388,7 +389,12 @@ public void replay(RemoveTopicRecord record) {
Map<String, CreatableTopicResult> successes = new HashMap<>();
for (CreatableTopic topic : request.topics()) {
if (topicErrors.containsKey(topic.name())) continue;
- ApiError error = createTopic(topic, records, successes);
+ ApiError error;
+ try {
+ error = createTopic(topic, records, successes);
Review comment:
I find it strange that `createTopic` can return an `ApiError` or throw
an `ApiException`. I think it should do one or the other but not both. What is
now throwing that requires a `try ... catch ...`?
##########
File path:
metadata/src/main/java/org/apache/kafka/controller/ConfigurationValidator.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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 org.apache.kafka.controller;
+
+import org.apache.kafka.common.config.ConfigResource;
+
+import java.util.Map;
+
+
+public interface ConfigurationValidator {
+ /**
+ * Throws an ApiException if a configuration is invalid for the given
resource.
+ *
+ * @param resource The configuration resource.
+ * @param config The new configuration.
+ */
+ void validate(ConfigResource resource, Map<String, String> config);
Review comment:
I couldn't find a class in `src/main` that implements this interface.
Are we missing files in this PR?
--
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]