You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Lianet Magrans (Jira)" <ji...@apache.org> on 2024/10/08 14:17:00 UTC
[jira] [Updated] (KAFKA-17726) New consumer subscribe/subscribeFromPattern in background thread
[ https://issues.apache.org/jira/browse/KAFKA-17726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lianet Magrans updated KAFKA-17726:
-----------------------------------
Fix Version/s: 4.0.0
> New consumer subscribe/subscribeFromPattern in background thread
> ----------------------------------------------------------------
>
> Key: KAFKA-17726
> URL: https://issues.apache.org/jira/browse/KAFKA-17726
> Project: Kafka
> Issue Type: Bug
> Components: clients, consumer
> Reporter: Lianet Magrans
> Priority: Major
> Labels: consumer-threading-refactor, kip-848-client-support
> Fix For: 4.0.0
>
>
> There are still some calls to change the subscriptionState subscription in the app thread, that could lead to race-conditions given that the subscription state object is shared between the background and app thread and is mostly updated in the background. We should consider moving the subscriptionState.subscribe() and subscribeFromPattern calls to the background.
> [https://github.com/apache/kafka/blob/5624bc7c7e43339eb64e18491ac5039324e50678/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1465]
> [https://github.com/apache/kafka/blob/5624bc7c7e43339eb64e18491ac5039324e50678/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1703]
> [https://github.com/apache/kafka/blob/5624bc7c7e43339eb64e18491ac5039324e50678/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1736]
> One option would be to use the existing SubscriptionChangeEvent, perform the subscription (and metadata) changes in the AppEventProcessor (where unsubscribe already takes place).
> Note that these calls are closely related to metadata object calls, to request metadata for new topics and "maybeUpdateSubscriptionMetadata". We should maybe consider moving them together to the background (where the metadata object is also updated). [https://github.com/apache/kafka/blob/5624bc7c7e43339eb64e18491ac5039324e50678/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1703-L1705]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)