Chia-Ping Tsai created KAFKA-16574:
--------------------------------------
Summary: The metrics of LogCleaner disappear after reconfiguration
Key: KAFKA-16574
URL: https://issues.apache.org/jira/browse/KAFKA-16574
Project: Kafka
Issue Type: Bug
Reporter: Chia-Ping Tsai
Assignee: Chia-Ping Tsai
see
[https://github.com/apache/kafka/blob/a3dcbd4e28a35f79f75ec1bf316ef0b39c0df164/core/src/main/scala/kafka/log/LogCleaner.scala#L227]
We don't rebuild the metrics after calling shutdown. The following test can
prove that.
{code:java}
@Test
def testMetricsAfterReconfiguration(): Unit = {
val logCleaner = new LogCleaner(new CleanerConfig(true),
logDirs = Array(TestUtils.tempDir()),
logs = new Pool[TopicPartition, UnifiedLog](),
logDirFailureChannel = new LogDirFailureChannel(1),
time = time)
def check(): Unit =
LogCleaner.MetricNames.foreach(name =>
assertNotNull(KafkaYammerMetrics.defaultRegistry.allMetrics().get(logCleaner.metricsGroup
.metricName(name, java.util.Collections.emptyMap())), s"$name is gone?"))
try {
check()
logCleaner.reconfigure(new KafkaConfig(TestUtils.createBrokerConfig(1,
"localhost:2181")),
new KafkaConfig(TestUtils.createBrokerConfig(1, "localhost:2181")))
check()
} finally logCleaner.shutdown()
} {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)