You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Edoardo Comar (Jira)" <ji...@apache.org> on 2025/12/24 12:22:00 UTC

[jira] [Commented] (KAFKA-5238) BrokerTopicMetrics can be recreated after topic is deleted

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

Edoardo Comar commented on KAFKA-5238:
--------------------------------------

I have rebased on current trunk 4.3 and the test never seem to fail for me even if theĀ 
guard in KafkaAPis is removed.

So I think this bug no longer shows (as easily at least)

> BrokerTopicMetrics can be recreated after topic is deleted
> ----------------------------------------------------------
>
>                 Key: KAFKA-5238
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5238
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Ismael Juma
>            Assignee: Edoardo Comar
>            Priority: Major
>
> As part of KAFKA-3258, we added code to remove metrics during topic deletion. This works fine as long as there are no fetch requests in the purgatory. If there are, however, we'll recreate the metrics when we call `ReplicaManager.appendToLocalLog`.
> This can be reproduced by updating MetricsTest.testBrokerTopicMetricsUnregisteredAfterDeletingTopic() in the following way:
> {code}
> @Test
>   def testBrokerTopicMetricsUnregisteredAfterDeletingTopic() {
>     val topic = "test-broker-topic-metric"
>     AdminUtils.createTopic(zkUtils, topic, 2, 1)
>     // Produce a few messages and consume them to create the metrics
>     TestUtils.produceMessages(servers, topic, nMessages)
>     TestUtils.consumeTopicRecords(servers, topic, nMessages)
>     assertTrue("Topic metrics don't exist", topicMetricGroups(topic).nonEmpty)
>     assertNotNull(BrokerTopicStats.getBrokerTopicStats(topic))
>     AdminUtils.deleteTopic(zkUtils, topic)
>     TestUtils.verifyTopicDeletion(zkUtils, topic, 1, servers)
>     Thread.sleep(10000)
>     assertEquals("Topic metrics exists after deleteTopic", Set.empty, topicMetricGroups(topic))
>   }
> {code}



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