[PATCH] "incr" supports wraparound

Jehiah Czebotar jehiah at gmail.com
Fri Aug 17 03:24:45 UTC 2007


On 8/16/07, Clint Webb <webb.clint at gmail.com> wrote:
> On 8/17/07, Evan Miller <emiller at imvu.com> wrote:
> > Wraparound might actually be a better solution for you, because it
> > solves the concurrency problems. Currently, several clients that
> > simultaneously attempt to increment past the size limit will all receive
> > errors, and they will all attempt to run your reset logic. I don't know
> > about your specific use-case, but for us this means that increments get
> > lost in the meantime (multiple clients reset the counter to 1).
>
What i've done when i've coded this issue is to "add" a 0 value
(instead of set) and then re-run my increment function.

This way only a single server sets the value even if multiple try and
then all increment from there.

incidentally this is the same logic used to populate it in the first
place which works out beutifully.

so I'd prefer it not to wrap around
-- 
Jehiah


More information about the memcached mailing list