incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Manuel García del Moral <juanman...@taringa.net>
Subject Re: Atomic Operations
Date Wed, 17 Mar 2010 19:50:07 GMT
also += 1 was just an example, it could be += N, += 15 or whatever, it
depends on certain conditions , but I think it would work as well


El 17 de marzo de 2010 16:44, Juan Manuel García del Moral <
juanmanuel@taringa.net> escribió:

> 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 <tzz@lifelogs.com>
>
>> 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