You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by 鄢来琼 <la...@gtafe.com> on 2015/07/31 03:02:52 UTC

query statement return empty

Hi ALL

The result of “select * from t_test where id = 1” statement is not consistency,
Could you tell me why?

test case,
I = 0;
While I < 5:
    result = cassandra_session.execute(“select ratio from t_test where id = 1”)
print result

testing result:
[Row(ratio=Decimal('0.000'))]
[]
[Row(ratio=Decimal('0.000'))]
[Row(ratio=Decimal('0.000'))]
[Row(ratio=Decimal('0.000'))]

Cassandra cluster:
My Cassandra version is 2.12,
the Cassandra cluster has 9 nodes.
The python driver version is 2.6

I have tested both the AsyncoreConnection and LibevConnection, the results are in consistency.

Thanks a lot.

Peter

Re: query statement return empty

Posted by Jeff Jirsa <Je...@crowdstrike.com>.
What consistency level are you using with your query?
What replication factor are you using on your keyspace?
Have you run repair?

The most likely explanation is that you wrote with low consistency (ANY, ONE, etc), and that one or more replicas does not have the cell. You’re then reading with low consistency (ONE, etc), and occasionally the coordinator choses a replica without the data, so it is returning an empty result.

You can either increase your consistency level on reads and/or writes, or you can run repair to get the data on all nodes.



From:  鄢来琼
Reply-To:  "user@cassandra.apache.org"
Date:  Thursday, July 30, 2015 at 6:02 PM
To:  "user@cassandra.apache.org"
Subject:  query statement return empty

Hi ALL

 

The result of “select * from t_test where id = 1” statement is not consistency,

Could you tell me why?

 

test case,

I = 0;

While I < 5:

    result = cassandra_session.execute(“select ratio from t_test where id = 1”)

print result

 

testing result:

[Row(ratio=Decimal('0.000'))]

[]

[Row(ratio=Decimal('0.000'))]

[Row(ratio=Decimal('0.000'))]

[Row(ratio=Decimal('0.000'))]

 

Cassandra cluster:

My Cassandra version is 2.12, 

the Cassandra cluster has 9 nodes.

The python driver version is 2.6

 

I have tested both the AsyncoreConnection and LibevConnection, the results are in consistency.

 

Thanks a lot.

 

Peter