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 1C375CE14 for ; Sat, 29 Jun 2013 19:11:08 +0000 (UTC) Received: (qmail 44571 invoked by uid 500); 29 Jun 2013 19:11:05 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 44543 invoked by uid 500); 29 Jun 2013 19:11:05 -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 44535 invoked by uid 99); 29 Jun 2013 19:11:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jun 2013 19:11:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of blair@orcaware.com designates 108.0.197.17 as permitted sender) Received: from [108.0.197.17] (HELO orca4.orcaware.com) (108.0.197.17) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jun 2013 19:10:59 +0000 Received: from poppy-powerbook.local (localhost [127.0.0.1]) by orca4.orcaware.com (8.14.4/8.14.4/Debian-2.1ubuntu2) with ESMTP id r5TJAaSZ021925; Sat, 29 Jun 2013 12:10:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orcaware.com; s=default; t=1372533037; bh=sYSPSf2+jGGcBwN6fn18ILvEDuBjggeEtGdRObBZIU4=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=FkuMmQbLI5AkUQyvphbrumoxAq7i2yxV12Po2M2K+p5pxhUuu6O6tO0kqkMAItjJD L9E/ciIrojBkqwtQ9x5kH6u/Di9v0e07zBk2ib0sWbA54xlFRDy73UyfnIdeRS8s43 mw9en1BQ6vEroAw5ShVynkCNb3fV05EgM1S495vk= Message-ID: <51CF312C.5060203@orcaware.com> Date: Sat, 29 Jun 2013 12:10:36 -0700 From: Blair Zajac User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 MIME-Version: 1.0 To: user@cassandra.apache.org CC: Sylvain Lebresne Subject: Re: Mixing CAS UPDATE and non-CAS DELETE References: <51C90EF1.5070300@orcaware.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 6/26/13 10:26 AM, Sylvain Lebresne wrote: > On Tue, Jun 25, 2013 at 5:30 AM, Blair Zajac > wrote: > > But if I want to delete it regardless of v1, then this doesn't work: > > DELETE FROM test WHERE k = 0 IF EXISTS > > > That's correct, though we should probably fix that at some point. I've > opened https://issues.apache.org/jira/browse/CASSANDRA-5708 for that. I was thinking about this and wondering if there's even a point to having a CAS delete in this case? Is "DELETE FROM test WHERE k = 0" the same as "DELETE FROM test WHERE k = 0 IF EXISTS" from a practical point of view? One is still racing with any other updates to the row, either with the proposal from other CASes or an implicit race with whoever has a later timestamp? Does one save a row tombstone if one uses "IF EXISTS"? > So one is left to > > DELETE FROM test WHERE k = 0 > > How does this non-CAS DELETE mix with a CAS UPDATE for the same > partition key? Will they properly not step over each other? > > > Depends on what you mean by "not step over each other". A CAS update > will end up inserting columns with a timestamp that is basically the one > of the start of the paxos algorithm use underneath. The delete itself > will be a tombstone with a timestamp of when you execute that delete. So > the basic rule of "the more recent wins" will apply. Of course if 2 such > operations contend, you can't really know which will win. But if you do > a delete at QUORUM, followed by a CAS update IF NOT EXISTS (and there is > no other concurrently running operation on that row) you are guaranteed > that your update will succeed. > > I don't know if I've answered your question. Yes, thanks. I was wondering if the non-CAS delete ignores any outstanding proposals on the row. Blair