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 EBBAB72D for ; Wed, 20 Apr 2011 02:51:49 +0000 (UTC) Received: (qmail 40264 invoked by uid 500); 20 Apr 2011 02:51:47 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 40209 invoked by uid 500); 20 Apr 2011 02:51:47 -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 40201 invoked by uid 99); 20 Apr 2011 02:51:45 -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 02:51:45 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of oleg.tsvinev@gmail.com designates 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 02:51:39 +0000 Received: by fxm15 with SMTP id 15so210332fxm.31 for ; Tue, 19 Apr 2011 19:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=5BFkngg4VWl/mALTtxDLCK7PBJDs2vtNNE4ZxhaW2MQ=; b=ImpS1jD4ZSda4kg0rHinH8pGm3Cb3+cxyoaNeaIEZ0dsmudxX2AFeBChX2hfCwH7XJ z8z+ls446/lso8ijoEdkQrz+WsQN26c4uqGWhwwADh4RDP4F8qps1TQIx6NM9S7LGDkq s1IEaaM/RWboeNqKwvPnRA2uLvf9dNDGFORu0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=RWFZr7ANA+A+aAaBUaJHIiQfFK3PJ0nTwA6L0qiNN+vxiIAeK26pxKl0hDcEnS5fde d7GFbXvvthjtkyiAneyKo5OTzWn2P3bsgGyqEijSBQe/ebWbC+Y49Ost4kVaOMxeyLCN 2G1LDJmEb3FUkaQvL674vY2jooBOLqomTHq7k= Received: by 10.223.49.70 with SMTP id u6mr1543348faf.120.1303267879145; Tue, 19 Apr 2011 19:51:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.42.85 with HTTP; Tue, 19 Apr 2011 19:50:59 -0700 (PDT) In-Reply-To: References: <-3233914404432019140@unknownmsgid> <6BB62EB1-39FC-438B-BD36-50C3D0AD90A7@thelastpickle.com> From: Oleg Tsvinev Date: Tue, 19 Apr 2011 19:50:59 -0700 Message-ID: Subject: Re: Cassandra 0.7.4 and LOCAL_QUORUM Consistency level To: user@cassandra.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Makes it clear! Thank you Jonathan. On Tue, Apr 19, 2011 at 7:02 PM, Jonathan Ellis wrote: > It doesn't make a lot of sense in general to allow those w/ non-NTS, > but it should be possible (e.g. if you've manually interleaved nodes > with ONTS so you know how many replicas are in each DC). > > Patch attached to https://issues.apache.org/jira/browse/CASSANDRA-2516 > > On Tue, Apr 19, 2011 at 8:39 PM, aaron morton w= rote: >> You need to be using NTS. >> >> When NetworkTopologySetting is used it overrides the AbstractReplication= Strategy.getWriteResponseHandler() function in your stack and returns a eit= her a DataCentreWriteResponseHandler for LOCAL_QUORUM or DatacenterSyncWrit= eResponseHandler for =C2=A0EACH_QUORUM . They are DC aware. >> >> Aaron >> >> >> On 20 Apr 2011, at 13:25, William Oberman wrote: >> >>> Good point, should have read your message (and the code) more closely! >>> >>> Sent from my iPhone >>> >>> On Apr 19, 2011, at 9:16 PM, Oleg Tsvinev wrot= e: >>> >>>> I'm puzzled because code does not even check for LOCAL_QUORUM before >>>> throwing exception. >>>> Indeed I did not configure NetworkTopologyStrategy. Are you saying >>>> that it works after configuring it? >>>> >>>> On Tue, Apr 19, 2011 at 6:04 PM, William Oberman >>>> wrote: >>>>> I had a similar error today when I tried using LOCAL_QUORUM without h= aving a >>>>> properly configured NetworkTopologyStrategy. =C2=A0QUORUM 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 f= or >>>>>> LOCAL_QUORUM. I also see that (3) cassandra.thrift defines >>>>>> LOCAL_QUORUM as enum value 3 and in debugger, I see that LOCAL_QUORU= M >>>>>> 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 somethin= g? >>>>>> 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 >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.service.WriteResponseHandler.determineBlockFor(= WriteResponseHandler.java:99) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.service.WriteResponseHandler.(WriteRespon= seHandler.java:48) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.service.WriteResponseHandler.create(WriteRespon= seHandler.java:61) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.locator.AbstractReplicationStrategy.getWriteRes= ponseHandler(AbstractReplicationStrategy.java:127) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.service.StorageProxy.mutate(StorageProxy.java:1= 15) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.thrift.CassandraServer.doInsert(CassandraServer= .java:415) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.thrift.CassandraServer.batch_mutate(CassandraSe= rver.java:388) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.process= (Cassandra.java:3036) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.ja= va:2555) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.ru= n(CustomTThreadPoolServer.java:206) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExe= cutor.java:886) >>>>>> =C2=A0 =C2=A0 =C2=A0at >>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecuto= r.java:908) >>>>>> =C2=A0 =C2=A0 =C2=A0at java.lang.Thread.run(Thread.java:662) >>>>>> >>>>>> (2) Cassandra source (line 99 is throw statement) >>>>>> >>>>>> =C2=A0protected int determineBlockFor(String table) >>>>>> =C2=A0{ >>>>>> =C2=A0 =C2=A0 =C2=A0int blockFor =3D 0; >>>>>> =C2=A0 =C2=A0 =C2=A0switch (consistencyLevel) >>>>>> =C2=A0 =C2=A0 =C2=A0{ >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ONE: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D 1; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ANY: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D 1; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case TWO: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D 2; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case THREE: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D 3; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case QUORUM: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D (writeE= ndpoints.size() / 2) + 1; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case ALL: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0blockFor =3D writeEn= dpoints.size(); >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default: >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0throw new Unsupporte= dOperationException("invalid >>>>>> consistency level: " + consistencyLevel.toString()); >>>>>> =C2=A0 =C2=A0 =C2=A0} >>>>>> =C2=A0 =C2=A0 =C2=A0// at most one node per range can bootstrap at a= time, and >>>>>> these will be added to the write until >>>>>> =C2=A0 =C2=A0 =C2=A0// bootstrap finishes (at which point we no long= er need to >>>>>> write to the old ones). >>>>>> =C2=A0 =C2=A0 =C2=A0assert 1 <=3D blockFor && blockFor <=3D 2 * >>>>>> Table.open(table).getReplicationStrategy().getReplicationFactor() >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0: String.format("invalid response = count %d for replication >>>>>> factor %d", >>>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0blockFor, >>>>>> Table.open(table).getReplicationStrategy().getReplicationFactor()); >>>>>> =C2=A0 =C2=A0 =C2=A0return blockFor; >>>>>> =C2=A0} >>>>>> >>>>>> (3) cassandra.thrift: >>>>>> >>>>>> enum ConsistencyLevel { >>>>>> =C2=A0ONE =3D 1, >>>>>> =C2=A0QUORUM =3D 2, >>>>>> =C2=A0LOCAL_QUORUM =3D 3, >>>>>> =C2=A0EACH_QUORUM =3D 4, >>>>>> =C2=A0ALL =3D 5, >>>>>> =C2=A0ANY =3D 6, >>>>>> =C2=A0TWO =3D 7, >>>>>> =C2=A0THREE =3D 8, >>>>>> } >>>>> >>>>> >>>>> >>>>> -- >>>>> Will Oberman >>>>> Civic Science, Inc. >>>>> 3030 Penn Avenue., First Floor >>>>> Pittsburgh, PA 15201 >>>>> (M) 412-480-7835 >>>>> (E) oberman@civicscience.com >>>>> >> >> > > > > -- > Jonathan Ellis > Project Chair, Apache Cassandra > co-founder of DataStax, the source for professional Cassandra support > http://www.datastax.com >