ashwinpankaj commented on code in PR #12462:
URL: https://github.com/apache/kafka/pull/12462#discussion_r938422637


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java:
##########
@@ -394,13 +397,15 @@ private RecordAppendResult tryAppend(long timestamp, 
byte[] key, byte[] value, H
             int initialBytes = last.estimatedSizeInBytes();
             FutureRecordMetadata future = last.tryAppend(timestamp, key, 
value, headers, callback, nowMs);
             if (future == null) {
+                // producerBatch doesn't have anymore room, return then try to 
create a new batch.
                 last.closeForRecordAppends();
+                return null;
             } else {
                 int appendedBytes = last.estimatedSizeInBytes() - initialBytes;
                 return new RecordAppendResult(future, deque.size() > 1 || 
last.isFull(), false, false, appendedBytes);
             }
         }
-        return null;
+        return new RecordAppendResult(null, false, true, false, 0);

Review Comment:
   nit: add a comment that new batch needs to be created



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