O'Reilly logo

Cassandra High Performance Cookbook by Edward Capriolo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using range scans to find and remove old data

The primary operations used in Cassandra are get and insert operations. In many applications, data can become stale and is no longer needed. In these type of application, a process can be used to iterate all the data on the node using range scans. This recipe shows how to use range scans to iterate all the data in a cluster and remove data older than a user-supplied number of seconds.

How to do it...

  1. Create a file <hpcbuild>/src/hpcas/c03/Ranger.java.
    package hpcas.c03; import hpcas.c03.FramedConnWrapper; import hpcas.c03.Util; import java.math.BigInteger; import java.util.*; import org.apache.cassandra.thrift.*; import org.apache.cassandra.utils.FBUtilities; public class Ranger { int size = 0; Cassandra.Client ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required