Good morning,

Wondering if there is a better way to do truncation of a set if entries exceed 
a certain threshold. I am trying to create a canonical timeline for every user 
in our system, set of UUID strings. We want the number of entries to be limited 
to about 1000 per timeline to keep the size of each KV object in check inside 
Riak and also not store unnecessary data. From looking around code and docs, 
there doesn’t seem to be a Redis style LTRIM<http://redis.io/commands/ltrim> 
option available. So is the only way to enforce this is to fetch the set, check 
count, trim it locally and then update?

My fear is that by using CRDTs, a set add wins over remove in the case of a 
conflict. If there were to be 1000 conflicting concurrent updates each trying 
to trim and add one entry to a set that already contains 1000 entries, I 
imagine the  final count of the set would be 2000. This can be greatly 
exasperated on a very “friendly” or popular person’s timeline and the code 
never being able to truncate the set back to 1000.

Any thoughts or suggestions appreciated.

Thanks,

Shawn
freenode (sde)
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to