danielqsj / kafka_exporter

Kafka exporter for Prometheus
Apache License 2.0
2.22k stars 615 forks source link

Topic being recreated after deletion #45

Closed conorfennell closed 6 years ago

conorfennell commented 6 years ago

Version: danielqsj/kafka-exporter:v1.1.0

Observation

I have a hunch that there is a race condition when: Step 1. kafka-exporter -> Request for current topics
Step 2. Someone deletes a topic Step 3. kafka-exporter -> Request for deleted topic metadata which cause the topic to be recreated with default parmameters.

Reproduce

While kafka exporter is running.

Step 1: Create Topic kafka-topics --zookeeper $ZOOKEEPER --create --topic delete-me --partitions 3 --replication-factor 1

Step 2: Delete Topic kafka-topics --zookeeper $ZOOKEEPER --delete --topic delete-me

Step 3: List topics; wait 0-30 seconds kafka-topics --zookeeper $ZOOKEEPER --list

danielqsj commented 6 years ago

@conorfennell This is fixed in v1.2.0. Please try the newest image.

conorfennell commented 6 years ago

@danielqsj Thank you! just verified it.

canghai118 commented 3 years ago

我最近也遇到这个问题。能指出具体哪个commit中修复的这个问题吗? 学习一下是如何修复的。 thanks

@conorfennell This is fixed in v1.2.0. Please try the newest image.

canghai118 commented 3 years ago

I think this bug still exists in latest version, currenty is v1.3.1

kafka cluster is configured with auto.topic.create.enabled = true, topic is recreated by kafka-exporter after delete

canghai118 commented 3 years ago

I think update to latest sarama may solve this problem

AllowAutoTopicCreation now can be disabled through client configration.

https://github.com/Shopify/sarama/blob/master/client.go#L879

menghe999 commented 1 year ago

我最近也遇到这个问题。能指出具体哪个commit中修复的这个问题吗? 学习一下是如何修复的。 thanks

@conorfennell This is fixed in v1.2.0. Please try the newest image.

+1