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

Config validation in Connector plugins need to compare against both canonical and simple class names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.2.0
    • 0.10.2.1, 0.11.0.0
    • connect
    • None

    Description

      A validation check in Connect's REST API that was added to validate that the connector class name in the config matches the connector class name in the request's URL is too strict by not considering both the simple and the canonical name of the connector class. For instance, the following example request:

      PUT /connector-plugins/FileStreamSinkConnector/config/validate/ HTTP/1.1
      Host: connect.example.com
      Accept: application/json
      
      {
          "connector.class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
          "tasks.max": "1",
          "topics": "test-topic"
      }
      

      returns a "Bad Request" response with error code "400".

      Currently the reasonable workaround is to exactly match the connector class name in both places. The following will work:

      PUT /connector-plugins/org.apache.kafka.connect.file.FileStreamSinkConnector/config/validate/ HTTP/1.1
      Host: connect.example.com
      Accept: application/json
      
      {
          "connector.class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
          "tasks.max": "1",
          "topics": "test-topic"
      }
      

      However, this is not flexible enough and also breaks several examples in documentation. Validation should take into account both simple and canonical class names.

      Attachments

        Issue Links

          Activity

            People

              kkonstantine Konstantine Karantasis
              kkonstantine Konstantine Karantasis
              Ewen Cheslack-Postava Ewen Cheslack-Postava
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 3h
                  3h
                  Remaining:
                  Remaining Estimate - 3h
                  3h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified