incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Zlatanov <...@lifelogs.com>
Subject Re: Atomic Operations
Date Wed, 17 Mar 2010 19:42:22 GMT
On Wed, 17 Mar 2010 16:29:27 -0300 Juan Manuel GarcĂ­a del Moral <juanmanuel@taringa.net>
wrote: 

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

JMGdM> I would need to to

JMGdM> SocialAds.Anonimos['145']['Tag']['12'] += 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}=timestamp1

and then your gather process can exclude outdated records.

Ted




Mime
View raw message