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


##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -51,13 +52,20 @@ public static Builder forMagic(byte magic, 
ProduceRequestData data) {
         if (magic < RecordBatch.MAGIC_VALUE_V2) {
             minVersion = 2;
             maxVersion = 2;
+        } else if (canNotSupportTopicId(data)) {
+            minVersion = 3;
+            maxVersion = 11;
         } else {
             minVersion = 3;
             maxVersion = ApiKeys.PRODUCE.latestVersion();
         }
         return new Builder(minVersion, maxVersion, data);
     }
 
+    private static boolean canNotSupportTopicId(ProduceRequestData data) {
+        return data.topicData().stream().anyMatch(d -> d.topicId() == null || 
d.topicId() == Uuid.ZERO_UUID);

Review Comment:
   just covering our bases, but in this method we will not get null as the 
ProduceRequest constructor has ZERO_UUID as default. Will tide this up 



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