incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Per Olesen <...@trifork.com>
Subject Iterate all keys - doing it as the faq fails for me :(
Date Fri, 09 Jul 2010 11:40:51 GMT
Hi,

I was reading http://wiki.apache.org/cassandra/FAQ#iter_world and decided to implement the
get_range_slices method for listing all keys of a CF. Only thing is, it doesn't work that
well for me :-)

I do as it says (I think), and take KeyRanges of size N and use the key of the last call as
start for next call. But, for small N, I keep getting the exact same result back from get_range_slices
call, making it impossible to know when to stop.

For N=5, the first slice of keys I get back is this:

previousLastKey = 
keySlice.getKey() = xaspays
keySlice.getKey() = xasfbbe
keySlice.getKey() = xaspaua
keySlice.getKey() = xasaapz
keySlice.getKey() = xascajz

I then call with previousLastKey = xascajz and get:

previousLastKey = xascajz
keySlice.getKey() = xascajz
keySlice.getKey() = xasgacr
keySlice.getKey() = xasfaem
keySlice.getKey() = xasfdco
keySlice.getKey() = xasfdeg

I then call with previousLastKey =  xasfdeg and get:

previousLastKey = xasfdeg
keySlice.getKey() = xasfdeg
keySlice.getKey() = xasfdad
keySlice.getKey() = xascaiv
keySlice.getKey() = xasfaqf
keySlice.getKey() = xasfdeg <--- ENDS IN THE SAME KEY AS PREVIOUS SLICE ?

... the above 5 keys keep getting back as the exact same result :-(

If I set N higher, like 100, I get all my (2492) rows...


/Per
Mime
View raw message