josefk31 commented on code in PR #21028:
URL: https://github.com/apache/kafka/pull/21028#discussion_r2879503969


##########
raft/src/test/java/org/apache/kafka/raft/MockLog.java:
##########
@@ -444,7 +445,11 @@ public LogFetchInfo read(long startOffset, Isolation 
isolation) {
             // complete batches, so batches which end at an offset larger than 
the max offset are
             // filtered, which is effectively the same as having the consumer 
drop an incomplete
             // batch returned in a fetch response.
-            if (batch.lastOffset() >= startOffset && batch.lastOffset() < 
maxOffset && !batch.entries.isEmpty()) {
+            //
+            if (batch.lastOffset() >= startOffset
+                    && batch.lastOffset() < maxOffset
+                    && !batch.entries.isEmpty()
+                    && (bufferSizeBytes - buffer.remaining()) < 
maxTotalBatchSizeBytes) {

Review Comment:
   Checks the amount of space we have left in the buffer. Was not able to 
figure out a better way to do this beyond "max size of buffer - remaining space"



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