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


##########
server-common/src/main/java/org/apache/kafka/common/DirectoryId.java:
##########
@@ -42,29 +42,27 @@ public class DirectoryId {
     public static final Uuid MIGRATING = new Uuid(0L, 2L);
 
     /**
-     * The set of reserved UUIDs that will never be returned by the random 
method.
+     * @return true if the given ID is reserved. An ID is reserved if it is 
one of the first 100,
+     * or if its string representation starts with a dash. ("-")
      */
-    public static final Set<Uuid> RESERVED;
-
-    static {
-        HashSet<Uuid> reserved = new HashSet<>(Uuid.RESERVED);
-        // The first 100 UUIDs are reserved for future use.
-        for (long i = 0L; i < 100L; i++) {
-            reserved.add(new Uuid(0L, i));
-        }
-        RESERVED = Collections.unmodifiableSet(reserved);
+    public boolean isReserved(Uuid id) {
+        return id.toString().startsWith("-") ||

Review Comment:
   It's wasteful to generate the string to verify this - isn't there a cheaper 
way to do it?



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to