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


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1138,6 +1185,7 @@ private void acquireSubsetBatchRecords(
         } finally {
             lock.writeLock().unlock();
         }
+        return result.size();

Review Comment:
   > Currently in this method we add result for every offset hence the count is 
the size of the result
   
   We're using the same results object when calling 
`acquireSubsetBatchRecords`, so results.size will return the total count of all 
added offsets across each call. Does the condition `if (!fullMatch || 
inFlightBatch.offsetState() != null)` get matched only once while looping 
through `subMap`?
   ```
                       int acquiredSubsetCount = 
acquireSubsetBatchRecords(memberId, firstBatch.baseOffset(), 
lastBatch.lastOffset(), inFlightBatch, result);
                       acquiredCount += acquiredSubsetCount;
   ```



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