Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16574

The metrics of LogCleaner disappear after reconfiguration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.9.0
    • None
    • None

    Description

      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.

      @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()
      } 

      Attachments

        Issue Links

          Activity

            People

              chiacyu Chia-Chuan Yu
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: