Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 76620 invoked from network); 17 Mar 2010 19:45:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Mar 2010 19:45:20 -0000 Received: (qmail 19247 invoked by uid 500); 17 Mar 2010 19:45:19 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 19207 invoked by uid 500); 17 Mar 2010 19:45:19 -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 19199 invoked by uid 99); 17 Mar 2010 19:45:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Mar 2010 19:45:19 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.85.222.190] (HELO mail-pz0-f190.google.com) (209.85.222.190) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Mar 2010 19:45:13 +0000 Received: by pzk28 with SMTP id 28so728271pzk.11 for ; Wed, 17 Mar 2010 12:44:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.141.12.10 with SMTP id p10mr1534057rvi.284.1268855091369; Wed, 17 Mar 2010 12:44:51 -0700 (PDT) In-Reply-To: <87hboed9b5.fsf@lifelogs.com> References: <9ad76c4d1003171158o6cc68523u935cc134283f4299@mail.gmail.com> <9ad76c4d1003171205y3c2b83a0s6a498996df876bd5@mail.gmail.com> <87sk7yda47.fsf@lifelogs.com> <9ad76c4d1003171228g664d396ewd79fc72e9f2e0a31@mail.gmail.com> <9ad76c4d1003171229w548f6899yed14bb548fcf1df2@mail.gmail.com> <87hboed9b5.fsf@lifelogs.com> Date: Wed, 17 Mar 2010 16:44:50 -0300 Message-ID: <9ad76c4d1003171244p5eb7c534p739af05c11c4f77@mail.gmail.com> Subject: Re: Atomic Operations From: =?ISO-8859-1?Q?Juan_Manuel_Garc=EDa_del_Moral?= To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=000e0cd10612fe42530482045844 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd10612fe42530482045844 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That's exactly what I need, Do you have an idea how can I implement this through the C++ API? Many thanks 2010/3/17 Ted Zlatanov > On Wed, 17 Mar 2010 16:29:27 -0300 Juan Manuel Garc=EDa del Moral < > juanmanuel@taringa.net> wrote: > > JMGdM> I have this: > JMGdM> SocialAds.Anonimos['145']['Tag']['12'] =3D 13 > > JMGdM> I would need to to > > JMGdM> SocialAds.Anonimos['145']['Tag']['12'] +=3D 1 > > JMGdM> for example > > JMGdM> with that, would be enough for now.... > > JMGdM> I don't want to retrieve the value, do 13+1 in my code, and re-set= () > it to > JMGdM> 14 > > There are several ways, here's one idea: > > So your (column family + row) key is A, the SuperColumn is B, and the > Column name is C. You want to do ${A B C}++ > > If you can assign an identity to your writers, you can make unique > SuperColumns for each one and each writer can increment its own: > > ${A B1 C}++ > ${A B2 C}++ > etc. > > and then you can gather all the values, for example with bitmask queries > that match B*. This is a fast operation if you don't have too many > SuperColumns (too many writers). Do you expect more than 1000? > > If you need to ensure that old writers are not counted, also add a > 'last' Column: > > ${A B1 last}=3Dtimestamp1 > > and then your gather process can exclude outdated records. > > Ted > > > > --000e0cd10612fe42530482045844 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That's exactly what I need, Do you have an idea how can I implement thi= s through the C++ API?

Many thanks


2010/3/17 Ted Zlatanov <tzz@lifelogs.com>
On Wed, 17 Mar 20= 10 16:29:27 -0300 Juan Manuel Garc=EDa del Moral <juanmanuel@taringa.net> wrote:

JMGdM> I have this:
JMGdM> SocialAds.Anonimos['145']['Tag']['12'] = =3D 13

JMGdM> I would need to to

JMGdM> SocialAds.Anonimos['145']['Tag']['12'] += =3D 1

JMGdM> for example

JMGdM> with that, would be enough for now....

JMGdM> I don't want to retrieve the value, do 13+1 in my code, and r= e-set() it to
JMGdM> 14

There are several ways, here's one idea:

So your (column family + row) key is A, the SuperColumn is B, and the
Column name is C. =A0You want to do ${A B C}++

If you can assign an identity to your writers, you can make unique
SuperColumns for each one and each writer can increment its own:

${A B1 C}++
${A B2 C}++
etc.

and then you can gather all the values, for example with bitmask queries that match B*. =A0This is a fast operation if you don't have too many SuperColumns (too many writers). =A0Do you expect more than 1000?

If you need to ensure that old writers are not counted, also add a
'last' Column:

${A B1 last}=3Dtimestamp1

and then your gather process can exclude outdated records.

Ted




--000e0cd10612fe42530482045844--