X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/7b81e5a16ca577b7aa10dd0398cce4ba9cdf0842..e394114d95395fe9babb0a658de263a0811ec330:/src/db.c diff --git a/src/db.c b/src/db.c index 38983cb5..616b1fa1 100644 --- a/src/db.c +++ b/src/db.c @@ -328,8 +328,22 @@ void typeCommand(redisClient *c) { } void shutdownCommand(redisClient *c) { - if (prepareForShutdown() == REDIS_OK) - exit(0); + int flags = 0; + + if (c->argc > 2) { + addReply(c,shared.syntaxerr); + return; + } else if (c->argc == 2) { + if (!strcasecmp(c->argv[1]->ptr,"nosave")) { + flags |= REDIS_SHUTDOWN_NOSAVE; + } else if (!strcasecmp(c->argv[1]->ptr,"save")) { + flags |= REDIS_SHUTDOWN_SAVE; + } else { + addReply(c,shared.syntaxerr); + return; + } + } + if (prepareForShutdown(flags) == REDIS_OK) exit(0); addReplyError(c,"Errors trying to SHUTDOWN. Check logs."); } @@ -473,7 +487,7 @@ void propagateExpire(redisDb *db, robj *key) { argv[1] = key; incrRefCount(key); - if (server.appendonly) + if (server.aof_state != REDIS_AOF_OFF) feedAppendOnlyFile(server.delCommand,db->id,argv,2); if (listLength(server.slaves)) replicationFeedSlaves(server.slaves,db->id,argv,2);