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/11/22 16:32:00 UTC

[jira] [Created] (KAFKA-18071) Avoid unneeded background event to refresh regex if no subscription pattern in use

Lianet Magrans created KAFKA-18071:
--------------------------------------

             Summary: Avoid unneeded background event to refresh regex if no subscription pattern in use
                 Key: KAFKA-18071
                 URL: https://issues.apache.org/jira/browse/KAFKA-18071
             Project: Kafka
          Issue Type: Improvement
          Components: clients, consumer
            Reporter: Lianet Magrans
            Assignee: Lianet Magrans
             Fix For: 4.0.0


With the new consumer, the poll loop currently generates an 
UpdatePatternSubscriptionEvent on each poll iteration, that is processed in the background to re-eval the subscription regex against the latest metadata (if there is new metadata).
 
If the consumer is not subscribed to a pattern, we still generate this event, and early return in the background thread if !hasSubscriptionPattern. We should consider short-circuiting this on the app thread, to avoid generating the event and blocking on it's processing if not needed.
 
Note that checking subscription.hasSubscriptionPattern in the app thread should be safe given that it changes only triggered from the app thread, when calling subscribe(Pattern), which blocks until the subscription state is updated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)