apoorvmittal10 commented on code in PR #19010:
URL: https://github.com/apache/kafka/pull/19010#discussion_r1967817622


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -651,13 +682,19 @@ public ShareAcquiredRecords acquire(
         lock.writeLock().lock();
         try {
             long baseOffset = firstBatch.baseOffset();
+            // There might be cached batches which are stale due to topic 
compaction hence archive them.
+            maybeArchiveStaleBatches(fetchOffset, baseOffset);
             // Find the floor batch record for the request batch. The request 
batch could be
             // for a subset of the in-flight batch i.e. cached batch of offset 
10-14 and request batch
             // of 12-13. Hence, floor entry is fetched to find the sub-map.
             Map.Entry<Long, InFlightBatch> floorOffset = 
cachedState.floorEntry(baseOffset);

Review Comment:
   Done.



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