From: antirez Date: Wed, 26 May 2010 15:50:29 +0000 (+0200) Subject: Fix EXEC bug that was leaving the client in dirty status when used with WATCH X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/1ad4d31631315d0c1e140b0a831e30fa90163fec?hp=bc000c1db00dafaba9aae9620b246b63e4130238 Fix EXEC bug that was leaving the client in dirty status when used with WATCH --- diff --git a/redis.c b/redis.c index f18eabe6..def0e6b8 100644 --- a/redis.c +++ b/redis.c @@ -7556,6 +7556,7 @@ static void execCommand(redisClient *c) { execCommandReplicateMulti(c); /* Exec all the queued commands */ + unwatchAllKeys(c); /* Unwatch ASAP otherwise we'll waste CPU cycles */ orig_argv = c->argv; orig_argc = c->argc; addReplySds(c,sdscatprintf(sdsempty(),"*%d\r\n",c->mstate.count)); @@ -7568,8 +7569,7 @@ static void execCommand(redisClient *c) { c->argc = orig_argc; freeClientMultiState(c); initClientMultiState(c); - c->flags &= (~REDIS_MULTI); - unwatchAllKeys(c); + c->flags &= ~(REDIS_MULTI|REDIS_DIRTY_CAS); /* Make sure the EXEC command is always replicated / AOF, since we * always send the MULTI command (we can't know beforehand if the * next operations will contain at least a modification to the DB). */