1
0
mirror of https://github.com/fluencelabs/redis synced 2025-03-31 14:51:04 +00:00

Cancel SHUTDOWN if initial AOF is being written

Fixes  (and many other reports of the same problem)
This commit is contained in:
Matt Stancliff 2014-06-21 11:14:05 -04:00 committed by antirez
parent 1206bdf13f
commit ef897a41e8

@ -2288,6 +2288,12 @@ int prepareForShutdown(int flags) {
/* Kill the AOF saving child as the AOF we already have may be longer /* Kill the AOF saving child as the AOF we already have may be longer
* but contains the full dataset anyway. */ * but contains the full dataset anyway. */
if (server.aof_child_pid != -1) { if (server.aof_child_pid != -1) {
/* If we have AOF enabled but haven't written the AOF yet, don't
* shutdown or else the dataset will be lost. */
if (server.aof_state == REDIS_AOF_WAIT_REWRITE) {
redisLog(REDIS_WARNING, "Writing initial AOF, can't exit.");
return REDIS_ERR;
}
redisLog(REDIS_WARNING, redisLog(REDIS_WARNING,
"There is a child rewriting the AOF. Killing it!"); "There is a child rewriting the AOF. Killing it!");
kill(server.aof_child_pid,SIGUSR1); kill(server.aof_child_pid,SIGUSR1);