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 8C9B9172C2 for ; Thu, 6 Nov 2014 15:30:29 +0000 (UTC) Received: (qmail 87674 invoked by uid 500); 6 Nov 2014 15:30:26 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87634 invoked by uid 500); 6 Nov 2014 15:30:26 -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 87624 invoked by uid 99); 6 Nov 2014 15:30:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2014 15:30:26 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mightye@gmail.com designates 209.85.217.169 as permitted sender) Received: from [209.85.217.169] (HELO mail-lb0-f169.google.com) (209.85.217.169) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2014 15:30:22 +0000 Received: by mail-lb0-f169.google.com with SMTP id 10so1112058lbg.28 for ; Thu, 06 Nov 2014 07:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=NEKLDjjyF9d8Jg4E8AvDjlHdPrG+Ro1HfwO3rpTNI+I=; b=WC5m6eDqv54R/1j69XwlOVvvVQbOF0P/NPIsNTQuXBG6QSh7JYD9Q6lFsit7NF7RSI 9z8GmSPE/AZG4dcHFX7oWGNXqFM3HldHNSxzzbAkqinU9wS4GnT/QPhUkhs9llksfZnL mcxdVk/p1dHmGDR80LsQ9ggfQt6jVshRbvYH4tm0UZxJpvGhK0ai/kNVVaCY/Fd5PkTs YKKnn+Rd6h3ogUmUow6AuwhM6BEOyeBMdds+jF+VrnKGSw5Q6tBApaY8+DDyYtxU56I6 HsgTb4NOOkZfKOgFslS0mCCMGBZZt4SxemljlkvSQv4C2IZmhBhN0Tx1n6hQ3f/eHY7V bSAw== X-Received: by 10.152.21.199 with SMTP id x7mr5675929lae.66.1415287801307; Thu, 06 Nov 2014 07:30:01 -0800 (PST) MIME-Version: 1.0 References: From: Eric Stevens Date: Thu, 06 Nov 2014 15:30:00 +0000 Message-ID: Subject: Re: read after write inconsistent even on a one node cluster To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=089e0158b836a6e6c30507325ee4 X-Virus-Checked: Checked by ClamAV on apache.org --089e0158b836a6e6c30507325ee4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable If this is just for doing tests to make sure you get back the data you expect, I would recommend looking some sort of eventually construct in your testing. We use Specs2 as our testing framework, and our write-then-read tests look something like this: someDAO.write(someObject) eventually { someDAO.read(someObject.id) mustEqual someObject } This will retry the read repeatedly over a short duration. Just in case you are trying to do write-then-read outside of tests, you should be aware that it's a Bad Idea=E2=84=A2, but your email reads like yo= u already know that =3D) On Thu Nov 06 2014 at 7:16:25 AM Brian Tarbox wrote= : > We're doing development on a single node cluster (and yes of course we're > not really deploying that way), and we're getting inconsistent behavior o= n > reads after writes. > > We write values to our keyspaces and then immediately read the values bac= k > (in our Cucumber tests). About 20% of the time we get the old value.....= if > we wait 1 second and redo the query (within the same java method) we get > the new value. > > This is all happening on a single node...how is this possible? > > We're using 2.0.9 and the java client. Though it shouldn't matter given > a single node cluster I set the consistency level to ALL with no effect. > > I've read CASSANDRA-876 which seems spot-on but it was closed as > won't-fix...and I don't see what the solution is. > > Thanks in advance for any help. > > Brian Tarbox > > -- > http://about.me/BrianTarbox > --089e0158b836a6e6c30507325ee4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable If this is just for doing tests to make sure you get back the data you expe= ct, I would recommend looking some sort of eventually construct in your tes= ting.=C2=A0 We use Specs2 as our testing framework, and our write-then-read= tests look something like this:

someDAO.write(someObjec= t)

eventually {
=C2=A0 =C2=A0 someDAO.re= ad(someObject.id) mustEqual someObject
}

This will = retry the read repeatedly over a short duration.

Just in case you ar= e trying to do write-then-read outside of tests, you should be aware that i= t's a Bad Idea=E2=84=A2, but your email reads like you already know tha= t =3D)

On Thu Nov 06 2014 at 7:16:= 25 AM Brian Tarbox <briantarbox@gmail.com> wrote:
We're doing development on a single node cluster (a= nd yes of course we're not really deploying that way), and we're ge= tting inconsistent behavior on reads after writes.

We wr= ite values to our keyspaces and then immediately read the values back (in o= ur Cucumber tests).=C2=A0 About 20% of the time we get the old value.....if= we wait 1 second and redo the query (within the same java method) we get t= he new value. =C2=A0

This is all happening on a si= ngle node...how is this possible?

We're using = 2.0.9 and the java client. =C2=A0 Though it shouldn't matter given a si= ngle node cluster I set the consistency level to ALL with no effect.
<= div>
I've read CASSANDRA-876 which seems spot-on but it w= as closed as won't-fix...and I don't see what the solution is.

Thanks in advance for any help.

Brian Tarbox

-- <= br>http://about.m= e/BrianTarbox
--089e0158b836a6e6c30507325ee4--