From 71c2b467b01c93726fccc0a3521343c11c92167c Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 15 Dec 2009 11:15:47 -0500 Subject: [PATCH] debug loadaof implemented in order to add more consistency tests in test-redis.tcl --- redis.c | 8 ++++++++ test-redis.tcl | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/redis.c b/redis.c index b166d9d1..d3339f87 100644 --- 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; diff --git a/test-redis.tcl b/test-redis.tcl index f002dfa7..e679b7fa 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -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 {}