Reputation: 3272
To understand the ring without vNodes, I tried initial token in Node 1 as 25 and Node 2 as 50 like below,
Address Rack Status State Load Owns Token
50
172.30.56.60 rack1 Up Normal 82.08 KiB 100.00% 25
172.30.56.61 rack1 Up Normal 82.09 KiB 100.00% 50
I expect only the partition ranges between 0 to 50 should be added in database, But It is allowing any primary key / partition key value I provide as follows (user_id - primary / partition key).
user_id | user_name | user_phone
------------+-----------+------------
999933333 | ram | 9003934069
111 | ram | 9003934069
1 | ram | 9003934069
111333333 | ram | 9003934069
1113333333 | ram | 9003934069
where, user_id is the primary / partition key.
Does it mean that token provided in initial_token is the total number of tokens and not the partition range? If so how the partition range is calculated?
Thanks, Harry
Upvotes: 1
Views: 618
Reputation: 2134
The token number is a hash of the partition key. This decides where the data should be stored.
(ref: https://www.datastax.com/dev/blog/repair-in-cassandra):
In this picture N0 is assigned token 0, N1 token 10 and so on. By doing this we say N1 is responsible for token ranges 1-10. However if we use RF 3 then we say N1 is responsible for token ranges 81-10 instead. What you have done in your example is saying 60 owns 51-25. Since there is still a total of 2^127 tokens (depending on your partitioner) that means it now owns a huge amount of data compared to 61.
Upvotes: 2