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

[Workspace] Further discussion on how to create workspace id #5201

Open
SuZhou-Joe opened this issue Oct 4, 2023 · 4 comments
Open

[Workspace] Further discussion on how to create workspace id #5201

SuZhou-Joe opened this issue Oct 4, 2023 · 4 comments
Labels
enhancement New feature or request workspace

Comments

@SuZhou-Joe
Copy link
Member

SuZhou-Joe commented Oct 4, 2023

Is your feature request related to a problem? Please describe.

Option 1: Generate workspace id by using crypto.randomBytes(6).toString('base64url').slice(0, 6) (prefered)

  • pros:
      1. The id is much shorter than uuid, which is 32-chars length.
  • cons:
      1. The collision odds will increase, though the collision rate will be (Number of unique IDs / Total possible IDs) = 64^6 (from the base64url encoding) / 256^6 (from the random bytes) = 0.000244140625(0.0244%).

Option 2: Generate workspace id by using opensearch default id or uuid

  • pros:
      1. The id is promised to not collide with other ids.
  • cons:
      1. The id will be too long, especially when considering case that we might use workspaceId as a prefix of objects id when migrate tenants data to workspace data, the id will become like 32 + 32 = 64-chars long.

Option 3: Use workspace name or anything else as workspace id.

  • pros:
      1. It is more intuitive when we use the workspace name as workspace id, especially that we may use the id in OSD's url.
  • cons:
      1. For Trinity, workspace name can be modified, and that will break the consistency between id and name.

Describe the solution you'd like

We need a further discussion to see if we can use the uuid or opensearch's id generation method to generate the id.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

#5075

@xluo-aws
Copy link
Member

xluo-aws commented Oct 8, 2023

@SuZhou-Joe , could you add pros/cons on using opensearch's generated id or uuid if you are aware of any?

@kavilla
Copy link
Member

kavilla commented Nov 1, 2023

For #2, some more pros would be:

  • Out of box support
    • lower delta change required
    • easier to maintain
  • Do not have to think about how users can upload to saved objects directly and bypass this 6 char completely
  • Keeps with consistency of the application

We can also backlog an improvement task to add 3. Something similar to the advanced settings button in the index pattern creation wizard:
Screenshot 2023-11-01 at 5 59 26 AM

@kavilla
Copy link
Member

kavilla commented Nov 1, 2023

@xluo-aws
Copy link
Member

xluo-aws commented Jun 7, 2024

@SuZhou-Joe , can we close this ticket? If so, could you update with latest decision?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request workspace
Projects
None yet
Development

No branches or pull requests

4 participants