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

[PR] KAFKA-20072 Make Uuid no-dash behavior opt-in [kafka]

mumrah opened a new pull request, #22442:
URL: https://github.com/apache/kafka/pull/22442

   Instead of changing `Uuid#randomUuid` to always have the new behavior introduced in #21313, this patch adds a separate `randomUuidNoDashes` method. 
   
   Since Uuid is a utility class, it is used widely throughout the broker and client (possibly even applications). In most cases, the presence of a dash is inconsequential. The new behavior, which comes with a small performance hit, should not affect these callers. The introduction of a new Uuid factory makes the new behavior opt-in.
   
   One caller is updated to use the new factory which is where the controller allocates topic IDs. This matches the intention of the original Jira.


-- 
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


Re: [PR] KAFKA-20072 Make Uuid no-dash behavior opt-in [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22442:
URL: https://github.com/apache/kafka/pull/22442#issuecomment-6487196075

   This PR is being marked as stale since it has not had any activity in 90 days. If you
   would like to keep this PR alive, please leave a comment asking for a review. If the PR has 
   merge conflicts, update it with the latest from the base branch.
   <p>
   If you are having difficulty finding a reviewer, please reach out on the 
   [mailing list](https://kafka.apache.org/contact).
   <p>
   If this PR is no longer valid or desired, please feel free to close it. If no activity
   occurs in the next 30 days, it will be automatically closed.


-- 
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


Re: [PR] KAFKA-20072 Make Uuid no-dash behavior opt-in [kafka]

Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison commented on PR #22442:
URL: https://github.com/apache/kafka/pull/22442#issuecomment-4623605000

   https://github.com/apache/kafka/commit/474798afbed318c7ff316b2ca38e559aa1a136ad is not in a release yet so we can change still our minds.
   
   This new PR adds a new public method to a public API. 


-- 
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


Re: [PR] KAFKA-20072 Make Uuid no-dash behavior opt-in [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #22442:
URL: https://github.com/apache/kafka/pull/22442#discussion_r3374995481


##########
clients/src/main/java/org/apache/kafka/common/Uuid.java:
##########
@@ -71,9 +71,24 @@ private static Uuid unsafeRandomUuid() {
     /**
      * Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
      * <p>
-     * This will not generate a UUID equal to 0, 1, or one whose string representation contains a dash ("-").
+     * This will not generate a UUID equal to 0, 1, or one whose string representation starts with a dash ("-").
      */
     public static Uuid randomUuid() {
+        Uuid uuid = unsafeRandomUuid();
+        while (RESERVED.contains(uuid) || uuid.toString().startsWith("-")) {
+            uuid = unsafeRandomUuid();
+        }
+        return uuid;
+    }
+
+    /**
+     * Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
+     * <p>
+     * This will not generate a UUID equal to 0, 1, or one whose string representation contains a dash ("-").
+     * Note that this will result in 30% rejected UUIDs, and so should not be used in performance sensitive
+     * code paths.
+     */
+    public static Uuid randomUuidNoDashes() {

Review Comment:
   I guess it needs a KIP?



-- 
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


Re: [PR] KAFKA-20072 Make Uuid no-dash behavior opt-in [kafka]

Posted by "mumrah (via GitHub)" <gi...@apache.org>.
mumrah commented on PR #22442:
URL: https://github.com/apache/kafka/pull/22442#issuecomment-4595018881

   cc @mimaison @ijuma 


-- 
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