cmccabe commented on code in PR #12207:
URL: https://github.com/apache/kafka/pull/12207#discussion_r883156749


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumFeatures.java:
##########
@@ -75,47 +76,50 @@ public static Map<String, VersionRange> defaultFeatureMap() 
{
         return features;
     }
 
-    Optional<VersionRange> quorumSupportedFeature(String featureName) {
-        List<VersionRange> supportedVersions = new 
ArrayList<>(quorumNodeIds.size());
-        for (int nodeId : quorumNodeIds) {
-            if (nodeId == this.nodeId) {
-                // We get this node's features from "supportedFeatures"
-                continue;
+    /**
+     * Return the reason a specific feature level is not supported, or 
Optional.empty if it is supported.
+     *
+     * @param featureName   The feature name.
+     * @param level         The feature level.
+     * @return              The reason why the feature level is not supported, 
or Optional.empty if it is supported.
+     */
+    public Optional<String> reasonNotSupported(String featureName, short 
level) {

Review Comment:
   the problem with "check" or "validate" is that it sort of implies that we 
throw an exception if the validation fails, whereas this returns a reason 
string.
   
   I liked avoiding exceptions here since it avoids messing with questions like 
what is the exception type and how do you pull out the string (which is what 
you really want)



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to