cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard grossman <richie...@gmail.com>
Subject Is the remove api working ??
Date Mon, 16 Nov 2009 17:19:13 GMT
Hi

I try to delete a CF from List of keys that I get from get_key_range.
Because I don't want to get all the key I just build bunch of 1000 key and
delete them.
All seems but the column are never removed If I run exactly the same code
twice I get the key like never deleted.

Could you help me ??

here is the code I use:
        List<String> keys = cassandraClient.get_key_range("Keyspace1",
"channelShow", String.valueOf(start.getTimeInMillis()), stopKey, 1,
ConsistencyLevel.ONE);
        if (keys != null && keys.size() == 1) {
            String startKey = keys.get(0);
            do {
                keys = cassandraClient.get_key_range("Keyspace1",
"channelShow", startKey, stopKey, 1000, ConsistencyLevel.ONE);

                long time = System.currentTimeMillis();
                for (String key : keys) {
                    long timestamp = System.currentTimeMillis();
                    cassandraClient.remove("Keyspace1", key, columnPath,
timestamp, ConsistencyLevel.ONE);
                }

                if (keys.size() < 1000) {
                    keys = null;
                } else {
                    startKey = keys.get(keys.size() - 1);
                }
            } while (keys != null && keys.size() > 0);
        }

All

Mime
View raw message