guozhangwang commented on code in PR #13300:
URL: https://github.com/apache/kafka/pull/13300#discussion_r1157835624


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java:
##########
@@ -986,6 +987,11 @@ private void prepareChangelogs(final 
Set<ChangelogMetadata> newPartitionsToResto
                 } catch (final Exception e) {
                     throw new StreamsException("State restore listener failed 
on batch restored", e);
                 }
+
+                final TaskId taskId = 
changelogs.get(partition).stateManager.taskId();
+                final StreamTask task = (StreamTask) tasks.get(taskId);
+                final long recordsToRestore = 
Math.max(changelogMetadata.restoreEndOffset - startOffset, 0L);

Review Comment:
   I've added a comment to cover the very edge case when it could become 
negative.



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