[
https://issues.apache.org/jira/browse/KAFKA-21610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150220#comment-18150220
]
Sean Quah commented on KAFKA-21610:
-----------------------------------
{quote}The first heartbeat that sees initialized partitions can then trigger
the assignment immediately, since there's no previous assignment timestamp to
enforce the interval against.
{quote}
This is racy and only saves a heartbeat when initialization finishes before the
acknowledgement heartbeat. The assignor run still needs to be scheduled on
{{{}initializeShareGroupState{}}}.
h4. Initialization finishes before the ack heartbeat (ι < ε)
Offload enabled, 1,000 ms assignment interval and 5,000 ms heartbeat.
ι is when initialization finishes and ε is when the ack heartbeat arrives.
||HB||Time||Coordinator||Response||
|1|+0|The member joins, which bumps the group epoch to 1. The run is skipped.
The initialize request is sent.|epoch 0, {{[]}}|
| |+0 + ι|Initialization finishes.| |
|2 (ack)|+0 + ε|{{{}assignmentTimestamp == 0{}}}, so assignment R1 is
scheduled.|epoch 0, {{[]}}|
| |+0 + ε|R1 installs assignment epoch 1 with the partitions.| |
|3|+5s|The member reconciles to assignment R1.|epoch 1, *partitions*|
h4. Initialization finishes after the ack heartbeat (ι > ε)
Offload enabled, 1,000 ms assignment interval and 5,000 ms heartbeat.
ι is when initialization finishes and ε is when the ack heartbeat arrives.
||HB||Time||Coordinator||Response||
|1|+0|The member joins, which bumps the group epoch to 1. The run is skipped.
The initialize request is sent.|epoch 0, {{[]}}|
|2 (ack)|+0 + ε|Nothing is initialized yet, so the run is skipped again.|epoch
0, {{[]}}|
| |+0 + ι|Initialization finishes.| |
|3|+5s|{{{}assignmentTimestamp == 0{}}}, so assignment R1 is scheduled.|epoch
0, {{[]}}|
| |+5s|R1 installs assignment epoch 1 with the partitions.| |
|4|+10s|The member reconciles to assignment R1.|epoch 1, *partitions*|
> Consider scheduling the share group assignor when share partitions are
> initialized
> ----------------------------------------------------------------------------------
>
> Key: KAFKA-21610
> URL: https://issues.apache.org/jira/browse/KAFKA-21610
> Project: Kafka
> Issue Type: Improvement
> Components: group-coordinator
> Affects Versions: 4.5.0
> Reporter: Sean Quah
> Assignee: 이선민
> Priority: Major
>
> With assignor offloading on, a new share group's first assignor run is
> scheduled before its share partitions are initialized, so that run assigns
> nothing. The partitions are only assigned after the next heartbeat bumps the
> group epoch and a second run completes. That costs members an extra heartbeat
> (see ShareConsumerCallbackTest.testAcknowledgementSentOnSubscriptionChange).
> Bump the group epoch and schedule the assignor run in
> initializeShareGroupState instead, so the second heartbeat already receives
> the assignment.
> https://github.com/apache/kafka/pull/24319 will add a test scenario for this.
> Please wait until that PR has been merged before starting this work.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)