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 D4C701BA8 for ; Wed, 20 Apr 2011 01:39:41 +0000 (UTC) Received: (qmail 96634 invoked by uid 500); 20 Apr 2011 01:39:39 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 96568 invoked by uid 500); 20 Apr 2011 01:39:39 -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 96560 invoked by uid 99); 20 Apr 2011 01:39:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 01:39:39 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a59.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2011 01:39:34 +0000 Received: from homiemail-a59.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a59.g.dreamhost.com (Postfix) with ESMTP id BC9AA564057 for ; Tue, 19 Apr 2011 18:39:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; q=dns; s= thelastpickle.com; b=1HVHdKD33S1AolDSkxFLpi9xOJ7cGgCatmgh2feSZ13 4WptjTeso0zI34rl3ZNTmExn+slMSSSOJVjg17kjpHxFnej86gBUgtH4g5yjUgxD ufRzjM1f3MwZotLg2pOm4tBiyLDRmzZBUknSiPYmWjxWZIQF5G/VQ/WRIDU/EqJk = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h= content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; s= thelastpickle.com; bh=cUhEyUlG7G7KIss/EcMFyHKKyak=; b=JCB4Vi3sCU dBpT0a1Kfi6J8yuIwu4XZcQfY3mnb9ft+C6yVMABHFTjdNVj3ZvNANKoR89aItai qA67QWt3fW669jWpgz51Bj0PjXXDeHtBKWXtaEJeIrZbnMiDiRBFj/m0DMvY08LS d/VFzGmVzOHhhOCDlAGhP/PLH/aqs2sz0= Received: from [10.0.1.155] (121-73-157-230.cable.telstraclear.net [121.73.157.230]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a59.g.dreamhost.com (Postfix) with ESMTPSA id 1781256405C for ; Tue, 19 Apr 2011 18:39:07 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Cassandra 0.7.4 and LOCAL_QUORUM Consistency level From: aaron morton In-Reply-To: <-3233914404432019140@unknownmsgid> Date: Wed, 20 Apr 2011 13:39:05 +1200 Content-Transfer-Encoding: quoted-printable Message-Id: <6BB62EB1-39FC-438B-BD36-50C3D0AD90A7@thelastpickle.com> References: <-3233914404432019140@unknownmsgid> To: user@cassandra.apache.org X-Mailer: Apple Mail (2.1084) You need to be using NTS. When NetworkTopologySetting is used it overrides the = AbstractReplicationStrategy.getWriteResponseHandler() function in your = stack and returns a either a DataCentreWriteResponseHandler for = LOCAL_QUORUM or DatacenterSyncWriteResponseHandler for EACH_QUORUM . = They are DC aware. =20 Aaron =20 On 20 Apr 2011, at 13:25, William Oberman wrote: > Good point, should have read your message (and the code) more closely! >=20 > Sent from my iPhone >=20 > On Apr 19, 2011, at 9:16 PM, Oleg Tsvinev = wrote: >=20 >> 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? >>=20 >> 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 = having a >>> properly configured NetworkTopologyStrategy. QUORUM worked fine = however. >>> will >>>=20 >>> On Tue, Apr 19, 2011 at 8:52 PM, Oleg Tsvinev = >>> wrote: >>>>=20 >>>> Earlier I've posted the same message to a hector-users list. >>>>=20 >>>> Guys, >>>>=20 >>>> 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. >>>>=20 >>>> 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 >>>>=20 >>>> :-\ >>>>=20 >>>> (1) Exception: >>>>=20 >>>> 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(WriteR= esponseHandler.java:99) >>>> at >>>> = org.apache.cassandra.service.WriteResponseHandler.(WriteResponseHand= ler.java:48) >>>> at >>>> = org.apache.cassandra.service.WriteResponseHandler.create(WriteResponseHand= ler.java:61) >>>> at >>>> = org.apache.cassandra.locator.AbstractReplicationStrategy.getWriteResponseH= andler(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.j= ava:388) >>>> at >>>> = org.apache.cassandra.thrift.Cassandra$Processor$batch_mutate.process(Cassa= ndra.java:3036) >>>> at >>>> = org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:255= 5) >>>> at >>>> = org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(Cust= omTThreadPoolServer.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) >>>>=20 >>>> (2) Cassandra source (line 99 is throw statement) >>>>=20 >>>> protected int determineBlockFor(String table) >>>> { >>>> int blockFor =3D 0; >>>> switch (consistencyLevel) >>>> { >>>> case ONE: >>>> blockFor =3D 1; >>>> break; >>>> case ANY: >>>> blockFor =3D 1; >>>> break; >>>> case TWO: >>>> blockFor =3D 2; >>>> break; >>>> case THREE: >>>> blockFor =3D 3; >>>> break; >>>> case QUORUM: >>>> blockFor =3D (writeEndpoints.size() / 2) + 1; >>>> break; >>>> case ALL: >>>> blockFor =3D 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 <=3D blockFor && blockFor <=3D 2 * >>>> Table.open(table).getReplicationStrategy().getReplicationFactor() >>>> : String.format("invalid response count %d for replication >>>> factor %d", >>>> blockFor, >>>> Table.open(table).getReplicationStrategy().getReplicationFactor()); >>>> return blockFor; >>>> } >>>>=20 >>>> (3) cassandra.thrift: >>>>=20 >>>> enum ConsistencyLevel { >>>> ONE =3D 1, >>>> QUORUM =3D 2, >>>> LOCAL_QUORUM =3D 3, >>>> EACH_QUORUM =3D 4, >>>> ALL =3D 5, >>>> ANY =3D 6, >>>> TWO =3D 7, >>>> THREE =3D 8, >>>> } >>>=20 >>>=20 >>>=20 >>> -- >>> Will Oberman >>> Civic Science, Inc. >>> 3030 Penn Avenue., First Floor >>> Pittsburgh, PA 15201 >>> (M) 412-480-7835 >>> (E) oberman@civicscience.com >>>=20