guozhangwang commented on code in PR #13300: URL: https://github.com/apache/kafka/pull/13300#discussion_r1128785406
########## 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: Not very compelling reasons, I just want to make sure we do not start with a negative number, but I cannot think of a case that it could be 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