You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "wernerdv (via GitHub)" <gi...@apache.org> on 2026/01/15 19:09:46 UTC
[PR] KAFKA-20072 Don't generate IDs with hyphens [kafka]
wernerdv opened a new pull request, #21313:
URL: https://github.com/apache/kafka/pull/21313
The `Uuid#randomUuid` method has been modified to avoid generating UUIDs containing hyphens.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
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 meant to be 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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20072 Don't generate IDs with hyphens [kafka]
Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison merged PR #21313:
URL: https://github.com/apache/kafka/pull/21313
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 28.3% (= 1 - (63/64)**21). The new p99 number of rejections is ~3.6 which I think is fine.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
mumrah commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3805936107
@mimaison or @squah-confluent any further feedback here?
--
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 Don't generate IDs with hyphens [kafka]
Posted by "wernerdv (via GitHub)" <gi...@apache.org>.
wernerdv commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3756435077
@mumrah Hello, are the current minimal changes sufficient or do we need to optimize the `randomUuid()` method?
--
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 Don't generate IDs with hyphens [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-4340833562
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
mumrah commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2708799474
##########
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 for doing the math :)
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 30.5% (= 1 - (63/64)**20 * 15/16, taking into account fixed bits in version 4 uuids). The new p99 number of rejections is ~3.88 which I think is not too bad.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 30.5% (= 1 - (63/64)**19 * 15/16, taking into account fixed bits in version 4 uuids). The new p99 number of rejections is ~3.88 which I think is not too bad.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20072 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 28.3% (= 1 - (63/64)**21). The new p99 number of rejections is ~3.6 which I think is not too bad.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3805954699
I don't see an update to the docs in the changes.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3773353273
We use Uuid on the client side for group member ids. If I understand correctly, hyphens don't affect the behavior, Uuids with hyphens will continue to work as before, and this is only a slight usability improvement. Should we still document it, for example in the protocol page, as a recommendation for 3rd party clients?
--
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 Don't generate IDs with hyphens [kafka]
Posted by "wernerdv (via GitHub)" <gi...@apache.org>.
wernerdv commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3812773902
@squah-confluent Thanks for your comment.
I have made the updates — please review them.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "wernerdv (via GitHub)" <gi...@apache.org>.
wernerdv commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3806055579
@mumrah @mimaison I’ve updated `protocol.md`.
Could you let me know if these changes are sufficient?
Alternatively, do you think there might be a more suitable section in the documentation for this content?
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
mumrah commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r3335176214
##########
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:
https://github.com/apache/kafka/pull/22442/
##########
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:
Addressed in https://github.com/apache/kafka/pull/22442/
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 28.2% (= 1 - (63/64)**21). The new p99 number of rejections is ~3.6 which I think is not too bad.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on code in PR #21313:
URL: https://github.com/apache/kafka/pull/21313#discussion_r2696663988
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 30.5% (= 1 - (63/64)**19 * 15/16, taking into account fixed bits in version 4 uuids). The new p99 number of rejections is ~3.88 (was 1.1) which I think is not too bad.
##########
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:
Note that the probability of rejecting a generated uuid rises from 1.56% (= 1/64) to 30.5% (= 1 - (63/64)**19 * 15/16, taking into account fixed bits in version 4 uuids). The new p99 number of rejections is ~3.88 (was 1.11) which I think is not too bad.
--
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 Don't generate IDs with hyphens [kafka]
Posted by "mumrah (via GitHub)" <gi...@apache.org>.
mumrah commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3773385349
@mimaison indeed this won't affect existing IDs or externally generated ones that "violate" the rule. I'm not sure if we document the leading underscore preference, but it seems like a reasonable inclusion (e.g., "clients _should_ generate UUIDs without hyphens).
--
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 Don't generate IDs with hyphens [kafka]
Posted by "squah-confluent (via GitHub)" <gi...@apache.org>.
squah-confluent commented on PR #21313:
URL: https://github.com/apache/kafka/pull/21313#issuecomment-3811776287
The code change is fine by me.
The current documentation change raises some questions. It would be nice to improve the wording.
* When do clients generate UUIDs? There are member IDs but I believe that is a recommendation / convention that we use rather than a requirement.
[KIP-1082](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1082%3A+Require+Client-Generated+IDs+over+the+ConsumerGroupHeartbeat+RPC) says
> In the new version of the ConsumerGroupHeartbeat RPC, the client must generate a UUID as the member ID during the initial heartbeat. This member ID must be included in every subsequent request to ensure consistency. We highly recommend that users utilize a UUID as the member ID, but ultimately, the choice is up to the user."
It's contradictory but it sounds like it's trying to say that member IDs can be any format but the recommendation is a base64-encoded UUID.
* To the average developer, a UUID looks like "00000000-0000-0000-0000-000000000000". It's not clear that we are referring to the base64-encoded form, and not even the "default" encoding with "+" and "/", but the URL-safe encoding
--
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 Don't generate IDs with hyphens [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
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