chirag-wadhwa5 commented on code in PR #18696:
URL: https://github.com/apache/kafka/pull/18696#discussion_r1935475235


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -444,6 +450,11 @@ public CompletableFuture<Void> maybeInitialize() {
                 stateEpoch = partitionData.stateEpoch();
 
                 List<PersisterStateBatch> stateBatches = 
partitionData.stateBatches();
+                boolean isGapPresentInStateBatches = false;
+                // The previousBatchLastOffset is used to track the last 
offset of the previous batch.
+                // For the first batch that should ideally start from 
startOffset if there are no gaps,
+                // we assume the previousBatchLastOffset to be startOffset - 1.
+                long previousBatchLastOffset = startOffset - 1;

Review Comment:
   Thanks for the review. So, if the startOffset is 10 and the first batch is 
11-20, there is a gap for offset 10. But that will be missed, as 
previousBatchLastOffset will be 10, and the condition will return false (11 > 
10+1), and we will consider that not to be a gap. 



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