-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Add some blocking so that we don't generate identical UUIDs for API objects. #2120
Conversation
Is our Go uuid out of date? https://code.google.com/p/go-uuid/source/browse/uuid/version4.go is pulling random bits from crypto/rand - I don't see how we could be racing? EDIT: Duh, not using |
Well, we could switch to NewRandom() but then we'd run the risk of collisions, so we'd be forced to go to etcd to check (and without indices, that's going to be expensive, and even with indices, its not great) So version1 UUID enables us be sure that they're unique (assuming that we don't give them out to quickly) hence this PR. I think this is actually a pretty decent solution, given that most of the time, we won't have to wait. |
Given the rate of uuid generation (and hence locks and goroutine creation here) is unlikely to be the dominant factor, that's fine with me. |
Puke. Are we really concerned about UUID collisions in a single resource On Sun, Nov 2, 2014 at 2:14 PM, Clayton Coleman [email protected]
|
imho, UUID collisions via Random are worse than the current (buggy) state. At least this is predictably reproducible. Random collisions will just lead to occasionally random behavior. I really, really, really, don't want to have to go to the data store ever time to make sure that I don't have the same UUID already in use. This is ugly, but I think a reasonable solution. --brendan |
wat. This is the single purpose of a UUID. This PR should not be needed. Is there another UUID package we can use? I think a random UUID should be sufficient for the moment. 1/trillions chance of collision is low enough that we don't need to check. (Not that we could check at the moment, anyway, without an index.) Long term, better than either of these solutions, is to just assign each running master a UID prefix, and then they can just count up to make globally unique UIDs. |
This isn't a problem with the package, its a problem with the choice of We could go to random, but why? Why implement a known buggy solution Brendan
|
+1 to not going to etcd to check for collisions. I like time-based solutions. This could be optimized in the future to allow bursting by saving up a buffer of valid unused uuids. It does mean that we may need to emphasize the importance of synchronizing clocks, however. (e.g., recommending time sync tests to run) Also on the table is switching to Docker-style uids (#1944). This seems good enough for now, though. |
Ah, yes, I should have mentioned that. The correct approach is to store up old unused UUID tokens so that we don't have to ever actually wait, I'll add a TODO to do that. |
I think the odds of a random collision are infinitesimal, to the degree But this is fine. It's just sort of vulgar to me, but it's not going to On Mon, Nov 3, 2014 at 1:28 PM, Brendan Burns [email protected]
|
Add some blocking so that we don't generate identical UUIDs for API objects.
No description provided.