You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Guilherme Kaster <gu...@auspex.com.br> on 2010/04/21 21:19:47 UTC

Problem using get_range_slices

I've encountered a problem on cassandra 0.6 while using get_ranged_slices.
I use RP and when I use get_range_slices the keys are not returned in an
"ordered" maner, that means the last key on the list not always the
"greater" key in the list, so I started getting repetitions and ONCE entered
in an infinite loop because the last key on the list was the same start key
I used (keys are inclusive). So a dig a little in cassandra code and found
where keys are converted to tokens in RP (FBUtilities.hash) and started
using tokens, which are not inclusive, starting with token 0. That solved
one of my problems. But the keys where still not returned ascending in
order. I converted them to tokens but the tokens are also not in order. So I
now use as the "new" start token of the next iteration of get_range_slices
the "greater" token (converted from key) found in the returned list.

Is that correct? Has anyone else had the same problem?

-- 
Guilherme L. Kaster
Auspex Desenvolvimento de Negócios em Tecnologia Ltda.

Re: Problem using get_range_slices

Posted by Jonathan Ellis <jb...@gmail.com>.
On Wed, Apr 21, 2010 at 2:19 PM, Guilherme Kaster
<gu...@auspex.com.br> wrote:
> I've encountered a problem on cassandra 0.6 while using get_ranged_slices.
> I use RP and when I use get_range_slices the keys are not returned in an
> "ordered" maner, that means the last key on the list not always the
> "greater" key in the list, so I started getting repetitions and ONCE entered
> in an infinite loop because the last key on the list was the same start key
> I used (keys are inclusive). So a dig a little in cassandra code and found
> where keys are converted to tokens in RP (FBUtilities.hash) and started
> using tokens, which are not inclusive, starting with token 0. That solved
> one of my problems. But the keys where still not returned ascending in
> order. I converted them to tokens but the tokens are also not in order. So I
> now use as the "new" start token of the next iteration of get_range_slices
> the "greater" token (converted from key) found in the returned list.
> Is that correct? Has anyone else had the same problem?

Right, everything is working as designed.  If you want keys ordered
you have to use OPP.

You can use "start with the key that was last in the previous
iteration" with keys, you don't have to drop down to tokens for that.

-Jonathan