You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by A J <s5...@gmail.com> on 2011/07/06 16:06:01 UTC

deduct token values for BOP

I wish to use the order preserving byte-ordered partitioner. How do I
figure the initial token values based on the text key value.
Say I wish to put all keys starting from a to d on N1. e to m on N2
and n to z on N3. What would be the initial_token values on each of
the 3 nodes to accomplish this ?

Thanks.

Re: deduct token values for BOP

Posted by Richard Low <rl...@acunu.com>.
On Thu, Jul 7, 2011 at 3:39 PM, A J <s5...@gmail.com> wrote:
> Thanks. The above works.
> But when I try to use the binary values rather than the hex values, it
> does not work. i.e. instead of using 64ff, I use 01100100. Instead of
> 6Dff, I use 01101101.
> When using the binary values, everything (strings starting with a to
> z) seem to be going to n1 only.
> Any idea why ?

You're writing the binary value as the initial token?  That won't
work, since it expects hex.

Richard.

Re: deduct token values for BOP

Posted by A J <s5...@gmail.com>.
Thanks. The above works.
But when I try to use the binary values rather than the hex values, it
does not work. i.e. instead of using 64ff, I use 01100100. Instead of
6Dff, I use 01101101.
When using the binary values, everything (strings starting with a to
z) seem to be going to n1 only.
Any idea why ?

On Wed, Jul 6, 2011 at 11:18 AM, Richard Low <rl...@acunu.com> wrote:
> On Wed, Jul 6, 2011 at 3:06 PM, A J <s5...@gmail.com> wrote:
>> I wish to use the order preserving byte-ordered partitioner. How do I
>> figure the initial token values based on the text key value.
>> Say I wish to put all keys starting from a to d on N1. e to m on N2
>> and n to z on N3. What would be the initial_token values on each of
>> the 3 nodes to accomplish this ?
>
> If all keys use characters a-z then the following will work:
>
> N1: 64ff
> N2: 6dff
> N3: 7aff
>
> (64, 6d and 7a are hex for ascii codes of d, m, z).  Here the key (in
> hex) 64ffff will go to N2 even though it starts with d.  But every
> string that starts with a-d with only characters a-z afterwards will
> go to N1.
>
> Richard.
>
> --
> Richard Low
> Acunu | http://www.acunu.com | @acunu
>

Re: deduct token values for BOP

Posted by Richard Low <rl...@acunu.com>.
On Wed, Jul 6, 2011 at 3:06 PM, A J <s5...@gmail.com> wrote:
> I wish to use the order preserving byte-ordered partitioner. How do I
> figure the initial token values based on the text key value.
> Say I wish to put all keys starting from a to d on N1. e to m on N2
> and n to z on N3. What would be the initial_token values on each of
> the 3 nodes to accomplish this ?

If all keys use characters a-z then the following will work:

N1: 64ff
N2: 6dff
N3: 7aff

(64, 6d and 7a are hex for ascii codes of d, m, z).  Here the key (in
hex) 64ffff will go to N2 even though it starts with d.  But every
string that starts with a-d with only characters a-z afterwards will
go to N1.

Richard.

-- 
Richard Low
Acunu | http://www.acunu.com | @acunu