Search code examples
cassandrapycassa

How to get_range for available rows in Cassandra?


In my application, I want to get all the rows in a column family, but to ignore the rows that are temporarily unavailable (e.g. some nodes are down).

I have multiple nodes. If one of the node is down, then get_range will throw UnavailableException, and I can get nothing.

What I want is to get all the rows that are currently available, because, to the user, its better than nothing. How can I do this?

  • I'm using pycassa.
  • The row keys in my column family are like random string, so I cannot use get to get all the rows one by one.

Solution

  • If get_range by token support is added to pycassa, you could fetch each token range (as reported by describe_ring) separately, discarding those that resulted in an UnavailableException. Barring that, using consistency level ONE is your best option, as Dean mentions.