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


##########
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:
   > This code in ControllerServer.scala already adds the kraft.version. It 
might not appear in the output if kraft.version is 0 and hence gets filtered 
out.
   
   Yes but the current code will expose `kraft.version=1` in the 
APIVersionsResponse even if it has not been committed yet. We can slightly 
improve on this by not adding the kraft.version if the metadata.version does 
not exist, but the feature's value in the API versions may still be uncommitted 
when doing upgrade.



-- 
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