summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampus Wessman <hampus.wessman@gmail.com>2011-07-03 12:18:44 +0200
committerantirez <antirez@gmail.com>2011-07-15 17:48:22 +0200
commita906670e2d074bf74070b9a0a2f086d1f3777703 (patch)
tree70ed78eb0e00c9a6d82dcad0f8ac52c743b21cb5
parentd3203c16f56b0042375c8725b3fcc54549f995e6 (diff)
downloadredis-a906670e2d074bf74070b9a0a2f086d1f3777703.tar.gz
Don't expire keys while loading AOF.
They will be expired (and a DEL will be logged) after the loading is done instead.
-rw-r--r--src/db.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/db.c b/src/db.c
index ede242dbe..cb4c73710 100644
--- a/src/db.c
+++ b/src/db.c
@@ -455,6 +455,9 @@ int expireIfNeeded(redisDb *db, robj *key) {
if (when < 0) return 0; /* No expire for this key */
+ /* Don't expire anything while loading. It will be done later. */
+ if (server.loading) return 0;
+
/* If we are running in the context of a slave, return ASAP:
* the slave key expiration is controlled by the master that will
* send us synthesized DEL operations for expired keys.
@@ -492,7 +495,7 @@ void expireGenericCommand(redisClient *c, robj *key, robj *param, long offset) {
addReply(c,shared.czero);
return;
}
- if (seconds <= 0) {
+ if (seconds <= 0 && !server.loading) {
if (dbDelete(c->db,key)) server.dirty++;
addReply(c, shared.cone);
touchWatchedKey(c->db,key);