You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/10/26 07:14:32 UTC
[GitHub] [kafka] showuon opened a new pull request, #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
showuon opened a new pull request, #12790:
URL: https://github.com/apache/kafka/pull/12790
In https://github.com/apache/kafka/pull/11910 , we added a feature to prevent topics with conflicting metrics names from being created. We added a map to store the normalized topic name to the topic names, but we didn't remove it correctly while deleting topics. This PR fixes this bug and add a test.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] hachikuji merged pull request #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
Posted by GitBox <gi...@apache.org>.
hachikuji merged PR #12790:
URL: https://github.com/apache/kafka/pull/12790
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dengziming commented on a diff in pull request #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
Posted by GitBox <gi...@apache.org>.
dengziming commented on code in PR #12790:
URL: https://github.com/apache/kafka/pull/12790#discussion_r1006976348
##########
core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala:
##########
@@ -470,6 +471,30 @@ class TopicCommandIntegrationTest extends KafkaServerTestHarness with Logging wi
TestUtils.verifyTopicDeletion(zkClientOrNull, testTopicName, 1, brokers)
}
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testTopicWithCollidingCharDeletionAndCreateAgain(quorum: String): Unit = {
+ // create the topic with colliding chars
+ val topicWithCollidingChar = "test.a"
+ val createOpts = new TopicCommandOptions(Array("--partitions", "1",
+ "--replication-factor", "1",
+ "--topic", topicWithCollidingChar))
+ createAndWaitTopic(createOpts)
+
+ // delete the topic
+ val deleteOpts = new TopicCommandOptions(Array("--topic", topicWithCollidingChar))
+
+ if (!isKRaftTest()) {
+ val deletePath = DeleteTopicsTopicZNode.path(topicWithCollidingChar)
+ assertFalse(zkClient.pathExists(deletePath), "Delete path for topic shouldn't exist before deletion.")
+ }
+ topicService.deleteTopic(deleteOpts)
+ TestUtils.verifyTopicDeletion(zkClientOrNull, topicWithCollidingChar, 1, brokers)
+
+ val createTopic: Executable = () => createAndWaitTopic(createOpts)
+ assertDoesNotThrow(createTopic)
Review Comment:
I'm investigating why there will be compile error when directly using `assertDoesNotThrow(() => createAndWaitTopic(createOpts))`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] showuon commented on a diff in pull request #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
Posted by GitBox <gi...@apache.org>.
showuon commented on code in PR #12790:
URL: https://github.com/apache/kafka/pull/12790#discussion_r1005304318
##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -527,7 +527,7 @@ public void replay(RemoveTopicRecord record) {
if (colliding != null) {
colliding.remove(topic.name);
if (colliding.isEmpty()) {
- topicsWithCollisionChars.remove(topic.name);
+ topicsWithCollisionChars.remove(normalizedName);
Review Comment:
The key for `topicsWithCollisionChars` should be normalized name, not original name.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] hachikuji commented on pull request #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
Posted by GitBox <gi...@apache.org>.
hachikuji commented on PR #12790:
URL: https://github.com/apache/kafka/pull/12790#issuecomment-1293873487
Great find! Agree with @dengziming that we should have a test in `ReplicationControlManagerTest`. Otherwise, LGTM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] showuon commented on pull request #12790: KAFKA-14337: correctly remove topicsWithCollisionChars after topic deletion
Posted by GitBox <gi...@apache.org>.
showuon commented on PR #12790:
URL: https://github.com/apache/kafka/pull/12790#issuecomment-1291601760
@dengziming @cmccabe , please take a look. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org