ShivsundarR commented on code in PR #20752:
URL: https://github.com/apache/kafka/pull/20752#discussion_r2454861739


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareCompletedFetch.java:
##########
@@ -100,9 +100,16 @@ public class ShareCompletedFetch {
 
     private List<OffsetAndDeliveryCount> 
buildAcquiredRecordList(List<ShareFetchResponseData.AcquiredRecords> 
partitionAcquiredRecords) {
         List<OffsetAndDeliveryCount> acquiredRecordList = new LinkedList<>();
+        // Set to find duplicates in case of overlapping acquired records
+        Set<Long> offsets = new HashSet<>();

Review Comment:
   I had a look into making the 
`acquiredRecordsList(LinkedList<OffsetAndDeliveryCount>)` into a 
`LinkedHashMap` This change would actually have a bit of a code change around 
`listIterator`, we might have to use `map.entrySet().iterator()` for rewinding 
to the start of the list.
   And as we are doing sequential operations and not key based, probably better 
to keep it as a list?
   I have changed it to `ArrayList` instead of a `LinkedList` though as it 
would give better iteration performance for build once and iterate use cases.
   



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