Commit a15742a4 authored by antirez's avatar antirez
Browse files

dont take the fast path for INCR if the resulting integer will fit into a shared integer range

parent b215a496
...@@ -149,7 +149,8 @@ void incrDecrCommand(redisClient *c, long long incr) { ...@@ -149,7 +149,8 @@ void incrDecrCommand(redisClient *c, long long incr) {
if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) { if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) {
long long newval = ((long)o->ptr) + incr; long long newval = ((long)o->ptr) + incr;
if (newval >= LONG_MIN && newval <= LONG_MAX) { if (newval < 0 && newval >= REDIS_SHARED_INTEGERS &&
newval >= LONG_MIN && newval <= LONG_MAX) {
o->ptr = (void*) (long) newval; o->ptr = (void*) (long) newval;
touchWatchedKey(c->db,c->argv[1]); touchWatchedKey(c->db,c->argv[1]);
server.dirty++; server.dirty++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment