From user-return-9657-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Tue Oct 05 15:55:38 2010 Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 12166 invoked from network); 5 Oct 2010 15:55:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Oct 2010 15:55:38 -0000 Received: (qmail 82540 invoked by uid 500); 5 Oct 2010 15:55:36 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 81965 invoked by uid 500); 5 Oct 2010 15:55:33 -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 81957 invoked by uid 99); 5 Oct 2010 15:55:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Oct 2010 15:55:32 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_PASS,T_FRT_CONTACT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ian.rogers@contactclean.com designates 79.125.113.167 as permitted sender) Received: from [79.125.113.167] (HELO m1.contactclean.com) (79.125.113.167) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Oct 2010 15:55:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=contactclean.com; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:To:MIME-Version:From:Date:Message-ID; bh=ENZAR7g/U1LYnHPQc0G4/pjsJ+n7zyu7gHJpiGYIDY0=; b=gVj+KMoHryKPmyr5IQ7nbEHshjXwm6fPdhITVjCKB52buDlxObr5XTK+oRIb64Lzmup+YSDtQohVrazdtXMMBaFabkVgeuoMXfkXvwiW/jTZtf/oOpuY3Mozm9Nfjdi+jixbZSeabYyrSQHE2xbhuWEP5z52/+sLNfVGRZ5QUc0=; Received: from host-81-20-37-12.eckoh.com ([81.20.37.12] helo=[127.0.0.1]) by m1.contactclean.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1P39r6-000488-IC for user@cassandra.apache.org; Tue, 05 Oct 2010 16:55:04 +0100 Message-ID: <4CAB4A56.2000002@contactclean.com> Date: Tue, 05 Oct 2010 16:55:02 +0100 From: Ian Rogers User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: user@cassandra.apache.org Subject: Re: atomic test-or-set References: <4CAB42EE.2010707@contactclean.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 05/10/2010 16:30, Ryan King wrote: > On Tue, Oct 5, 2010 at 8:23 AM, Ian Rogers wrote: >> Does Cassandra have an atomic test-or-set operation? >> >> That is, I want to check to see if a key has a value and, if not, set it to >> something. But it must be an atomic operation - I can't do a separate fetch >> and then set from the application as that creates a possible race condition >> with another application. >> >> Equivalent to the SQL "update foo set grum = 'bang' where isnull(grum) ..." > You can (sorta) do this per-row, but you can't scan a whole CF and do this. > >> Any thoughts how to do this? > I think you can probably do what you want with cassandra, but your > example is too vague to be sure. > > -ryan Answering my own question: it's not really tractable in general in cassandra - https://issues.apache.org/jira/browse/CASSANDRA-48 Ian