jsancio commented on a change in pull request #10085:
URL: https://github.com/apache/kafka/pull/10085#discussion_r623370233



##########
File path: raft/src/test/java/org/apache/kafka/raft/MockLog.java
##########
@@ -363,33 +362,30 @@ public LogFetchInfo read(long startOffset, Isolation 
isolation) {
         }
 
         ByteBuffer buffer = ByteBuffer.allocate(512);
-        LogEntry firstEntry = null;
+        LogOffsetMetadata batchStartOffset = null;
 
         for (LogBatch batch : batches) {
             // Note that start offset is inclusive while max offset is 
exclusive. We only return
             // 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) {
-                if (batch.lastOffset() < maxOffset) {
-                    buffer = batch.writeTo(buffer);
-                }
+            if (batch.lastOffset() >= startOffset && batch.lastOffset() < 
maxOffset && !batch.entries.isEmpty()) {

Review comment:
       I wanted to keep the tests reproducible. As a comprise I changed this 
code to read at most 2 batches. We can revisit this in the future and make it 
random but reproducible.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to