Change randomized prefix to contain only hex characters#13799
Change randomized prefix to contain only hex characters#13799arhimondr merged 1 commit intotrinodb:masterfrom
Conversation
There was a problem hiding this comment.
Please add a comment explaining why this exact alphabet is important.
There was a problem hiding this comment.
Certain storage systems prefer the prefix to be hexadecimal. Discussed offline.
There was a problem hiding this comment.
Do we need to increase this now? This takes us from 2176782336 combinations to only 16777216, or 0.0077% of the previous, making the chance of collisions much higher. What are the implications of a collision?
There was a problem hiding this comment.
S3 enforces request limits per prefix (https://aws.amazon.com/premiumsupport/knowledge-center/s3-request-limit-avoid-throttling/). The request limits are 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests. The space of 16777216 distinct prefixes should be sufficient.
There was a problem hiding this comment.
Should these assumptions be persisted as a code comment, documenting why 6 is still sufficient prefix length?
|
Since we're enforcing hex, how about simplifying the generation function: private static final int RANDOMIZED_PREFIX_BYTES = 3;
private static String generateRandomizedPrefix()
{
byte[] bytes = new byte[RANDOMIZED_PREFIX_BYTES];
ThreadLocalRandom.current().nextBytes(bytes);
return BaseEncoding.base16().encode(bytes);
} |
Some storage systems prefer the prefix to be hexadecimal characters
e137c10 to
2c988a5
Compare
|
@electrum Having the custom function avoids unnecessary allocations and reduces uncertainty whether a lower case or upper case characters are used |
Some storage systems prefer the prefix to be hexadecimal characters
No release notes entries required