adixitconfluent commented on code in PR #18696:
URL: https://github.com/apache/kafka/pull/18696#discussion_r1930349043


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -462,6 +474,10 @@ public CompletableFuture<Void> maybeInitialize() {
                     // in the cached state are not missed
                     findNextFetchOffset.set(true);
                     endOffset = 
cachedState.lastEntry().getValue().lastOffset();
+                    // initialReadGapOffset is not required, if there are no 
gaps in the read state response
+                    if (isGapPresentInStateBatches) {
+                        initialReadGapOffset = new 
InitialReadGapOffset(endOffset, startOffset);

Review Comment:
   @apoorvmittal10,  suppose readState RPC returns the result as startOffset as 
15 and state batches from 15-20 and 30-40, which means the gaps offsets is from 
21-29. Now with the current logic, `initialReadGapOffset` will have 
`gapStartOffset` as 15. However, a more efficient approach would be to 
initialize the `initialReadGapOffset` with `gapStartOffset` as 21. Wdyt?



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

Reply via email to