[ 
https://issues.apache.org/jira/browse/KAFKA-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862112#comment-15862112
 ] 

Colin P. McCabe commented on KAFKA-4756:
----------------------------------------

I put up a patch for this that fixes the issue.

So, the tricky issue here is that the broker id may be explicitly set in the 
configuration that the user passes, or the broker id may be determined at 
runtime (when broker id generation is enabled.)  Even though the broker id can 
be changed, this change does not propagate to the original map of string -> 
object which backs the KafkaConfiguration object.  The KafkaConfiguration class 
is almost entirely immutable and the broker id is one of the few mutable 
fields.  My patch works around this by creating the reporter objects with an 
explicit "configuration override" that sets the broker id field, even though it 
is not necessarily set in the configuration map.

Detailed overview:
* KafkaServer.scala: Do not create the reporters inside the KafkaConfig object 
constructor.  Instead, create them after the broker id is known in 
KafkaServer's constructor.
* AbstractConfig.java: add a method that can instantiate a list of configurable 
objects with configuration overrides.
* KafkaMetricReporterClusterIdTest: add a test that clsuter id is set in the 
configuration that we are passed.  I confirmed that this fails without the rest 
of the patch.

> The auto-generated broker id should be passed to MetricReporter.configure
> -------------------------------------------------------------------------
>
>                 Key: KAFKA-4756
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4756
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Ismael Juma
>            Assignee: Colin P. McCabe
>
> We currently pass the original config values and we initialise the metric 
> reporters in the constructor of `KafkaServer` while we get the generated 
> broker id in the `startup` method.
> We should also check if there's any other pluggable interface that suffers 
> from the same issue.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to