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

Truncate UUID to the first 8 characters #54

Closed
cbednarski opened this issue Sep 16, 2015 · 10 comments
Closed

Truncate UUID to the first 8 characters #54

cbednarski opened this issue Sep 16, 2015 · 10 comments

Comments

@cbednarski
Copy link
Contributor

When displaying the UUID in the UI we should truncate to the first 8 chars. Two considerations:

  • The UI should accept short UUIDs
  • We should have a way to detect a duplicate truncation (pretty unlikely, but possible).
@clstokes
Copy link
Contributor

The Short SHA-1 model from git is pretty user-friendly IMO. Allowing users to type only the first few characters of the UUID and have Nomad match based on that (but reject if multiple are found) would be nice and a familiar experience for users.

@iverberk
Copy link
Contributor

Background
So, with the changes from PR #575 merged we can now start the implementation of actually shortening the ID's on the CLI.

Design proposal
There are two kinds of ID's involved: system generated UUID's and custom user ID's. The implications of shortening are different for each version. Let's review both.

  • UUID: truncate the UUID to its first eight characters as specified in the original issue statement. If the truncation results in a duplicate (shortened) UUID then we start increasing the size of the duplicate UUID by two characters (excluding any dashes) until we resolve the collision. The increase by two characters is a result of the way short identifiers are currently implemented in code (needs to be even length). Since the likelihood of two exact same first eight characters is very low this will result in nice shortened UUID's most of the time. You can actually wonder if it is a good idea to start increasing the length instead of just showing the entire UUID at once. From a usability point of view it is probably not very nice to find the differences in the eight, ten, or twelve character length ids as opposed to just judging the full id. Thoughts?
  • User ID's: This time the ID is actually chosen by the user instead of generated by the system. This means that truncating to the first eight characters might remove semantics that the user attributed to the ID. Also, the likelihood of similarities in the first eight characters is higher than with UUID's (people might use ID sequences that only mutate in the last few characters). This would result in a sort of pyramid like shape for IDs because each identifier would increase by one characters. It could still be the case that the actual meaning of the ID can only be derived from the last few characters, which would be hidden.

How should this be approached? The most sensible approach would probably be to just not shorten custom ID's but for consistency in the CLI it is actually nice to have them all the same length. Any input on this would be appreciated.

@dadgar
Copy link
Contributor

dadgar commented Jan 12, 2016

@iverberk: My suggestion is this:

  1. We always truncate to 8 characters. The odd of a collision is extremely low and if there is one, we should add a verbose flag to all CLI output that will show the full UUID length.

  2. I believe node_id is the only case in which users can specify something other than a UUID. I think we can just remove that ability and have it always be a UUID. The user can specify the name if they need to give it human readable names.

@iverberk
Copy link
Contributor

Sounds good to me. The custom node identifier as well as name was indeed a bit odd. So, no additional logic in the shortening? Just truncate to eight characters and add the flag for full ids. I will start with the implementation of this design, including the node id change.

@dadgar
Copy link
Contributor

dadgar commented Jan 12, 2016

@iverberk Thanks! As always reach out if there are any hiccups!

@iverberk
Copy link
Contributor

From looking at the scheme it appears that the job ID is also a custom ID, I don't know what the implications are but would it also make sense to introduce a job name field and let the ID be an auto-generated UUID as well? If not, what would you suggest as a sensible approach to shortening job ids (or not)?

@dadgar
Copy link
Contributor

dadgar commented Jan 13, 2016

Talked offline, but for everyone else, the job ID is a human readable ID and should not be shortened.

@iverberk
Copy link
Contributor

I've opened PR #675 to implement the changes.

@dadgar
Copy link
Contributor

dadgar commented Mar 22, 2016

This is complete

@dadgar dadgar closed this as completed Mar 22, 2016
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants