You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Carlos Pérez Miguel <cp...@gmail.com> on 2012/10/03 16:19:50 UTC
RandomPartitioner and the token limits
Hello,
Reading the wiki of operations
(http://wiki.apache.org/cassandra/Operations) I noticed something
strange. When using RandomPartitioner, tokens are integers in the
range [0,2**127] (both limits included) but keys are converted into
this range using MD5. MD5 has 128 bits, so, tokens should not be in
the range [0, (2**128)-1]?
Anyway, if Cassandra uses only 127 bits of that 128 bits because it
tries to convert this 128 bit into a signed int, tokens should not be
in the range [0, 2**127) (first limit included, last not included)?
Thank you
Carlos Pérez Miguel
Re: RandomPartitioner and the token limits
Posted by aaron morton <aa...@thelastpickle.com>.
AFAIK in the code the minimum exclusive value token is -1, so as a signed integer the maxmium value is 2**127
Cheers
-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com
On 4/10/2012, at 3:19 AM, Carlos Pérez Miguel <cp...@gmail.com> wrote:
> Hello,
>
> Reading the wiki of operations
> (http://wiki.apache.org/cassandra/Operations) I noticed something
> strange. When using RandomPartitioner, tokens are integers in the
> range [0,2**127] (both limits included) but keys are converted into
> this range using MD5. MD5 has 128 bits, so, tokens should not be in
> the range [0, (2**128)-1]?
>
> Anyway, if Cassandra uses only 127 bits of that 128 bits because it
> tries to convert this 128 bit into a signed int, tokens should not be
> in the range [0, 2**127) (first limit included, last not included)?
>
> Thank you
>
> Carlos Pérez Miguel