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

Users should not be able to create a regular topic name __cluster_metadata

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 3.4.0, 3.3.2
    • controller
    • None

    Description

      The following test passes and it should not:

       $ git diff                           
      diff --git a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala
      index 57834234cc..14b1435d00 100644
      --- a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala
      +++ b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala
      @@ -102,6 +102,12 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest {
           validateTopicExists("partial-none")
         }
        
      +  @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
      +  @ValueSource(strings = Array("zk", "kraft"))
      +  def testClusterMetadataTopicFails(quorum: String): Unit = {
      +    createTopic("__cluster_metadata", 1, 1)
      +  }
      +
         @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
         @ValueSource(strings = Array("zk"))
         def testCreateTopicsWithVeryShortTimeouts(quorum: String): Unit = {

      Result of this test:

       $ ./gradlew core:test --tests CreateTopicsRequestTest.testClusterMetadataTopicFails
      > Configure project :
      Starting build with version 3.4.0-SNAPSHOT (commit id bc780c7c) using Gradle 7.5.1, Java 1.8 and Scala 2.13.8
      Build properties: maxParallelForks=12, maxScalacThreads=8, maxTestRetries=0
      
      > Task :core:test
      Gradle Test Run :core:test > Gradle Test Executor 8 > CreateTopicsRequestTest > testClusterMetadataTopicFails(String) > kafka.server.CreateTopicsRequestTest.testClusterMetadataTopicFails(String)[1] PASSED
      Gradle Test Run :core:test > Gradle Test Executor 8 > CreateTopicsRequestTest > testClusterMetadataTopicFails(String) > kafka.server.CreateTopicsRequestTest.testClusterMetadataTopicFails(String)[2] PASSED
      
      BUILD SUCCESSFUL in 44s
      44 actionable tasks: 3 executed, 41 up-to-date
      

      I think that this test should fail in both KRaft and ZK. We want this to fail in ZK so that it can be migrated to KRaft.

      Attachments

        Activity

          People

            jsancio José Armando García Sancio
            jsancio José Armando García Sancio
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: