kowshik commented on a change in pull request #8680:
URL: https://github.com/apache/kafka/pull/8680#discussion_r434428173



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/ApiVersionsResponse.java
##########
@@ -113,14 +127,44 @@ public static ApiVersionsResponse fromStruct(Struct 
struct, short version) {
         }
     }
 
-    public static ApiVersionsResponse apiVersionsResponse(int throttleTimeMs, 
byte maxMagic) {
+    public static ApiVersionsResponse apiVersionsResponse(
+        int throttleTimeMs,
+        byte maxMagic,
+        Features<SupportedVersionRange> latestSupportedFeatures) {
+        return apiVersionsResponse(
+            throttleTimeMs, maxMagic, latestSupportedFeatures, 
Optional.empty(), Optional.empty());
+    }
+
+    public static ApiVersionsResponse apiVersionsResponse(
+        int throttleTimeMs,
+        byte maxMagic,
+        Features<SupportedVersionRange> latestSupportedFeatures,
+        Features<FinalizedVersionRange> finalizedFeatures,
+        long finalizedFeaturesEpoch) {
+        return apiVersionsResponse(
+            throttleTimeMs, maxMagic, latestSupportedFeatures, 
Optional.of(finalizedFeatures), Optional.of(finalizedFeaturesEpoch));
+    }
+
+    private static ApiVersionsResponse apiVersionsResponse(
+        int throttleTimeMs,
+        byte maxMagic,
+        Features<SupportedVersionRange> latestSupportedFeatures,
+        Optional<Features<FinalizedVersionRange>> finalizedFeatures,

Review comment:
       It's because non-existing supported features _can_ be represented by an 
empty map (i.e. broker does not advertise any features). But on the other hand, 
non-existing finalized features can not be represented by empty map alone, as 
we need a suitable epoch value that indicates the absence of finalized 
features. To address this case, I saw 2 ways:
   1) Provide a negative epoch value indicating absence of finalized features, 
OR
   2) Represent using an empty `Optional` for both finalized features and epoch.
   
   I chose the latter approach. Please, let me know if you have concerns.




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

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


Reply via email to