You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ijuma (via GitHub)" <gi...@apache.org> on 2026/06/01 14:31:34 UTC

Re: [PR] KAFKA-20072 Don't generate IDs with hyphens [kafka]

ijuma commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r3334910521


##########
clients/src/main/java/org/apache/kafka/common/Uuid.java:
##########
@@ -70,12 +70,12 @@ private static Uuid unsafeRandomUuid() {
 
     /**
      * Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
-     *
-     * This will not generate a UUID equal to 0, 1, or one whose string representation starts with a dash ("-")
+     * <p>
+     * This will not generate a UUID equal to 0, 1, or one whose string representation contains a dash ("-").
      */
     public static Uuid randomUuid() {
         Uuid uuid = unsafeRandomUuid();
-        while (RESERVED.contains(uuid) || uuid.toString().startsWith("-")) {
+        while (RESERVED.contains(uuid) || uuid.toString().contains("-")) {

Review Comment:
   30% failure rate for a general utility class is really high and I don't think it makes sense. Uuids are occasionally used in cases where performance matters. Also, the reasoning for the change is unclear.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org