From: antirez Date: Mon, 17 Oct 2011 08:28:57 +0000 (+0200) Subject: FLUSHALL now prevents rdbSave() from resetting the dirty counter, so that the command... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/13cd1515f9030ed4f8ebd0b54fa90243858e244b?hp=42a6fcd6c59f7a51d0bda011e55e50960a28cfb5 FLUSHALL now prevents rdbSave() from resetting the dirty counter, so that the command will get replicated and put inside the AOF. This fixes issue #142 --- diff --git a/src/db.c b/src/db.c index 40b8148c..cc9810b6 100644 --- a/src/db.c +++ b/src/db.c @@ -213,7 +213,13 @@ void flushallCommand(redisClient *c) { kill(server.bgsavechildpid,SIGKILL); rdbRemoveTempFile(server.bgsavechildpid); } - if (server.saveparamslen > 0) rdbSave(server.dbfilename); + if (server.saveparamslen > 0) { + /* Normally rdbSave() will reset dirty, but we don't want this here + * as otherwise FLUSHALL will not be replicated nor put into the AOF. */ + int saved_dirty = server.dirty; + rdbSave(server.dbfilename); + server.dirty = saved_dirty; + } server.dirty++; }