问题
My question is a follow up of this topic : Cassandra load balancing with TokenAwarePolicy and shuffleReplicas
I'm encountering some issues regarding the TokenAwarePolicy that I don't understand.
Cluster configuration :
- 3 nodes
- Replication factor = 3
- Load balancing policy :
new TokenAwarePolicy(new RoundRobinPolicy(), false)
- Consitancy level (Reads/Writes) : ONE
Shuffling replicas is set to false on purpose. But the thing is that I'm encountering consistency problems when reading datas in my application. For instance :
- Insert 10 entities
- Dome some other operations with the DB...(insert other entites)
- Select the previously created entities: All fields are given in the 'SELECT' clause, not 'SELECT *'. Primary key is present in the 'WHERE' clause.
Result : Sometimes getting the right number of entites(10) but sometings getting less (from 0 to 9).
Notice:
- I'm using BoundStatements only.
- I'm not using datastax's asynchronous methods.
- I have checked that the routing key was not null on the 'failed' queries, it wasn't.
I have to admit that I'm targeting the DB with an heavy load (30 threads running X times the above sample together), but still I don't understand why the driver is not querying the right node, giving me stale datas.
Thanks for your answer.
来源:https://stackoverflow.com/questions/37752397/cassandra-driverdatastax-load-balancing-with-tokenawarepolicy