[
https://issues.apache.org/jira/browse/KAFKA-17017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17862584#comment-17862584
]
Lianet Magrans commented on KAFKA-17017:
----------------------------------------
Hey [~yangpoan] / [~chia7712] , sorry I missed this, was out for a few days.
Fair issue, the intention was not to change the behaviour, I agree with the gap
reported.
Thinking about an approach, I would imagine that we could simply delegate
everything on the UnsubscribeEvent, meaning that the AsyncConsumer#unsubscribe
would not bother checking if in group or not (no need for point 1 above), and
we would just trigger the UnsuscribeEvent to address this situation in a single
place (point 2 above only):
{quote}2) `MembershipManagerImpl#leaveGroup` should call
`subscriptions.unsubscribe` if the `isNotInGroup` is true
{quote}
Not sure if I'm missing a detail, but seems like a consistent/simple approach
to solve this. The membershipMgr already calls subscriptions.unsubscribe when
it leave the group (on the leaveGroup()), so we would just complete the story
to cover the not in group case, but all handled in the same component.
> AsyncConsumer#unsubscribe does not clean the assigned partitions
> ----------------------------------------------------------------
>
> Key: KAFKA-17017
> URL: https://issues.apache.org/jira/browse/KAFKA-17017
> Project: Kafka
> Issue Type: Bug
> Reporter: Chia-Ping Tsai
> Assignee: PoAn Yang
> Priority: Major
> Labels: kip-848-client-support
>
> According to docs [0] `Consumer#unsubscribe` should clean both subscribed and
> assigned partitions. However, there are two issues about `AsyncConsumer`
> 1) if we don't set group id, `AsyncConsumer#unsubscribe`[1] will be no-op
> 2) if we set group id, `AsyncConsumer` is always in `UNSUBSCRIBED` state and
> so `MembershipManagerImpl#leaveGroup`[2] will be no-op
> [0]
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L759
> [1]
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1479
> [2]
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/MembershipManagerImpl.java#L666
--
This message was sent by Atlassian Jira
(v8.20.10#820010)