mjsax commented on a change in pull request #8818: URL: https://github.com/apache/kafka/pull/8818#discussion_r438392005
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java ########## @@ -514,17 +515,24 @@ void handleLostAll() { /** * Compute the offset total summed across all stores in a task. Includes offset sum for any tasks we own the - * lock for, which includes assigned and unassigned tasks we locked in {@link #tryToLockAllNonEmptyTaskDirectories()} - * - * @return Map from task id to its total offset summed across all state stores + * lock for, which includes assigned and unassigned tasks we locked in {@link #tryToLockAllNonEmptyTaskDirectories()}. + * Does not include stateless or non-logged tasks. */ public Map<TaskId, Long> getTaskOffsetSums() { final Map<TaskId, Long> taskOffsetSums = new HashMap<>(); - for (final TaskId id : lockedTaskDirectories) { + // Not all tasks will create directories, and there may be directories for tasks we don't currently own, + // so we consider all tasks that are either owned or on disk. This includes stateless tasks, which should + // just have an empty changelogOffsets map. + for (final TaskId id : union(HashSet::new, lockedTaskDirectories, tasks.keySet())) { Review comment: Why do we need to `union` both? Is `task.keySet()` not a super-set of `lockedTaskDirectories` ? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org