Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2C05188D for ; Wed, 20 Apr 2011 01:05:14 +0000 (UTC) Received: (qmail 69921 invoked by uid 500); 20 Apr 2011 01:05:12 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 69889 invoked by uid 500); 20 Apr 2011 01:05:12 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 69881 invoked by uid 99); 20 Apr 2011 01:05:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 01:05:12 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 209.85.214.44 is neither permitted nor denied by domain of oberman@civicscience.com) Received: from [209.85.214.44] (HELO mail-bw0-f44.google.com) (209.85.214.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 01:05:04 +0000 Received: by bwz13 with SMTP id 13so254848bwz.31 for ; Tue, 19 Apr 2011 18:04:43 -0700 (PDT) Received: by 10.204.32.9 with SMTP id a9mr5720558bkd.182.1303261483235; Tue, 19 Apr 2011 18:04:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.118.197 with HTTP; Tue, 19 Apr 2011 18:04:23 -0700 (PDT) X-Originating-IP: [24.131.19.240] In-Reply-To: References: From: William Oberman Date: Tue, 19 Apr 2011 21:04:23 -0400 Message-ID: Subject: Re: Cassandra 0.7.4 and LOCAL_QUORUM Consistency level To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=000325556532c1fbb004a14f358b X-Virus-Checked: Checked by ClamAV on apache.org --000325556532c1fbb004a14f358b Content-Type: text/plain; charset=ISO-8859-1 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 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.(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 --000325556532c1fbb004a14f358b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I had a similar error today when I tried using LOCAL_QUORUM without having = a properly configured NetworkTopologyStrategy. =A0QUORUM worked fine howeve= r.

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<= br> 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_Q= UORUM
=A0 =A0 =A0 at org.apache.cassandra.service.WriteResponseHandler.determine= BlockFor(WriteResponseHandler.java:99)
=A0 =A0 =A0 at org.apache.cassandra.service.WriteResponseHandler.<init&= gt;(WriteResponseHandler.java:48)
=A0 =A0 =A0 at org.apache.cassandra.service.WriteResponseHandler.create(Wr= iteResponseHandler.java:61)
=A0 =A0 =A0 at org.apache.cassandra.locator.AbstractReplicationStrategy.ge= tWriteResponseHandler(AbstractReplicationStrategy.java:127)
=A0 =A0 =A0 at org.apache.cassandra.service.StorageProxy.mutate(StoragePro= xy.java:115)
=A0 =A0 =A0 at org.apache.cassandra.thrift.CassandraServer.doInsert(Cassan= draServer.java:415)
=A0 =A0 =A0 at org.apache.cassandra.thrift.CassandraServer.batch_mutate(Ca= ssandraServer.java:388)
=A0 =A0 =A0 at org.apache.cassandra.thrift.Cassandra$Processor$batch_mutat= e.process(Cassandra.java:3036)
=A0 =A0 =A0 at org.apache.cassandra.thrift.Cassandra$Processor.process(Cas= sandra.java:2555)
=A0 =A0 =A0 at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerP= rocess.run(CustomTThreadPoolServer.java:206)
=A0 =A0 =A0 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Thre= adPoolExecutor.java:886)
=A0 =A0 =A0 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPo= olExecutor.java:908)
=A0 =A0 =A0 at java.lang.Thread.run(Thread.java:662)

(2) Cassandra source (line 99 is throw statement)

=A0 protected int determineBlockFor(String table)
=A0 {
=A0 =A0 =A0 int blockFor =3D 0;
=A0 =A0 =A0 switch (consistencyLevel)
=A0 =A0 =A0 {
=A0 =A0 =A0 =A0 =A0 case ONE:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D 1;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 case ANY:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D 1;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 case TWO:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D 2;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 case THREE:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D 3;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 case QUORUM:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D (writeEndpoints.size() / 2) + 1;<= br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 case ALL:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor =3D writeEndpoints.size();
=A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
=A0 =A0 =A0 =A0 =A0 default:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new UnsupportedOperationException("= invalid
consistency level: " + consistencyLevel.toString());
=A0 =A0 =A0 }
=A0 =A0 =A0 // at most one node per range can bootstrap at a time, and
these will be added to the write until
=A0 =A0 =A0 // bootstrap finishes (at which point we no longer need to
write to the old ones).
=A0 =A0 =A0 assert 1 <=3D blockFor && blockFor <=3D 2 *
Table.open(table).getReplicationStrategy().getReplicationFactor()
=A0 =A0 =A0 =A0 =A0 : String.format("invalid response count %d for re= plication
factor %d",
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 blockFor,
Table.open(table).getReplicationStrategy().getReplicationFactor());
=A0 =A0 =A0 return blockFor;
=A0 }

(3) cassandra.thrift:

enum ConsistencyLevel {
=A0 ONE =3D 1,
=A0 QUORUM =3D 2,
=A0 LOCAL_QUORUM =3D 3,
=A0 EACH_QUORUM =3D 4,
=A0 ALL =3D 5,
=A0 ANY =3D 6,
=A0 TWO =3D 7,
=A0 THREE =3D 8,
}



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