David Arthur created KAFKA-13741:
------------------------------------

             Summary: Cluster IDs should not have leading dash
                 Key: KAFKA-13741
                 URL: https://issues.apache.org/jira/browse/KAFKA-13741
             Project: Kafka
          Issue Type: Bug
          Components: kraft
            Reporter: David Arthur
            Assignee: David Arthur


Since we use URL-safe base64 encoded Uuid's for cluster ID, it is possible for 
dash ("-") characters to be present in the ID string. When a cluster ID has a 
leading dash, we can run into problems when running the Kafka bash scripts.

For example, if the ID "-Xflm1nKSfOK8QGt_AXhxw" is generated with "random-uuid" 
sub-command of kafka-storage.sh, we would then normally format the log 
directories like:

{code}
./bin/kafka-storage.sh format --config ./config/kraft/controller.properties \
    --cluster-id -Xflm1nKSfOK8QGt_AXhxw
{code}

This will not parse correctly as the argument parsing library will treat the 
cluster ID as an argument. It leads to the following error:

{code}
usage: kafka-storage format [-h] --config CONFIG --cluster-id CLUSTER_ID 
[--ignore-formatted]
kafka-storage: error: argument --cluster-id/-t: expected one argument
{code}

This can be worked around by putting the ID in quotes, or by using an "=" 
between the "--cluster-id" and the Uuid.

We can solve this going forward by not generating random Uuid's that contain a 
leading dash.





--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to