jolshan commented on code in PR #15968:
URL: https://github.com/apache/kafka/pull/15968#discussion_r1638517211


##########
clients/src/main/java/org/apache/kafka/clients/ApiVersions.java:
##########
@@ -34,10 +34,21 @@ public class ApiVersions {
 
     private final Map<String, NodeApiVersions> nodeApiVersions = new 
HashMap<>();
     private byte maxUsableProduceMagic = RecordBatch.CURRENT_MAGIC_VALUE;
+    private short maxProduceSupportedVersion = ApiKeys.PRODUCE.latestVersion();
 
     public synchronized void update(String nodeId, NodeApiVersions 
nodeApiVersions) {
         this.nodeApiVersions.put(nodeId, nodeApiVersions);
         this.maxUsableProduceMagic = computeMaxUsableProduceMagic();
+        this.maxProduceSupportedVersion = computeMaxProduceSupportedVersion();
+    }
+
+    private short computeMaxProduceSupportedVersion() {
+        Optional<Short> knownBrokerNodesMinSupportedVersionForProduce = 
this.nodeApiVersions.values().stream()

Review Comment:
   My understanding is that ApiVersions also contains features including 
metadata version :)
   I believe if the cluster supports this api, it will also support the api 
versions that returns this. But might be a bit complicated 
   
   I wrote this before I saw the uuid check so maybe this is ok. I just wonder 
if it will be slow to check all the topic IDs each time.



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