Jeffrey Tolar created KAFKA-14271: ------------------------------------- Summary: Topic recreation fails in KRaft mode when topic contains collidable characters Key: KAFKA-14271 URL: https://issues.apache.org/jira/browse/KAFKA-14271 Project: Kafka Issue Type: Bug Components: kraft Affects Versions: 3.3.0 Reporter: Jeffrey Tolar Attachments: topic.with.dots.log, topicwithoutdots.log
We recently updated one of our clusters from 3.2.0 to 3.3.0 (primarily to get the fix forĀ KAFKA-13909). This cluster is running KRaft mode. This is a cluster used for some integration tests - each test deletes the topics it uses before the test to ensure a clean slate for the test; the brokers get restarted in-between tests, but the broker data isn't deleted. With 3.3.0, this semi-crashes Kafka. The brokers stay running, but the topic creation fails: {noformat} [2022-09-30 17:17:59,216] WARN [Controller 1] createTopics: failed with unknown server exception NoSuchElementException at epoch 1 in 601 us. Renouncing leadership and reverting to the last committed offset 18. (org.apache.kafka.controller.QuorumController) java.util.NoSuchElementException at org.apache.kafka.timeline.SnapshottableHashTable$CurrentIterator.next(SnapshottableHashTable.java:167) at org.apache.kafka.timeline.SnapshottableHashTable$CurrentIterator.next(SnapshottableHashTable.java:139) at org.apache.kafka.timeline.TimelineHashSet$ValueIterator.next(TimelineHashSet.java:120) at org.apache.kafka.controller.ReplicationControlManager.validateNewTopicNames(ReplicationControlManager.java:799) at org.apache.kafka.controller.ReplicationControlManager.createTopics(ReplicationControlManager.java:567) at org.apache.kafka.controller.QuorumController.lambda$createTopics$7(QuorumController.java:1832) at org.apache.kafka.controller.QuorumController$ControllerWriteEvent.run(QuorumController.java:767) at org.apache.kafka.queue.KafkaEventQueue$EventContext.run(KafkaEventQueue.java:121) at org.apache.kafka.queue.KafkaEventQueue$EventHandler.handleEvents(KafkaEventQueue.java:200) at org.apache.kafka.queue.KafkaEventQueue$EventHandler.run(KafkaEventQueue.java:173) at java.base/java.lang.Thread.run(Thread.java:829) {noformat} This appears to be because our topic names contain {{.}}'s. Here's a quick reproducer script: {noformat} #!/bin/bash VERSION=3.3.0 TOPIC=$1 set -x rm -rf -- kafka_2.13-${VERSION} kafka_2.13-${VERSION}.tgz /tmp/kraft-combined-logs trap 'kill -- "-$$" && wait' EXIT curl -O https://dlcdn.apache.org/kafka/$VERSION/kafka_2.13-${VERSION}.tgz tar -xzf kafka_2.13-${VERSION}.tgz cd kafka_2.13-${VERSION} id=$(./bin/kafka-storage.sh random-uuid) ./bin/kafka-storage.sh format -t $id -c ./config/kraft/server.properties ./bin/kafka-server-start.sh config/kraft/server.properties > broker.log 2>&1 & sleep 1 ./bin/kafka-topics.sh --create --topic "$TOPIC" --bootstrap-server localhost:9092 ./bin/kafka-topics.sh --delete --topic "$TOPIC" --bootstrap-server localhost:9092 ./bin/kafka-topics.sh --create --topic "$TOPIC" --bootstrap-server localhost:9092 sleep 1 {noformat} Running {{./test-kafka.sh topic.with.dots}} exhibits the failure; using {{topicwithoutdots}} works as expected. I'll attach the broker logs from each run. -- This message was sent by Atlassian Jira (v8.20.10#820010)