[
https://issues.apache.org/jira/browse/KAFKA-21576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matthias J. Sax updated KAFKA-21576:
------------------------------------
Description:
Under the streams group protocol, a client reports the changelog offsets of the
active tasks it is restoring, and their end offsets. The coordinator treats an
active task with a reported offset as restoring. With an end offset, it can
tell whether the task is caught up.
The client computes the two values on different threads:
* TaskManager.maybeUpdateTaskOffsetSumSnapshot() runs on the stream thread,
once per runOnce(). It reports the offset of every assigned task that is not
RUNNING.
* DefaultStateUpdater.updateTaskEndOffsetSumSnapshot() runs on the state
updater thread, once per loop. It computes end offsets only for the tasks the
state updater is still restoring or updating.
Once the state updater completes an active task's restore, it drops the task's
end offset right away. The task's offset stays in the stream thread's snapshot
until that thread recomputes the snapshot after taking over the restored task.
In between, the client reports the task with an offset and without an end
offset. The coordinator sees the owner as restoring with an unknown lag. The
warm-up refiner then counts the owner's state as not usable, and moves the task
cold when the target assignment gives it to another member.
The gap lasts as long as the stream thread is busy, for example processing a
record that takes long or running a punctuation. The heartbeat thread keeps
sending the stale offset in the meantime.
was:
Under the streams group protocol, a client reports the changelog offsets of the
active tasks it is restoring. The coordinator treats an active task with a
reported offset as restoring, and with an end offset, it can tell whether the
task is caught up.
An active task that has finished restoring but is not running yet is reported
with an offset but without an end offset:
* TaskManager.maybeUpdateTaskOffsetSumSnapshot() reports the offset of every
task that is not RUNNING.
* DefaultStateUpdater.updateTaskEndOffsetSumSnapshot() computes end offsets
only for the tasks the state updater is still restoring. A restored task
waiting in restoredActiveTasks is not among them.
The coordinator therefore sees the owner as restoring with an unknown lag. The
warm-up refiner then counts the owner's state as not usable, and moves a task
the target assignment gives to another member without warming it up first.
The window lasts as long as the group is not ready: StreamThread.runOnce()
returns before draining restored tasks while streamsGroupReady is false. A
member whose first tasks arrive together with ASSIGNMENT_DELAYED (for example,
because another member joined within group.streams.assignment.interval.ms)
stays not ready until the next assignment, and reports its restored active
tasks with offsets but without end offsets until then. If the coordinator
refines the assignment in that time, it moves the member's tasks without
warming them up.
> Streams client can report an active task's offset without its end offset
> after the task finished restoring
> ----------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-21576
> URL: https://issues.apache.org/jira/browse/KAFKA-21576
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 4.4.0
> Reporter: Matthias J. Sax
> Assignee: Matthias J. Sax
> Priority: Major
> Fix For: 4.5.0, 4.4.1
>
>
> Under the streams group protocol, a client reports the changelog offsets of
> the active tasks it is restoring, and their end offsets. The coordinator
> treats an active task with a reported offset as restoring. With an end
> offset, it can tell whether the task is caught up.
> The client computes the two values on different threads:
> * TaskManager.maybeUpdateTaskOffsetSumSnapshot() runs on the stream thread,
> once per runOnce(). It reports the offset of every assigned task that is not
> RUNNING.
> * DefaultStateUpdater.updateTaskEndOffsetSumSnapshot() runs on the state
> updater thread, once per loop. It computes end offsets only for the tasks the
> state updater is still restoring or updating.
> Once the state updater completes an active task's restore, it drops the
> task's end offset right away. The task's offset stays in the stream thread's
> snapshot until that thread recomputes the snapshot after taking over the
> restored task. In between, the client reports the task with an offset and
> without an end offset. The coordinator sees the owner as restoring with an
> unknown lag. The warm-up refiner then counts the owner's state as not usable,
> and moves the task cold when the target assignment gives it to another member.
> The gap lasts as long as the stream thread is busy, for example processing a
> record that takes long or running a punctuation. The heartbeat thread keeps
> sending the stale offset in the meantime.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)