Skip to content

Commit

Permalink
debug loadaof implemented in order to add more consistency tests in t…
Browse files Browse the repository at this point in the history
…est-redis.tcl
  • Loading branch information
antirez committed Dec 15, 2009
1 parent e054afd commit 71c2b46
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions test-redis.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down

0 comments on commit 71c2b46

Please sign in to comment.