You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Jonah Hooper (Jira)" <ji...@apache.org> on 2026/03/09 16:47:00 UTC

[jira] [Created] (KAFKA-20286) Refactor ControllerRegistrationManager

Jonah Hooper created KAFKA-20286:
------------------------------------

             Summary: Refactor ControllerRegistrationManager
                 Key: KAFKA-20286
                 URL: https://issues.apache.org/jira/browse/KAFKA-20286
             Project: Kafka
          Issue Type: Improvement
            Reporter: Jonah Hooper


It may be possible to simplify the ControllerRegistrationManager class. It currently has a slight problem where it is not clear that modifications of the classes internal state happens in multiple threads. 

For example:

[pendingRpc=false]([https://github.com/confluentinc/ce-kafka/blob/c53057794ea2af07ad88d98c98db84134faf73b4/core/src/main/scala/kafka/server/ControllerRegistrationManager.scala#L241|https://github.com/apache/kafka/blob/4ea29da3ca1776f6870905eed015ef5751e4866c/core/src/main/scala/kafka/server/ControllerRegistrationManager.scala#L241]) will always be run in `eventQueue`.  

But [onTimeout](https://github.com/apache/kafka/blob/4ea29da3ca1776f6870905eed015ef5751e4866c/core/src/main/scala/kafka/server/ControllerRegistrationManager.scala#L236) is called in NodeToControllerRequestThread. 

While the synchronization is unlikely to actually cause problems it does make the code a lot harder to reason about which could lead to future subtle bugs. 

Ideally we would refactor this class to make it clear in which state thread is modified. This could be part of a rewrite to Java. 



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