lucasbru commented on code in PR #24313:
URL: https://github.com/apache/kafka/pull/24313#discussion_r4641627349
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java:
##########
@@ -1304,7 +1322,10 @@ public void maybeUpdateTaskOffsetSumSnapshot() {
}
final Map<TaskId, Long> offsetSums = new
HashMap<>(stateDirectory.taskOffsetSums());
- for (final Task task : allTasks().values()) {
+ for (final Task task : stateUpdater.tasks()) {
Review Comment:
`stateUpdater.tasks()` also contains tasks that are still in the updater's
input queue. We drop those here, but the updater only puts them into its
snapshot after it has processed the ADD and gone through `restore()`, which for
a new task includes the admin calls in `initializeChangelogs`. In between, the
task isn't reported at all, whereas before we'd report its offset without an
end offset, so the broker would take it as restoring.
If a heartbeat goes out in that window, the broker takes a restoring active
task as running (or a standby as not caught up) for one heartbeat. It corrects
itself and errs on the safe side, so it's not a big deal. But should we keep
the queued tasks here and only drop the restored/failed ones plus whatever the
updater snapshot already has? Just dropping what's in the updater snapshot
wouldn't work, since restored tasks waiting for the stream thread aren't in it
either.
More generally, did you consider letting the state updater report the
dormant tasks too? It owns the hand-off queues, so both sides of a hand-off
would be in one snapshot. The stream thread would then only need to publish the
set of tasks it's running, at assignment, revocation and when it picks up
restored tasks, so that wouldn't go stale while it's blocked.
--
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]