JimmyWang6 commented on code in PR #20246:
URL: https://github.com/apache/kafka/pull/20246#discussion_r2462652375


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -748,8 +752,13 @@ public ShareAcquiredRecords acquire(
                     groupId, topicIdPartition);
                 // It's safe to use lastOffsetToAcquire instead of 
lastBatch.lastOffset() because there is no
                 // overlap hence the lastOffsetToAcquire is same as 
lastBatch.lastOffset() or before that.
-                ShareAcquiredRecords shareAcquiredRecords = 
acquireNewBatchRecords(memberId, fetchPartitionData.records.batches(),
+                ShareAcquiredRecords shareAcquiredRecords = 
acquireNewBatchRecords(memberId, fetchPartitionData.records.batches(), 
isRecordLimitMode,
                     firstBatch.baseOffset(), lastOffsetToAcquire, batchSize, 
maxRecordsToAcquire);
+                if (isRecordLimitMode && shareAcquiredRecords.count() > 
maxRecordsToAcquire) {
+                    AcquiredRecords records = 
filterShareAcquiredRecordsInRecordLimitMode(maxRecordsToAcquire, 
shareAcquiredRecords.acquiredRecords());
+                    // Return only single batch of filtered records.
+                    shareAcquiredRecords = new 
ShareAcquiredRecords(List.of(records), maxRecordsToAcquire);
+                }

Review Comment:
   Thanks for your detailed suggestion! I have changed accordingly, please take 
a look again :)



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