From: David Boxenhorn [mailto:firstname.lastname@example.org]
Sent: Friday, June 25, 2010 10:14 AM
Subject: Re: UUIDs whose alphanumeric order is the same as their chronological orderThanks, Tatu! I'm going ahead with it. Now if something goes wrong I'll say: "But Tatu said..." (just kidding).
I've replaced Random in the code above with SecureRandom, for that extra dose of randomness (my biggest worry was that Random self-seeds with System.currentTimeMillis(), and there is some infinitesimal chance that two servers could start up in the same clock tick). Any thoughts?
On Thu, Jun 24, 2010 at 8:31 PM, Tatu Saloranta <email@example.com> wrote:
On Wed, Jun 23, 2010 at 12:18 AM, David Boxenhorn <firstname.lastname@example.org> wrote:Ok! It all makes sense -- honestly I just wanted to try to explain why
> Tatu, I did read your comments - and I appreciate them very much!
> I want someone to argue with me (using good arguments) since what I'm doing
> *does* seem weird to me - because no one else is doing it.
> What I mean by readable is that the sort order of my UUIDs are obvious to
> What I mean by "weird code" is mostly that it doesn't come with enough
> authority that I would trust it as a black-box more than my own code. For
> example, what happens when I want to port it to different kinds of machines?
certain consensus builds, not to argue against your way of doing
I don't think you are missing anything obvious, my suggestions are
really secondary arguments. I think you have good reasons and code
And yes, implementing time-based UUIDs leads to quite a few
complications, if one tries to address all oddities.
This is probably why JDK UUID is so limiting, I assume JDK authors did
not want to deal with such aspects.
And that is why I think that fundamentally random-based variant is
good for the main goal of achieving uniqueness.
Yes, that is definitely overly complicated (IMO). Perhaps Cassandra
> But another thing weird about it is the complexity (and I think low speed)
> of the algorithms I need in my *own* code to use it. Just look at it
> http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java !
could add convenience methods for mundane things like converting
between java.util.UUID and byte.
Or authors of nice extension/convenience libraries like Hector (and
others mentioned -- apologies for not listing I just worry I misspell
their names :) )
-+ Tatu +-