]> git.saurik.com Git - redis.git/commitdiff
debug loadaof implemented in order to add more consistency tests in test-redis.tcl
authorantirez <antirez@gmail.com>
Tue, 15 Dec 2009 16:15:47 +0000 (11:15 -0500)
committerantirez <antirez@gmail.com>
Tue, 15 Dec 2009 16:15:47 +0000 (11:15 -0500)
redis.c
test-redis.tcl

diff --git a/redis.c b/redis.c
index b166d9d1be330d68426a46be5b64eaf4559f70e6..d3339f875aa78f4a615009ca0080047bc6a2971f 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -6116,6 +6116,14 @@ static void debugCommand(redisClient *c) {
         }
         redisLog(REDIS_WARNING,"DB reloaded by DEBUG RELOAD");
         addReply(c,shared.ok);
+    } else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
+        emptyDb();
+        if (loadAppendOnlyFile(server.appendfilename) != REDIS_OK) {
+            addReply(c,shared.err);
+            return;
+        }
+        redisLog(REDIS_WARNING,"Append Only File loaded by DEBUG LOADAOF");
+        addReply(c,shared.ok);
     } else if (!strcasecmp(c->argv[1]->ptr,"object") && c->argc == 3) {
         dictEntry *de = dictFind(c->db->dict,c->argv[2]);
         robj *key, *val;
index f002dfa771056e9599e1e4871e647cd7485aea43..e679b7fa142b85c45e282334601e3f9a4f978d89 100644 (file)
@@ -1394,6 +1394,16 @@ proc main {server port} {
         } {1}
     }
 
+    test {EXPIRES after a reload} {
+        $r flushdb
+        $r set x 10
+        $r expire x 1000
+        $r save
+        $r debug reload
+        set ttl [$r ttl x]
+        expr {$ttl > 900 && $ttl <= 1000}
+    } {1}
+
     # Leave the user with a clean DB before to exit
     test {FLUSHDB} {
         set aux {}