cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Oberman <ober...@civicscience.com>
Subject Re: Cassandra 0.7.4 and LOCAL_QUORUM Consistency level
Date Wed, 20 Apr 2011 01:04:23 GMT
I had a similar error today when I tried using LOCAL_QUORUM without having a
properly configured NetworkTopologyStrategy.  QUORUM worked fine however.

will

On Tue, Apr 19, 2011 at 8:52 PM, Oleg Tsvinev <oleg.tsvinev@gmail.com>wrote:

> Earlier I've posted the same message to a hector-users list.
>
> Guys,
>
> I'm a bit puzzled today. I'm using just released Hector 0.7.0-29
> (thank you, Nate!) and Cassandra 0.7.4 and getting the exception
> below, marked as (1) Exception. When I dig to Cassandra source code
> below, marked as (2) Cassandra source, I see that there's no check for
> LOCAL_QUORUM. I also see that (3) cassandra.thrift defines
> LOCAL_QUORUM as enum value 3 and in debugger, I see that LOCAL_QUORUM
> is a valid enum value.
>
> My question is, how is it possible to use LOCAL_QUORUM if Cassandra
> code throws exception when it sees it? Is it a bad merge or something?
> I know it worked before, from looking at
> https://issues.apache.org/jira/browse/CASSANDRA-2254
>
> :-\
>
> (1) Exception:
>
> 2011-04-19 14:57:33,550 [pool-2-thread-49] ERROR
> org.apache.cassandra.thrift.Cassandra$Processor - Internal error
> processing batch_mutate
> java.lang.UnsupportedOperationException: invalid consistency level:
> LOCAL_QUORUM
>       at
> org.apache.cassandra.service.WriteResponseHandler.determineBlockFor(WriteResponseHandler.java:99)
>       at
> org.apache.cassandra.service.WriteResponseHandler.<init>(WriteResponseHandler.java:48)
>       at
> org.apache.cassandra.service.WriteResponseHandler.create(WriteResponseHandler.java:61)
>       at
> org.apache.cassandra.locator.AbstractReplicationStrategy.getWriteResponseHandler(AbstractReplicationStrategy.java:127)
>       at
> org.apache.cassandra.service.StorageProxy.mutate(StorageProxy.java:115)
>       at
> org.apache.cassandra.thrift.CassandraServer.doInsert(CassandraServer.java:415)
>       at
> org.apache.cassandra.thrift.CassandraServer.batch_mutate(CassandraServer.java:388)
>       at
> org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.process(Cassandra.java:3036)
>       at
> org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:2555)
>       at
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:206)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:662)
>
> (2) Cassandra source (line 99 is throw statement)
>
>   protected int determineBlockFor(String table)
>   {
>       int blockFor = 0;
>       switch (consistencyLevel)
>       {
>           case ONE:
>               blockFor = 1;
>               break;
>           case ANY:
>               blockFor = 1;
>               break;
>           case TWO:
>               blockFor = 2;
>               break;
>           case THREE:
>               blockFor = 3;
>               break;
>           case QUORUM:
>               blockFor = (writeEndpoints.size() / 2) + 1;
>               break;
>           case ALL:
>               blockFor = writeEndpoints.size();
>               break;
>           default:
>               throw new UnsupportedOperationException("invalid
> consistency level: " + consistencyLevel.toString());
>       }
>       // at most one node per range can bootstrap at a time, and
> these will be added to the write until
>       // bootstrap finishes (at which point we no longer need to
> write to the old ones).
>       assert 1 <= blockFor && blockFor <= 2 *
> Table.open(table).getReplicationStrategy().getReplicationFactor()
>           : String.format("invalid response count %d for replication
> factor %d",
>                           blockFor,
> Table.open(table).getReplicationStrategy().getReplicationFactor());
>       return blockFor;
>   }
>
> (3) cassandra.thrift:
>
> enum ConsistencyLevel {
>   ONE = 1,
>   QUORUM = 2,
>   LOCAL_QUORUM = 3,
>   EACH_QUORUM = 4,
>   ALL = 5,
>   ANY = 6,
>   TWO = 7,
>   THREE = 8,
> }
>



-- 
Will Oberman
Civic Science, Inc.
3030 Penn Avenue., First Floor
Pittsburgh, PA 15201
(M) 412-480-7835
(E) oberman@civicscience.com

Mime
View raw message