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 2180B2FD for ; Wed, 20 Apr 2011 02:03:36 +0000 (UTC) Received: (qmail 18892 invoked by uid 500); 20 Apr 2011 02:03:34 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 18775 invoked by uid 500); 20 Apr 2011 02:03:34 -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 18767 invoked by uid 99); 20 Apr 2011 02:03:34 -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:03:34 +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 jbellis@gmail.com designates 209.85.212.44 as permitted sender) Received: from [209.85.212.44] (HELO mail-vw0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 02:03:28 +0000 Received: by vws12 with SMTP id 12so261202vws.31 for ; Tue, 19 Apr 2011 19:03:07 -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=MTHDvmxF2PLzASQrC16tMrMnPSnUIuGBWwvZdFMOtSc=; b=k+c8hzZsRW5Qm0ksH4WIOwULHY9U3JtH9J6WpHxMd7HzbOgH5wlyv5gDdyT3g07AA1 nhrUzCgHbHsVYLIyNRqTK/nD1MR5X6Z7HTyZMDw1ve6105D5mI6yx0S3PoeoCw+Jp/bj ImDa/k4gxidVARm1AHaKOM548El5EV52Psp/A= 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=SV3zzyr7Wzv9sWAIracB2GbA1v0ZVQ1e5/FXT178HDQY2zF0JiKBcssByNMUuJ+aGQ cnB/bfZu65UqVRw4J+Kp97ym0oUCbRRVnyAQFLiGQohklNIGW2KXYfW6JtaOo4Hh6mFl J+4rEpnE03JM1CijyXqQhxU+1aLEN+bMLYpdM= Received: by 10.52.98.34 with SMTP id ef2mr2603219vdb.293.1303264986067; Tue, 19 Apr 2011 19:03:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.185.6 with HTTP; Tue, 19 Apr 2011 19:02:46 -0700 (PDT) In-Reply-To: <6BB62EB1-39FC-438B-BD36-50C3D0AD90A7@thelastpickle.com> References: <-3233914404432019140@unknownmsgid> <6BB62EB1-39FC-438B-BD36-50C3D0AD90A7@thelastpickle.com> From: Jonathan Ellis Date: Tue, 19 Apr 2011 21:02:46 -0500 Message-ID: Subject: Re: Cassandra 0.7.4 and LOCAL_QUORUM Consistency level To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 wro= te: > You need to be using NTS. > > When NetworkTopologySetting is used it overrides the AbstractReplicationS= trategy.getWriteResponseHandler() function in your stack and returns a eith= er a DataCentreWriteResponseHandler for LOCAL_QUORUM or DatacenterSyncWrite= ResponseHandler for =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 wrote= : >> >>> 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 ha= ving a >>>> properly configured NetworkTopologyStrategy. =A0QUORUM worked fine how= ever. >>>> 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 fo= r >>>>> 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 >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.service.WriteResponseHandler.determineBlockFor(W= riteResponseHandler.java:99) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.service.WriteResponseHandler.(WriteRespons= eHandler.java:48) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.service.WriteResponseHandler.create(WriteRespons= eHandler.java:61) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.locator.AbstractReplicationStrategy.getWriteResp= onseHandler(AbstractReplicationStrategy.java:127) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.service.StorageProxy.mutate(StorageProxy.java:11= 5) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.thrift.CassandraServer.doInsert(CassandraServer.= java:415) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.thrift.CassandraServer.batch_mutate(CassandraSer= ver.java:388) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.process(= Cassandra.java:3036) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.jav= a:2555) >>>>> =A0 =A0 =A0at >>>>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run= (CustomTThreadPoolServer.java:206) >>>>> =A0 =A0 =A0at >>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec= utor.java:886) >>>>> =A0 =A0 =A0at >>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor= .java:908) >>>>> =A0 =A0 =A0at java.lang.Thread.run(Thread.java:662) >>>>> >>>>> (2) Cassandra source (line 99 is throw statement) >>>>> >>>>> =A0protected int determineBlockFor(String table) >>>>> =A0{ >>>>> =A0 =A0 =A0int blockFor =3D 0; >>>>> =A0 =A0 =A0switch (consistencyLevel) >>>>> =A0 =A0 =A0{ >>>>> =A0 =A0 =A0 =A0 =A0case ONE: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D 1; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0case ANY: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D 1; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0case TWO: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D 2; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0case THREE: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D 3; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0case QUORUM: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D (writeEndpoints.size() / 2) += 1; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0case ALL: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor =3D writeEndpoints.size(); >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0 =A0default: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new UnsupportedOperationException("i= nvalid >>>>> 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 =A0assert 1 <=3D blockFor && blockFor <=3D 2 * >>>>> Table.open(table).getReplicationStrategy().getReplicationFactor() >>>>> =A0 =A0 =A0 =A0 =A0: String.format("invalid response count %d for rep= lication >>>>> factor %d", >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0blockFor, >>>>> Table.open(table).getReplicationStrategy().getReplicationFactor()); >>>>> =A0 =A0 =A0return blockFor; >>>>> =A0} >>>>> >>>>> (3) cassandra.thrift: >>>>> >>>>> enum ConsistencyLevel { >>>>> =A0ONE =3D 1, >>>>> =A0QUORUM =3D 2, >>>>> =A0LOCAL_QUORUM =3D 3, >>>>> =A0EACH_QUORUM =3D 4, >>>>> =A0ALL =3D 5, >>>>> =A0ANY =3D 6, >>>>> =A0TWO =3D 7, >>>>> =A0THREE =3D 8, >>>>> } >>>> >>>> >>>> >>>> -- >>>> Will Oberman >>>> Civic Science, Inc. >>>> 3030 Penn Avenue., First Floor >>>> Pittsburgh, PA 15201 >>>> (M) 412-480-7835 >>>> (E) oberman@civicscience.com >>>> > > --=20 Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com