Skip to content

Commit

Permalink
Cancel SHUTDOWN if initial AOF is being written
Browse files Browse the repository at this point in the history
Fixes redis#1826 (and many other reports of the same problem)
  • Loading branch information
mattsta authored and antirez committed Jun 23, 2014
1 parent 1206bdf commit ef897a4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,12 @@ int prepareForShutdown(int flags) {
/* Kill the AOF saving child as the AOF we already have may be longer
* but contains the full dataset anyway. */
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,
"There is a child rewriting the AOF. Killing it!");
kill(server.aof_child_pid,SIGUSR1);
Expand Down

0 comments on commit ef897a4

Please sign in to comment.