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

MM2 not working when its internal topics are pre-created on a cluster that disallows topic creation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.1
    • 3.7.0
    • mirrormaker
    • None

    Description

      Replication steps

      • Setup a source kafka cluster (alias SOURCE) which doesn't allow topic creation to MM2 (therefore it doesn't allow the creation of internal topics)
      • Create MM2 internal topics in the source kafka cluster
      • Setup a target kafka cluster (alias TARGET)
      • Enable one way replication SOURCE->TARGET

      MM2 will attempt to create or find its internal topics on the source cluster but it will fail with the following stack trace

      {"log_timestamp": "2023-09-13T09:39:25.612+0000", "log_level": "ERROR", "process_id": 1, "process_name": "mirror-maker", "thread_id": 1, "thread_name": "Scheduler for MirrorSourceConnector-creating upstream offset-syncs topic", "action_name": "org.apache.kafka.connect.mirror.Scheduler", "log_message": "Scheduler for MirrorSourceConnector caught exception in scheduled task: creating upstream offset-syncs topic"}
      org.apache.kafka.connect.errors.ConnectException: Error while attempting to create/find topic 'mm2-offset-syncs.TARGET.internal'
      	at org.apache.kafka.connect.mirror.MirrorUtils.createCompactedTopic(MirrorUtils.java:155)
      	at org.apache.kafka.connect.mirror.MirrorUtils.createSinglePartitionCompactedTopic(MirrorUtils.java:161)
      	at org.apache.kafka.connect.mirror.MirrorSourceConnector.createOffsetSyncsTopic(MirrorSourceConnector.java:328)
      	at org.apache.kafka.connect.mirror.Scheduler.run(Scheduler.java:93)
      	at org.apache.kafka.connect.mirror.Scheduler.executeThread(Scheduler.java:112)
      	at org.apache.kafka.connect.mirror.Scheduler.lambda$execute$2(Scheduler.java:63)
      [...]
      Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TopicAuthorizationException: Authorization failed.
      	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
      	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
      	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:165)
      	at org.apache.kafka.connect.mirror.MirrorUtils.createCompactedTopic(MirrorUtils.java:124)
      	... 11 more
      Caused by: org.apache.kafka.common.errors.TopicAuthorizationException: Authorization failed. 

       

      Root cause analysis

      The changes introduced by KAFKA-13401 in MirrorUtils are supposed to follow the same logic as TopicAdmin according to the contributor's comment

      TopicAdmin.createOrFindTopics(...) and MirrorUtils.createCompactedTopic(...) aren't aligned in terms of allowed exceptions

      Exception TopicAdmin MirrorUtils
      TopicExistsException OK OK
      UnsupportedVersionException OK KO
      ClusterAuthorizationException OK KO
      TopicAuthorizationException OK KO

       

      Attachments

        Issue Links

          Activity

            People

              omnia_h_ibrahim Omnia Ibrahim
              ahibot Ahmed HIBOT
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: