I fully agree. It makes no sense. Yet... The only guesses I'm having is that we originally generated UUIDv4s on a user's phone before sending it to the database, and the UUID generated this morning that collided was created on an Ubuntu server. I don't fully know how UUIDv4s are generated and what (if anything) about the machine it's being generated on is part of the algorithm, but that's really the only change I can…
You let users generate a UUID? To be honest, the chance that you are doing something weird is probably higher than you experiencing a real UUID conflict. How did your database 'flag' that conflict?
Ask HN: We just had an actual UUID v4 collision...
241–250 of 369 posts
Re: Ask HN: We just had an actual UUID v4 collision...
#242Re: Ask HN: We just had an actual UUID v4 collision...
#243Super easy assignment, wrote it up probably in C++ (maybe just C?), and ran it on my linux box (probably Debian potato). It finished super quick and gave me an average of like 5.6 steps to return to the origin or something. Cool!
I copied it over to my account on the department's HP-UX machines where I was supposed to run and submit it to my instructor. Compiled fine. And then it... just ran forever. I was doing rand() % 4 or something, and the HP-SUX RNG had crazy bias in its last 2 bits, and it just walked away forever, never returning to the origin. Well crap!
Got an A for my writeup, though!
Re: Ask HN: We just had an actual UUID v4 collision...
#244Earlier quoted context omitted.
A collision is simple to detect but it requires you to actually check, which is expensive at scale. The entire point of UUIDv4 is that you don't have to check for collisions because it should never happen. But if you don't check and it does happen you are in UB territory which is generally very bad. A risk of collision before it happens is non-trivial to detect but this is really what you'd want.
Only expensive if you have unsorted keys or lack an index. Neither of which are unscalable.
Re: Ask HN: We just had an actual UUID v4 collision...
#245Earlier quoted context omitted.
A collision is simple to detect but it requires you to actually check, which is expensive at scale. The entire point of UUIDv4 is that you don't have to check for collisions because it should never happen. But if you don't check and it does happen you are in UB territory which is generally very bad. A risk of collision before it happens is non-trivial to detect but this is really what you'd want.
Only expensive if you have unsorted keys or lack an index. Neither of which are unscalable.
It is resource amplification all the way down. In a lot of systems that index these keys the cost of that check is several times that of doing a blind insert.
Re: Ask HN: We just had an actual UUID v4 collision...
#246Earlier quoted context omitted.
Only expensive if you have unsorted keys or lack an index. Neither of which are unscalable.
You must have missed the “at scale” part. There is nothing inexpensive about extra network hops, cache misses, and page faults implied by your solution. Indexing at scale is almost always lossy for performance reasons. The location where you insert a new record is frequently not the same location as where you have to search for an existing record. It is resource amplification all the way down. In a lot of systems tha…
DynamoDb works fine, using CQRS if necessary.
Re: Ask HN: We just had an actual UUID v4 collision...
#247Earlier quoted context omitted.
Only expensive if you have unsorted keys or lack an index. Neither of which are unscalable.
AKA centralising a decentralised identifier generator?
Re: Ask HN: We just had an actual UUID v4 collision...
#248Earlier quoted context omitted.
AKA centralising a decentralised identifier generator?
There are better approaches like pre -avoiding collisions but generating tends to be more expensive than checking.
Walk me through that please
Re: Ask HN: We just had an actual UUID v4 collision...
#249Earlier quoted context omitted.
The scenario in this post is that the first uuid was created one year before the duplicate uuid. That isn’t possible with v7
You're heavily leaning on "collision like this" to relate to the exact time stamps for your statement to be true. It's equality possible to interpret the "like this" to the collision itself, without a focus on the 1 year distance between the creation dates. So I guess both views are valid.
Re: Ask HN: We just had an actual UUID v4 collision...
#250Earlier quoted context omitted.
There are better approaches like pre -avoiding collisions but generating tends to be more expensive than checking.
In what world is generating a UUID more expensive than checking for duplicates? at any scale ? Walk me through that please