Why don't you use server-side paging feature instead of messing with tokens ? 


On Wed, Feb 3, 2016 at 7:36 AM, Priyanka Gugale <priyag@apache.org> wrote:

I am using Cassandra 2.2.0 and cassandra driver 2.1.8. I am trying to scan a table as per suggestions given here,  On running the code to fetch records from table, it fetches different number of records on each run. Some times it reads all records from table,  and some times some records are missing. As I have observed there is no fixed pattern for missing records.

I have tried to set consistency level to ALL while running select query still I couldn't fetch all records. Is there any known issue? Or am I suppose to do anything more than running simple "select" statement.

Code snippet to fetch data:

 SimpleStatement stmt = new SimpleStatement(query);
 ResultSet result = session.execute(stmt);
 if (!result.isExhausted()) {
   for (Row row : result) {

Query is of the form: select * from %t where token(%p) > %s limit %l;

where t=tablename, %p=primary key, %s=token value of primary key and l=limit

I am testing on my local machine and has created a Keyspace with replication factor of 1. Also I don't see any errors in the logs.