]> git.saurik.com Git - redis.git/commitdiff
FLUSHALL now prevents rdbSave() from resetting the dirty counter, so that the command...
authorantirez <antirez@gmail.com>
Mon, 17 Oct 2011 08:28:57 +0000 (10:28 +0200)
committerantirez <antirez@gmail.com>
Mon, 17 Oct 2011 08:31:47 +0000 (10:31 +0200)
src/db.c

index 40b8148c3ab338537c7f871622edc8595c14e9c5..cc9810b6bdebe5b2254e5ef46c517608491cde95 100644 (file)
--- 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++;
 }