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


##########
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:
   Thanks, @ijuma -- that's a very good point about performance! I did check 
through fetch/produce paths originally, but of course that doesn't protect us 
from future usages (or things not caught during the review).
   
   I'll file a patch shortly that makes this new behavior opt-in.
   
   As to the reasoning, the original 
[Jira](https://issues.apache.org/jira/browse/KAFKA-20072) I wrote was about 
issues with double-clicking on IDs. Really it's just a small quality of life 
improvement.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to