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

Client-ids are not handled consistently by clients and broker

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.11.0.0
    • 1.0.0
    • clients, core
    • None

    Description

      At the moment, Java clients expect client-ids to use a limited set of characters so that they can be used without quoting in metrics. kafka-configs.sh allows quotas to be defined only for that limited set. But the broker does not validate client-ids. And the documentation does not mention any limitations. Existing non-Java clients do not place any restrictions on client-ids and hence introducing restrictions on the broker-side now will be a breaking change. So we should allow any characters and treat them consistently in the same way as we handle user principals.

      Changes required:
      1. Client-id in metrics should be sanitized using URL-encoding similar to the encoding used for user principal in quota metrics. This leaves metrics for client-ids using the current limited set of characters as-is, but will allow arbitrary characters in encoded form. To avoid sanitizing multiple times and to avoid unsanitized ids being used by mistake in some metrics, it may be better to introduce a ClientId class that stores the sanitized id and uses appropriate methods to retrieve the id for metrics etc.
      2. Quota metrics and sensors as well as ZooKeeper quota configuration paths should use sanitized ids for client-ids (they already do for user principal).
      3. Remove client-id validation in kafka-configs.sh and allow any characters for client-id similar to usernames, URL-encoding the names to generate ZK path.

      Attachments

        Issue Links

          Activity

            People

              mimaison Mickael Maison
              rsivaram Rajini Sivaram
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: