mingyen066 commented on code in PR #21577:
URL: https://github.com/apache/kafka/pull/21577#discussion_r2894490870


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/TransactionIndex.java:
##########
@@ -216,22 +221,19 @@ private FileChannel channelOrNull() {
     }
 
     private Iterable<AbortedTxnWithPosition> iterable() {
-        return iterable(() -> ByteBuffer.allocate(AbortedTxn.TOTAL_SIZE));
-    }
-
-    private Iterable<AbortedTxnWithPosition> iterable(Supplier<ByteBuffer> 
allocate) {
         FileChannel channel = channelOrNull();
         if (channel == null)
             return List.of();
 
+        ByteBuffer buffer = ByteBuffer.allocate(ABORTED_TXN_RECORD_SIZE);
         PrimitiveRef.IntRef position = PrimitiveRef.ofInt(0);
 
         return () -> new Iterator<>() {

Review Comment:
   Thanks for catching this! Moved buffer and position inside the lambda and 
added a test.



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