summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-10-17 10:28:57 +0200
committerantirez <antirez@gmail.com>2011-10-17 10:55:46 +0200
commit991eee4d01fd24f1d1cf0207248d41a6b254b0b8 (patch)
tree9a2d5cd004544c39cbd110692a40471970aa3a86
parent74b77ff8a6c397602196c4dc3c5a318f93720ad7 (diff)
downloadredis-991eee4d01fd24f1d1cf0207248d41a6b254b0b8.tar.gz
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
-rw-r--r--src/db.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/db.c b/src/db.c
index 24851385e..70371221e 100644
--- a/src/db.c
+++ b/src/db.c
@@ -180,7 +180,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++;
}