incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john.sta...@gmail.com
Subject Re: Cassandra Data Model and Surrogate Keys
Date Tue, 25 Feb 2014 03:24:41 GMT
Thanks Michael, I will take a look at LWT for the future but unfortunately we are using Cassandra
1.2 ( I should have stated that, sorry). Are there any recommendations for 1.2, or do you
just have to deal with him the race condition and possible duplicate data. 

Thanks again

Sent from my BlackBerry 10 smartphone on the Rogers network.
  Original Message  
From: Michael Shuler
Sent: Monday, February 24, 2014 10:17 PM
To: user@cassandra.apache.org
Reply To: user@cassandra.apache.org
Subject: Re: Cassandra Data Model and Surrogate Keys

On 02/24/2014 09:00 PM, John Stager wrote:
> Hello,
>
> We are working on our data model for Cassandra and we have a need to use
> surrogate keys (timeuuid) and not the natural key for one of our tables
> but this causes a possible timing issue when determining if a row
> already exists.Are there any best practices or patterns for Cassandra
> for using surrogate keys?
>
> This is the classic user id (surrogate key) and username (email address).

This sounds like the perfect use case for lightweight transactions and 
just using timeuuid. LWT are more expensive due to read before write, 
but when needed, as in your case, it's the right fit. Even with 
perfectly time-synced nodes, there is still a race for two users to 
create the same userid, which is why LWT was included.

http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0
http://www.datastax.com/documentation/cassandra/2.0/cassandra/dml/dml_ltwt_transaction_c.html

-- 
Kind regards,
Michael

Mime
View raw message