kevin-wu24 commented on code in PR #21122:
URL: https://github.com/apache/kafka/pull/21122#discussion_r2621042020


##########
core/src/main/scala/kafka/server/ControllerApis.scala:
##########
@@ -1059,9 +1059,9 @@ class ControllerApis(
   def handleDescribeCluster(request: RequestChannel.Request): 
CompletableFuture[Unit] = {
     // Nearly all RPCs should check MetadataVersion inside the 
QuorumController. However, this
     // RPC is consulting a cache which lives outside the QC. So we check 
MetadataVersion here.
-    if 
(!apiVersionManager.features.metadataVersion().isControllerRegistrationSupported)
 {
-      throw new UnsupportedVersionException("Direct-to-controller 
communication is not " +
-        "supported with the current MetadataVersion.")
+    if 
(!apiVersionManager.features.metadataVersion().map(_.isControllerRegistrationSupported).orElse(false))
 {
+      throw new UnsupportedVersionException("There is no finalized 
MetadataVersion, so " +
+        "direct-to-controller communication is not supported.")

Review Comment:
   Please make a separate if/else if clause for if the metadata version is not 
finalized. We should not change this existing check.



##########
server/src/main/java/org/apache/kafka/server/SimpleApiVersionManager.java:
##########
@@ -67,19 +69,19 @@ public ApiMessageType.ListenerType listenerType() {
 
     @Override
     public ApiVersionsResponse apiVersionResponse(int throttleTimeMs, boolean 
alterFeatureLevel0) {
-        FinalizedFeatures currentFeatures = features();
+        Optional<FinalizedFeatures> currentFeatures = featuresProvider.get();
         return new ApiVersionsResponse.Builder()
                 .setThrottleTimeMs(throttleTimeMs)
                 .setApiVersions(apiVersions)
                 .setSupportedFeatures(brokerFeatures)
-                .setFinalizedFeatures(currentFeatures.finalizedFeatures())
-                
.setFinalizedFeaturesEpoch(currentFeatures.finalizedFeaturesEpoch())
+                
.setFinalizedFeatures(currentFeatures.map(FinalizedFeatures::finalizedFeatures).orElse(Map.of()))

Review Comment:
   I think if we want to expose the latest committed kraft version, we should 
do it in a separate 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]

Reply via email to