You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "Lu, Boying" <Bo...@emc.com> on 2014/05/08 10:03:29 UTC
Query returns incomplete result
Hi, All,
I use the astyanax 1.56.48 + Cassandra 2.0.6 in my test codes and do some query like this:
query = keyspace.prepareQuery(..).getKey(...)
.autoPaginate(true)
.withColumnRange(new RangeBuilder().setLimit(pageSize).build());
ColumnList<IndexColumnName> result;
result= query.execute().getResult();
while (!result.isEmpty()) {
//handle result here
result= query.execute().getResult();
}
There are 2003 records in the DB, if the pageSize is set to 1100, I get only 2002 records back.
and if the pageSize is set to 3000, I can get the all 2003 records back.
Does anyone know why? Is it a bug?
Thanks
Boying
Re: Query returns incomplete result
Posted by Aaron Morton <aa...@thelastpickle.com>.
Calling execute the second time runs the query a second time, and it looks like the query mutates instance state during the pagination.
What happens if you only call execute() once ?
Cheers
Aaron
-----------------
Aaron Morton
New Zealand
@aaronmorton
Co-Founder & Principal Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com
On 8/05/2014, at 8:03 pm, Lu, Boying <Bo...@emc.com> wrote:
> Hi, All,
>
> I use the astyanax 1.56.48 + Cassandra 2.0.6 in my test codes and do some query like this:
>
> query = keyspace.prepareQuery(..).getKey(…)
> .autoPaginate(true)
> .withColumnRange(new RangeBuilder().setLimit(pageSize).build());
>
> ColumnList<IndexColumnName> result;
> result= query.execute().getResult();
> while (!result.isEmpty()) {
> //handle result here
> result= query.execute().getResult();
> }
>
> There are 2003 records in the DB, if the pageSize is set to 1100, I get only 2002 records back.
> and if the pageSize is set to 3000, I can get the all 2003 records back.
>
> Does anyone know why? Is it a bug?
>
> Thanks
>
> Boying