incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baron Schwartz <ba...@xaprb.com>
Subject Clarification on num_tokens setting
Date Tue, 05 Feb 2013 16:43:50 GMT
As I understand the num_tokens setting, it makes Cassandra do the following
pseudocode when a new node is added:

for 1...num_tokens do
   my_token = rand(0, 2^128-1)
   next_token = min(tokens in cluster where token > my_token)
   my_range = (my_token, next_token - 1)
done

Now the new node owns num_tokens chunks of keys that previously belonged to
other nodes.

My point is, with 1 node in the cluster, the ring is divided into
num_tokens ranges. With N nodes, the ring is divided into N*num_tokens.
Correct? The docs do not make this clear for me.

And another point: the tokens are randomly chosen, so the ranges of keys
are not uniform, although with enough nodes in the cluster there probably
won't be any really large ranges. Correct?

Mime
View raw message