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)