mjsax commented on code in PR #23991:
URL: https://github.com/apache/kafka/pull/23991#discussion_r4557139368


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java:
##########
@@ -800,7 +801,11 @@ private void maybeAdvanceStandbyRestoredOffset(final 
ProcessorStateManager state
                 // the next offset to fetch, not last-applied
                 final OptionalLong lag = restoreConsumer.currentLag(partition);
                 if (lag.isPresent() && lag.getAsLong() == 0L) {
-                    stateManager.advanceRestoredOffsetTo(storeMetadata, 
restoreConsumer.position(partition, Duration.ZERO));
+                    final long position = restoreConsumer.position(partition, 
Duration.ZERO);
+                    stateManager.advanceRestoredOffsetTo(storeMetadata, 
position);
+                    // the end offset is otherwise only learned from a 
restored batch, which never comes when
+                    // there is nothing to restore; like there, it is the last 
offset, -1 for an empty changelog
+                    storeMetadata.setEndOffset(position - 1L);

Review Comment:
   > so it keeps reporting lag 0 for the whole active restore
   
   I think the "lag 0" case would only be a corner case, right (eg, empty 
changelog, or position==endOffset by chance)? When we transit to active 
restore, both position (task-offset) and endOffset (task-end-offset) just 
freeze. The lag may be larger than 0 though.



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