incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman, Tim" <tim.free...@hp.com>
Subject RE: Is the remove api working ??
Date Mon, 16 Nov 2009 18:06:25 GMT
You get consistency if R + W > N, where R is the number of records to read, W is the number
of records to write, and N is the replication factor.  A ConsistencyLevel of ONE means R or
W is 1.  A ConsistencyLevel of QUORUM means R or W is ceiling((N+1)/2).  A ConsistencyLevel
of ALL means R or W is N.  So if you want to write with a ConsistencyLevel of ONE and then
get the same data when you read, you need to read with ConsistencyLevel ALL.

Tim Freeman
Email: tim.freeman@hp.com<mailto:tim.freeman@hp.com>
Desk in Palo Alto: (650) 857-2581
Home: (408) 774-1298
Cell: (408) 348-7536 (No reception business hours Monday, Tuesday, and Thursday; call my desk
instead.)

From: Richard grossman [mailto:richiesgr@gmail.com]
Sent: Monday, November 16, 2009 9:37 AM
To: cassandra-user@incubator.apache.org
Subject: Re: Is the remove api working ??

Thanks

The QUORUM params do the job as expected.

But If I've multiple servers and have inserted the data with ONE then what it's means I need
to use only QUORUM instead ?

Thanks
On Mon, Nov 16, 2009 at 7:27 PM, Freeman, Tim <tim.freeman@hp.com<mailto:tim.freeman@hp.com>>
wrote:
You might want to try ConsistencyLevel.QUORUM instead of ConsistencyLevel.ONE if you're having
issues with consistency.

If you're running only one node, that shouldn't matter.

Tim Freeman
Email: tim.freeman@hp.com<mailto:tim.freeman@hp.com>
Desk in Palo Alto: (650) 857-2581
Home: (408) 774-1298
Cell: (408) 348-7536 (No reception business hours Monday, Tuesday, and Thursday; call my desk
instead.)

From: Richard grossman [mailto:richiesgr@gmail.com<mailto:richiesgr@gmail.com>]
Sent: Monday, November 16, 2009 9:19 AM
To: cassandra-user@incubator.apache.org<mailto:cassandra-user@incubator.apache.org>
Subject: Is the remove api working ??

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