summaryrefslogtreecommitdiff
path: root/src/db.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-02-07 11:22:24 +0100
committerantirez <antirez@gmail.com>2014-02-07 11:22:24 +0100
commit2d6eb6899319276c0071b922b9458caa909040e1 (patch)
tree940e355bb083ddcbe0706ee5afdd71f18b78ea3b /src/db.c
parent970de3e9c0f4e4b0ac56d1710e3b66f4a0cd06a5 (diff)
downloadredis-2d6eb6899319276c0071b922b9458caa909040e1.tar.gz
Sentinel: allow SHUTDOWN command in Sentinel mode.
Diffstat (limited to 'src/db.c')
-rw-r--r--src/db.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/db.c b/src/db.c
index a5088195b..41e95b6ba 100644
--- a/src/db.c
+++ b/src/db.c
@@ -605,11 +605,13 @@ void shutdownCommand(redisClient *c) {
return;
}
}
- /* SHUTDOWN can be called even while the server is in "loading" state.
- * When this happens we need to make sure no attempt is performed to save
+ /* When SHUTDOWN is called while the server is loading a dataset in
+ * memory we need to make sure no attempt is performed to save
* the dataset on shutdown (otherwise it could overwrite the current DB
- * with half-read data). */
- if (server.loading)
+ * with half-read data).
+ *
+ * Also when in Sentinel mode clear the SAVE flag and force NOSAVE. */
+ if (server.loading || server.sentinel_mode)
flags = (flags & ~REDIS_SHUTDOWN_SAVE) | REDIS_SHUTDOWN_NOSAVE;
if (prepareForShutdown(flags) == REDIS_OK) exit(0);
addReplyError(c,"Errors trying to SHUTDOWN. Check logs.");