dajac commented on code in PR #17013: URL: https://github.com/apache/kafka/pull/17013#discussion_r1734513700
########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -3808,8 +3808,14 @@ class KafkaApis(val requestChannel: RequestChannel, ) } + private def groupVersion(): GroupVersion = { + GroupVersion.fromFeatureLevel(metadataCache.features.finalizedFeatures.getOrDefault(GroupVersion.FEATURE_NAME, 0.toShort)) + } + private def isConsumerGroupProtocolEnabled(): Boolean = { - groupCoordinator.isNewGroupCoordinator && config.groupCoordinatorRebalanceProtocols.contains(Group.GroupType.CONSUMER) + groupCoordinator.isNewGroupCoordinator && Review Comment: The GroupVersion will always increase like the MetadataVersion because we will use it to gate future changes related to groups in the future too (e.g. share groups). So we also have `groupCoordinatorRebalanceProtocols` as a static config to allow admin to disable the new protocol or other future protocols if they really don't want them. Honestly, I don't expect it to be really used but it is nice to have. ########## core/src/test/java/kafka/test/junit/RaftClusterInvocationContext.java: ########## @@ -246,21 +247,48 @@ public Map<Integer, ControllerServer> controllers() { public void format() throws Exception { if (formated.compareAndSet(false, true)) { - List<ApiMessageAndVersion> records = new ArrayList<>(); - records.add( - new ApiMessageAndVersion(new FeatureLevelRecord(). - setName(MetadataVersion.FEATURE_NAME). - setFeatureLevel(clusterConfig.metadataVersion().featureLevel()), (short) 0)); - - clusterConfig.features().forEach((feature, version) -> { - records.add( - new ApiMessageAndVersion(new FeatureLevelRecord(). - setName(feature.featureName()). - setFeatureLevel(version), (short) 0)); + Map<String, Features> nameToSupportedFeature = new TreeMap<>(); + Features.PRODUCTION_FEATURES.forEach(feature -> nameToSupportedFeature.put(feature.featureName(), feature)); + Map<String, Short> newFeatureLevels = new TreeMap<>(); + + // Verify that all specified features are known to us. + for (Map.Entry<Features, Short> entry : clusterConfig.features().entrySet()) { + String featureName = entry.getKey().featureName(); + short level = entry.getValue(); + if (!featureName.equals(MetadataVersion.FEATURE_NAME)) { + if (!nameToSupportedFeature.containsKey(featureName)) { + throw new FormatterException("Unsupported feature: " + featureName + Review Comment: Sure. -- 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