[
https://issues.apache.org/jira/browse/KAFKA-19434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039912#comment-18039912
]
Eduwer Camacaro commented on KAFKA-19434:
-----------------------------------------
Hi,
I opened this PR that proposes an alternative solution to this issue
[https://github.com/apache/kafka/pull/20749]. Let me know what you think about
this approach that basically proposes some changes in the StateStores
lifecycle, but this will require modifications in KIP-1035.
> Move logic for for state store initiation to StreamThread handover
> ------------------------------------------------------------------
>
> Key: KAFKA-19434
> URL: https://issues.apache.org/jira/browse/KAFKA-19434
> Project: Kafka
> Issue Type: Task
> Components: streams
> Reporter: Bill Bejeck
> Assignee: Nikita Shupletsov
> Priority: Blocker
> Fix For: 4.2.0
>
>
> When starting a Kafka Streams instance, if it has pre-existing state, the
> state stores are initialized on the main thread. Part of this
> initialization registers the stateful metrics with the JMX thread-id tag of
> {{{}main{}}}. This breaks the KIP-1076 implementation where need to
> register metrics with thread-id tags of {{{}xxxStreamThread-N{}}}. This is
> necessary due to the fact that the {{StreamsMetric}} is a singleton shared
> by all {{StreamThread}} instances, so we need to make sure only add metrics
> for the current {{StreamThread}} otherwise duplicate metrics are
> registered. So the task is to move state store initialization to the point
> when the main thread hands the store over to the assigned `StreamThread`
--
This message was sent by Atlassian Jira
(v8.20.10#820010)