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

This commit is contained in:
antirez 2010-12-10 17:23:38 +01:00
parent b215a496a4
commit a15742a41b

View File

@ -149,7 +149,8 @@ void incrDecrCommand(redisClient *c, long long incr) {
if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) {
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;
touchWatchedKey(c->db,c->argv[1]);
server.dirty++;