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


##########
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:
   I wonder if we should also confirm that the IBP is at least 2.8 on the 
cluster. (Note this only applies to ZK clusters as all kraft clusters are 3.0 
and above/have topic IDs)
   
   There is a case someone is running a new cluster with a very old IBP.
   
   This check would be similar to what 
`!topicIds.entrySet().stream().anyMatch(e -> e.getValue() == Uuid.ZERO_UUID)` 
was doing before.



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