Hello,
in one of my applications, I need to determine the structure of the logical ring of Cassandra. All the information I need are stored in the two tables 'system.local' and 'system.peers'. The first one contains the tokens, owned by the local Cassandra node. The second one contains the tokens of the other Cassandra nodes.
To get the information, I use CQL statements like these:
select tokens from system.local:
select tokens from system.peers;
Then, I merge the tokens from both tables to get the required information. The problem is, that both statements have to be executed on the same Cassandra node. Otherwise, the content of the table system.local does not fit the content of the table system.peers. Normally, the load balancing policies of the cpp-driver spread the queries across the nodes of the cluster and the mentioned problem occurs.
To solve this issue, I created a special load balancing policy that spreads statements exactly to one node. With this policy, I could ensure that both statements are executed on node. I use my load balancing successfully for over a year now. Is anybody else interested in this load balancing policy? So, I would create a pull request against the current cpp-driver.
An equivalent problem is described here:
https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/Q1C3dFwpDGg . The author had the same problem with the Java version of the Cassandra driver and he creates a special load balancing policy too.
Best Regards
Jan