diff options
author | Oran Agra <oran@redislabs.com> | 2017-09-17 07:22:16 +0300 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-09-18 12:04:33 +0200 |
commit | 13e8e53806e466682444b262af2f3170541e2043 (patch) | |
tree | 8973747111614de160455ccbd0d328107c13e191 | |
parent | c9ab43ef7c593677a31271aef63fe58b094a2a02 (diff) | |
download | redis-13e8e53806e466682444b262af2f3170541e2043.tar.gz |
Flush append only buffers before existing.
when SHUTDOWN command is recived it is possible that some of the recent
command were not yet flushed from the AOF buffer, and the server
experiences data loss at shutdown.
-rw-r--r-- | src/server.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server.c b/src/server.c index aeff94889..6565b0b70 100644 --- a/src/server.c +++ b/src/server.c @@ -2595,8 +2595,9 @@ int prepareForShutdown(int flags) { "There is a child rewriting the AOF. Killing it!"); kill(server.aof_child_pid,SIGUSR1); } - /* Append only file: fsync() the AOF and exit */ + /* Append only file: flush buffers and fsync() the AOF at exit */ serverLog(LL_NOTICE,"Calling fsync() on the AOF file."); + flushAppendOnlyFile(1); aof_fsync(server.aof_fd); } |