apoorvmittal10 commented on code in PR #19010: URL: https://github.com/apache/kafka/pull/19010#discussion_r1969368571
########## core/src/main/java/kafka/server/share/SharePartition.java: ########## @@ -615,13 +615,44 @@ public long nextFetchOffset() { * Acquire the fetched records for the share partition. The acquired records are added to the * in-flight records and the next fetch offset is updated to the next offset that should be * fetched from the leader. + * <p> + * The method always acquire the full batch records. The cache state can consist of multiple + * full batches as a single batch. This behavior is driven by client configurations (batch size + * and max fetch records) and allows for efficient client acknowledgements. However, partial batches + * can exist in the cache only after a leader change and partial acknowledgements have been persisted + * prior leader change. In such case, when a share partition loses track of a batch's start and + * end offsets (e.g., after a leader change and partial acknowledgements), the cache stores the + * batch based on the offset range provided by the persister. This method handles these special + * batches by maintaining this range up to the last offset returned by the persister. No special + * handling is required after wards; the cache will eventually return to managing full batches. 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org