diff options
author | heqin <hqin6@163.com> | 2017-12-15 11:06:58 +0800 |
---|---|---|
committer | heqin <hqin6@163.com> | 2017-12-15 11:06:58 +0800 |
commit | ee724cac491c6e6f4ee3c9b91be482f163e6d12c (patch) | |
tree | a0492b1dc0749060747fcf226d1585b7aeb6c4c4 /src/aof.c | |
parent | 398b2084af067ae4d669e0ce5a63d3bc89c639d3 (diff) | |
download | redis-ee724cac491c6e6f4ee3c9b91be482f163e6d12c.tar.gz |
fixbug for #4538 Error opening /setting AOF rewrite IPC pipes: No such file or directory
Diffstat (limited to 'src/aof.c')
-rw-r--r-- | src/aof.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -237,11 +237,11 @@ void stopAppendOnly(void) { * at runtime using the CONFIG command. */ int startAppendOnly(void) { char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */ + int newfd; - server.aof_last_fsync = server.unixtime; - server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644); + newfd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644); serverAssert(server.aof_state == AOF_OFF); - if (server.aof_fd == -1) { + if (newfd == -1) { char *cwdp = getcwd(cwd,MAXPATHLEN); serverLog(LL_WARNING, @@ -256,13 +256,15 @@ int startAppendOnly(void) { server.aof_rewrite_scheduled = 1; serverLog(LL_WARNING,"AOF was enabled but there is already a child process saving an RDB file on disk. An AOF background was scheduled to start when possible."); } else if (rewriteAppendOnlyFileBackground() == C_ERR) { - close(server.aof_fd); + close(newfd); serverLog(LL_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error."); return C_ERR; } /* We correctly switched on AOF, now wait for the rewrite to be complete * in order to append data on disk. */ server.aof_state = AOF_WAIT_REWRITE; + server.aof_last_fsync = server.unixtime; + server.aof_fd = newfd; return C_OK; } |