You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/01/05 06:05:45 UTC

[GitHub] [kafka] showuon commented on pull request #11631: [WIP] KAFKA-13563: clear FindCoordinatorFuture for non consumer group mode

showuon commented on pull request #11631:
URL: https://github.com/apache/kafka/pull/11631#issuecomment-1005407357


   @guozhangwang , answer your question below:
   
   > I'm wondering if this fix is a bit overkill, e.g. for those consumers who do not even set the group ID and do not rely on the coordinator for anything, the coordinatorUnknown() would always return true while ensureCoordinatorReady would send a discover coordinator request with null group id.
   
   No, if consumer doesn't provide group id config value (default is null), we won't create `consumerCoordinator` in the consumer. That is, if the group id is provided, it's either with consumer group management (via Consumer#subscribe), or with manual assignment (via Consumer#assign) with offset commit enabled. 
   
   REF: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L775
   
   And before the PR, we will wait for the metadata update if no nodes available, to avoid busy loop when in non consumer group mode.
   
   ```java
   if (metadata.updateRequested() && !client.hasReadyNodes(timer.currentTimeMs())) {
       client.awaitMetadataUpdate(timer);
   ```
   
   After the change, we did as the group management did, to call `ensureCoordinatorReady` when coordinator unknown. And in `ensureCoordinatorReady`. This way, we can also make sure to handle the `FindCoordinatorFuture` well (and clear it) inside `ensureCoordinatorReady`.
   
   Does that make sense?


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org