Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 43366 invoked from network); 5 Nov 2009 00:11:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Nov 2009 00:11:02 -0000 Received: (qmail 2065 invoked by uid 500); 5 Nov 2009 00:11:02 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 2019 invoked by uid 500); 5 Nov 2009 00:11:02 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 2010 invoked by uid 99); 5 Nov 2009 00:11:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 00:11:02 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bowman.joseph@gmail.com designates 209.85.216.188 as permitted sender) Received: from [209.85.216.188] (HELO mail-px0-f188.google.com) (209.85.216.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 00:10:52 +0000 Received: by pxi26 with SMTP id 26so5218686pxi.22 for ; Wed, 04 Nov 2009 16:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:subject :importance:from:to:cc:mime-version:content-type :content-transfer-encoding:x-mailer; bh=QpcscC1y02qyLlobjnhoos24PbvIjJO2aYDqPVCalNQ=; b=aTCRQ6peX1Jxn3zvM2ILQ36+I7vHriHVSj8J5NZc6nhnfSkvUJw9Kh8JJKYmxcO51y MY7zkjPXp90EioZ7/MvoTTZu5zX9zj6J5C1Np/hxHJOK+O3IwHof12SHCez2o8+Mm2N5 iwBNTiY5/pKzdMc7Q5pCzHTTF7GddYnONmW8E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:subject:importance:from:to:cc:mime-version :content-type:content-transfer-encoding:x-mailer; b=f5Z1lkjxwrsOACGCroecH6gSw9QtrTyaZk75ByLSwzSwhY1zIiTmXe9FVGFc1faPwz P/toheaYS2Tj3Sts6m9khNRiLIBcctV6b133g+pE4AxfXJ7GLkJPLhBfi46QXO8+nLeC Odl7xZ7jHq+nEV7nS6s6PPVdUv7VjPTHJnMS4= Received: by 10.114.162.5 with SMTP id k5mr3449560wae.10.1257379831216; Wed, 04 Nov 2009 16:10:31 -0800 (PST) Received: from ap14.p4.sca.7sys.net (e01-egress-b.seven.com [208.87.200.178]) by mx.google.com with ESMTPS id 23sm880985pzk.8.2009.11.04.16.10.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 16:10:29 -0800 (PST) Message-ID: <4af217f5.9713f30a.3f1a.6646@mx.google.com> Date: Wed, 04 Nov 2009 16:10:29 -0800 (PST) Subject: Re: Incr/Decr Counters in Cassandra Importance: normal From: "bowman.joseph@gmail.com" To: cassandra-user@incubator.apache.org CC: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: Seven Enterprise Gateway (v 2.0) X-Virus-Checked: Checked by ClamAV on apache.org I agree, the use case I can see would be a view counter. In a single op you would retrieve the value and increment both on the returned value and the column value. Instead of a two step process where you would do a get, then send the incr call. Perhaps another case would be a system where you want to have a finite set of say, beta keys. There you would use a get-decr. Though with EC you could possibly return more keys than intended, as some of the decr calls could be made on inconsistent values. Perhaps a quorum would be necessary as an option? (Typed on my phone, please excuse typos) -----Original Message----- Date: Wednesday, November 04, 2009 5:32:16 pm To: cassandra-user@incubator.apache.org From: "Jonathan Mischo" Subject: Re: Incr/Decr Counters in Cassandra incr/decr actually fit with EC, since they're just add n or sub n ops that can be replayed in any order...it's just less costly to do it as a get and incr or get and decr than as separate operations...the only difference between a get on the value followed by an incr is the overhead of the additional request, so it just seems to make a lot more sense to make it a single call. It's done in the SQL world a lot, and it's just good form, since a lot of times you're going to see an incr or decr tied to a get with a counter (but not always...sometimes you'll see just a get or an incr or decr...if you just have incr or decr return the new value, that works just as well, and the client can decide whether or not to discard the value). On Nov 4, 2009, at 4:09 PM, Bill de hOra wrote: > incr/decr for counters maybe doesn't fit with EC (as you might need > a global lock for some use cases ), but plus/minus are slightly > different as they're commutative and don't require a total