incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dr. Martin Grabm├╝ller <Martin.Grabmuel...@eleven.de>
Subject RE: UUIDs whose alphanumeric order is the same as their chronological order
Date Fri, 25 Jun 2010 09:58:35 GMT
You can use the sever's name/IP-address+Port and mix it into the random seed.
 
Martin


________________________________

	From: David Boxenhorn [mailto:david@lookin2.com] 
	Sent: Friday, June 25, 2010 10:14 AM
	To: user@cassandra.apache.org
	Subject: Re: UUIDs whose alphanumeric order is the same as their chronological order
	
	
	Thanks, 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 <tsaloranta@gmail.com> wrote:
	

		On Wed, Jun 23, 2010 at 12:18 AM, David Boxenhorn <david@lookin2.com> wrote:
		> 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
		> humans.
		>
		> 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?
		
		
		Ok! It all makes sense -- honestly I just wanted to try to explain why
		certain consensus builds, not to argue against your way of doing
		things.
		I don't think you are missing anything obvious, my suggestions are
		really secondary arguments. I think you have good reasons and code
		looked solid.
		
		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.
		

		> 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 !
		
		
		Yes, that is definitely overly complicated (IMO). Perhaps Cassandra
		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 +-
		



Mime
View raw message