is there auto-increment functionality in riak??

Eric Moritz eric at themoritzfamily.com
Tue Mar 22 17:12:58 EDT 2011


I have been meaning to get familiar with Riak's allow_mult setting so I used
this thread as an excuse to mess with it.

I created a class in python call RiakCounter that stores a value into a key
that makes conflict resolution easier when reading the value.

Here's the code.  I'm sure there's probably some fatal flaw in it that Basho
and friends will quickly point out.

https://gist.github.com/882055

It's very likely that Redis is a better fit for your use case.  My
implementation is pretty nasty and more complex than you expect. There seems
to be a growing trend of pairing Redis with Riak because they're
complementary.  Riak = elastic scale, Redis = easy data structures, pub/sub
and speed.

Eric.

PS, Here's a related thread
http://lists.basho.com/pipermail/riak-users_lists.basho.com/2011-January/002756.html


On Tue, Mar 22, 2011 at 4:09 PM, Wilson Tuladhar <mailwilson007 at gmail.com>wrote:

> thank you all for the help. I will definitely try out redis and hope this
> will solve my problem :-)
>
> //Wilson
>
>
> On Tue, Mar 22, 2011 at 3:06 PM, matthew hawthorne <mhawthorne at gmail.com>wrote:
>
>> If you find a way to generate keys in this way, I'd also suggest that
>> you provide the "If-None-Match: *" HTTP header on your PUTs in order
>> to detect the usage of duplicate keys.
>>
>> I'm not sure if there is something similar in the protobuffs interface.
>>
>> -matt
>>
>>
>> On Tue, Mar 22, 2011 at 9:41 AM, Alexander Sicular <siculars at gmail.com>
>> wrote:
>> > No there is not. Riak does not expose any data structures and is
>> generally
>> > opaque to values.
>> >
>> > Check out redis or what Twitter is doing with Cassandra re. distributed
>> > counters.
>> >
>> >
>> > @siculars on twitter
>> > http://siculars.posterous.com
>> >
>> > Sent from my iPhone
>> >
>> > On Mar 22, 2011, at 2:37, Wilson Tuladhar <mailwilson007 at gmail.com>
>> wrote:
>> >
>> >> hi,
>> >>
>> >> I was wondering if there is some functionality to define the key such
>> that
>> >> it is auto-incremented during the insert process.
>> >> If not, what may be the elegant solution to achieve this??
>> >>
>> >> //Wilson
>> >> _______________________________________________
>> >> riak-users mailing list
>> >> riak-users at lists.basho.com
>> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> >
>> > _______________________________________________
>> > riak-users mailing list
>> > riak-users at lists.basho.com
>> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> >
>>
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110322/df2881d9/attachment.html>


More information about the riak-users mailing list