]> git.saurik.com Git - redis.git/commitdiff
AOFSYNC command implemented
authorantirez <antirez@gmail.com>
Mon, 28 Dec 2009 01:31:16 +0000 (20:31 -0500)
committerantirez <antirez@gmail.com>
Mon, 28 Dec 2009 01:31:16 +0000 (20:31 -0500)
redis.c

diff --git a/redis.c b/redis.c
index a97427cc8f61d05b753ccffc0479e9f7988c41de..3b86e0847298b0b2f1c872d11f6b54add3760b13 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -513,6 +513,7 @@ static void zscoreCommand(redisClient *c);
 static void zremrangebyscoreCommand(redisClient *c);
 static void multiCommand(redisClient *c);
 static void execCommand(redisClient *c);
+static void aofsyncCommand(redisClient *c);
 
 /*================================= Globals ================================= */
 
@@ -581,6 +582,7 @@ static struct redisCommand cmdTable[] = {
     {"save",saveCommand,1,REDIS_CMD_INLINE},
     {"bgsave",bgsaveCommand,1,REDIS_CMD_INLINE},
     {"bgrewriteaof",bgrewriteaofCommand,1,REDIS_CMD_INLINE},
+    {"aofsync",aofsyncCommand,1,REDIS_CMD_INLINE},
     {"shutdown",shutdownCommand,1,REDIS_CMD_INLINE},
     {"lastsave",lastsaveCommand,1,REDIS_CMD_INLINE},
     {"type",typeCommand,2,REDIS_CMD_INLINE},
@@ -6231,6 +6233,13 @@ static void bgrewriteaofCommand(redisClient *c) {
     }
 }
 
+static void aofsyncCommand(redisClient *c) {
+    if (server.appendonly)
+        fsync(server.appendfd);
+    else
+        addReplySds(c,sdsnew("-ERR Append Only File is not active\r\n"));
+}
+
 static void aofRemoveTempFile(pid_t childpid) {
     char tmpfile[256];