Reading system.peers and system.local from one node

762 views
Skip to first unread message

Jan Kristof Nidzwetzki

unread,
Jun 2, 2015, 7:03:45 AM6/2/15
to cpp-dri...@lists.datastax.com
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

Alex Popescu

unread,
Jun 7, 2015, 1:08:36 AM6/7/15
to cpp-dri...@lists.datastax.com
This is interesting as the driver already has a view of the cluster topology in the control connection [1].

[1]: https://github.com/datastax/cpp-driver/blob/1bdf1f811df5ec51cadd3e9c6fdc1bb5d76afe65/src/control_connection.hpp

--
Bests,

Alex Popescu | @al3xandru
Sen. Product Manager @ DataStax

Jan Kristof Nidzwetzki

unread,
Jun 7, 2015, 7:55:20 AM6/7/15
to cpp-dri...@lists.datastax.com
Hello Alex,

thank you very much for your reply. The driver holds the desired information in his control connection. But as far as I know, there is currently no way to access the data from outside of the driver. The control connection is marked as private in the Session.

It would be great if the cpp-driver could make information about the logical ring publicly available.

Best Regards
Jan

Michael Penick

unread,
Jun 23, 2015, 2:04:58 PM6/23/15
to cpp-dri...@lists.datastax.com
Sorry for the delay. I've been out for the past two weeks.

We do plan to expose this data. Here's the JIRA for that https://datastax-oss.atlassian.net/browse/CPP-186

Please feel free to your input add to that ticket.

Mike


To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-us...@lists.datastax.com.

Vladimir Avram

unread,
Aug 25, 2016, 3:02:01 PM8/25/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
I was wondering if there are there any plans to pick this up again? If not is there some way to page through a table but only request local data?

What I'm trying to achieve is a distributed scan of a table such that each node only touches local data.

Best,

Vlad

Reply all
Reply to author
Forward
0 new messages