chia7712 commented on code in PR #24239:
URL: https://github.com/apache/kafka/pull/24239#discussion_r4667300745


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/UnifiedLog.java:
##########
@@ -1210,8 +1212,12 @@ private LogAppendInfo append(MemoryRecords records,
 
                                     String firstOrLast = hasFirstOffset ? 
"First offset" : "Last offset of the first batch";
                                     List<String> offsets = new ArrayList<>();
-                                    for (Record record : records.records()) {
-                                        
offsets.add(String.valueOf(record.offset()));
+                                    for (RecordBatch batch : 
records.batches()) {

Review Comment:
   ```java
                                       try (CloseableIterator<Record> iterator 
= records.records()) {
                                           while (offsets.size() < 10 && 
iterator.hasNext()) {
                                               
offsets.add(String.valueOf(iterator.next().offset()));
                                           }
                                       }
   ```



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