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


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1177,6 +1235,24 @@ private boolean initializedOrThrowException() {
         };
     }
 
+    // Method to reduce the window that tracks gaps in the cachedState
+    private void maybeUpdateReadGapFetchOffset(long offset) {
+        lock.writeLock().lock();
+        try {
+            if (initialReadGapOffset != null) {
+                if (initialReadGapOffset.endOffset() == endOffset) {
+                    initialReadGapOffset.gapStartOffset(offset);
+                } else {
+                    // The initial read gap offset is not valid anymore as the 
end offset has moved
+                    // beyond the initial read gap offset. Hence, reset the 
initial read gap offset.
+                    initialReadGapOffset = null;

Review Comment:
   I don't think we have a unit test yet that covers this line of code, 
basically when endOffset has moved beyond the gap offsets. Can we please add it?



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