Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #2358: Use lower-entropy random UUIDs #2359

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alecgrieser
Copy link
Contributor

To avoid synchronization, calls to the high-entropy java.util.UUID.randomUUID method are replaced here with calls to a new method that takes a configurable source randomness (defaulting to a thread-local random). This should be more performant, due to the removal of some synchronization points. In most cases, we don't have a need for cryptographically secure UUIDs. For instance, this is used by the planner to assign IDs, but all of the planner objects are created within the same thread, so the thread-local random should be sufficient. The R-tree also uses UUIDs for that purpose, but there, the uniqueness of the UUIDs is important for ensuring uniqueness of different nodes in the tree, so that usage has not been updated here.

This resolves #2358.

To avoid synchronization, calls to the high-entropy `java.util.UUID.randomUUID` method are replaced here with calls to a new method that takes a configurable source randomness (defaulting to a thread-local random). This should be more performant, due to the removal of some synchronization points. In most cases, we don't have a need for cryptographically secure UUIDs. For instance, this is used by the planner to assign IDs, but all of the planner objects are created within the same thread, so the thread-local random should be sufficient. The R-tree also uses UUIDs for that purpose, but there, the uniqueness of the UUIDs is important for ensuring uniqueness of different nodes in the tree, so that usage has not been updated here.

This resolves FoundationDB#2358.
Copy link

sonarcloud bot commented Nov 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr-proto2 on Linux CentOS 7

  • Commit ID: 0d7323e
  • Duration 0:29:57
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr-proto3 on Linux CentOS 7

  • Commit ID: 0d7323e
  • Duration 0:30:32
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use lower-entropy random UUIDs
2 participants