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


##########
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:
   I saw this null check in a few places. Is there a chance that this value is 
null or are we just trying to cover our bases?



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