cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ackerman, Mitchell" <>
Subject RE: INSERT ... IF NOT EXISTS with some nodes unavailable
Date Tue, 03 Jun 2014 20:29:09 GMT
Thanks Haebin, I scaled up to a 3 node system and it now behaves as expected.  Was trying to
simplify the test case but shot myself in the foot instead.


From: [] On Behalf Of Frederick Haebin Na
Sent: Tuesday, June 03, 2014 2:17 AM
Subject: Re: INSERT ... IF NOT EXISTS with some nodes unavailable

Hello Mitchell,

I think it is due to your replication factor, which, I assume, is 2 since you have only 2
nodes in the cluster.
If you are using even number of nodes, Cassandra is impossible to run queries require QUORUM

So, I think you have to expand your cluster to 3 nodes and make replication factor 3.


2014-06-03 12:09 GMT+09:00 Ackerman, Mitchell <<>>:
Hi, I’m trying to get a query using

               INSERT ... IF NOT EXISTS

working when not all of the nodes are available.  As a test case I have 2 nodes, one in AWS
us-west-1, another in AWS eu-west-1.  The keyspace settings are described below.  When I only
have one of the nodes available, the insert fails with an UnavaliableException (via TokenRangeOfflineException,
see below for details).

From reading about the lightweight transactions (
and the CQL expression, it looks like this scenario should be supported. Does anyone have
any idea why it is not working?

You will notice that I’m using Astyanax, could this be a source of problems for this use

I presume that a Consistency Level of Serial is in use and that a quorum of 1 should suffice
for a 2 node cache.

Thanks, Mitchell


replica_placement_strategy         org.apache.cassandra.locator.NetworkTopologyStrategy
Replication Strategy Options
us-west                1
eu-west               1

CREATE TABLE conferenceassignmentcache.conferenceassignmentcache_cf (
  id text PRIMARY KEY,
  value text
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};

When I try to INSERT a row with only one node available I get the following exception:

2014-06-02 20:57:59,947 [eventTaskExecutor-15] DEBUG [CassandraConferenceAssignmentManager.getInsertStatement()
53] - INSERT INTO conferenceassignmentcache_cf (id, value) VALUES (?, ?) IF NOT EXISTS USING
TTL 60;
2014-06-02 20:58:00,084 [eventTaskExecutor-15] DEBUG [ThriftConverter.ToConnectionPoolException()
157] -
2014-06-02 20:58:00,086 [eventTaskExecutor-15] ERROR [CountingConnectionPoolMonitor.trackError()
94] - TokenRangeOfflineException:
latency=137(137), attempts=1]UnavailableException() TokenRangeOfflineException:
latency=137(137), attempts=1]UnavailableException()

Caused by: UnavailableException()
       at org.apache.cassandra.thrift.Cassandra$
       at org.apache.thrift.TServiceClient.receiveBase(
       at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_prepared_cql3_query(
       at org.apache.cassandra.thrift.Cassandra$Client.execute_prepared_cql3_query(
       ... 35 more

View raw message