[ 
https://issues.apache.org/jira/browse/KAFKA-21610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150040#comment-18150040
 ] 

이선민 commented on KAFKA-21610:
-----------------------------

Hi [~squah-confluent], now that PR #24319 has merged, I'd like to pick this up 
if you haven't already started on it.

Reading through the offloading path, bumping the group epoch and scheduling a 
run from {{initializeShareGroupState}} doesn't seem to be enough on its own in 
two cases:

# The first run has already installed its empty assignment. With the default 
1000 ms value for {{group.share.assignment.interval.ms}}, 
{{canComputeNextTargetAssignment}} returns false if initialization finishes 
less than 1000 ms after the empty assignment was computed. 
({{testShareGroupAsyncTargetAssignmentWithPartitionInitialization}} sets the 
interval to 0, so it doesn't hit this.) I think the initialization path needs 
to bypass the interval.
# The first run is still in flight, as in that test. Bumping to the next epoch 
doesn't cancel it, because {{maybeCancelStaleTargetAssignmentUpdate}} only 
cancels runs at or above the new epoch, and no new run can be scheduled while 
one is in flight. I'd cancel it explicitly and schedule a replacement for the 
new epoch.

For the implementation, I'm thinking of extracting the scheduling logic from 
{{maybeUpdateTargetAssignment}} so {{initializeShareGroupState}} can call it 
without a heartbeating member. I'd pass the updated set of initialized 
partitions into the group spec explicitly, since the initialization record 
hasn't been replayed at that point.

Does that approach sound reasonable? In particular, is it OK for the 
initialization path to bypass the interval?

> 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)

Reply via email to