Token Aware Routing: Routing Key Vs Composite Key with vnodes

2013-07-11 Thread Haithem Jarraya
Hi All,

I am a bit confused on how the underlying token aware routing is working in
the case of composite key.
Let's say I have a column family like this USERS( uuid userId, text
firstname, text lastname, int age, PRIMARY KEY(userId, firstname, lastname))

My question is do we need to have the values of the userId, firstName and
lastName available in the same time to create the token from the composite
key, or we can get the right token just by looking at the routing key
userId?

Looking at the datastax driver code, is a bit confusing, it seems that it
calculate the token only when all the values of a composite key is
available, or I am missing something?

Thanks,

Haithem


Re: Token Aware Routing: Routing Key Vs Composite Key with vnodes

2013-07-11 Thread Colin Blower
It is my understanding that you must have all parts of the partition key
in order to calculate the token. The partition key is the first part of
the primary key, in your case the userId.

You should be able to get the token from the userId. Give it a try:
cqlsh select userId, token(userId) from users limit 10;

On 07/11/2013 08:54 AM, Haithem Jarraya wrote:
 Hi All,

 I am a bit confused on how the underlying token aware routing is
 working in the case of composite key.
 Let's say I have a column family like this USERS( uuid userId, text
 firstname, text lastname, int age, PRIMARY KEY(userId, firstname,
 lastname))

 My question is do we need to have the values of the userId, firstName
 and lastName available in the same time to create the token from the
 composite key, or we can get the right token just by looking at the
 routing key userId?

 Looking at the datastax driver code, is a bit confusing, it seems that
 it calculate the token only when all the values of a composite key is
 available, or I am missing something?

 Thanks,

 Haithem



-- 
*Colin Blower*
/Software Engineer/
Barracuda Networks Inc.
+1 408-342-5576 (o)