diff options
author | antirez <antirez@gmail.com> | 2013-12-02 15:55:19 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-12-02 15:56:42 +0100 |
commit | dd0ac4ac72828cf3738632d2d53ed1948562bf9d (patch) | |
tree | 729bdce884fb9bdb3bdc80e0a379ab62347a4bb9 | |
parent | 75347ada7f431925b97b037b56b5e3801e3fd16d (diff) | |
download | redis-dd0ac4ac72828cf3738632d2d53ed1948562bf9d.tar.gz |
Sentinel: don't write HZ when flushing config.
See issue #1419.
-rw-r--r-- | src/sentinel.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index 77786d715..4405e88da 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1474,15 +1474,19 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { * On failure the function logs a warning on the Redis log. */ void sentinelFlushConfig(void) { int fd; - - if (rewriteConfig(server.configfile) == -1) { + int saved_hz = server.hz; + + server.hz = REDIS_DEFAULT_HZ; + if (rewriteConfig(server.configfile) != -1) { + /* Rewrite succeded, fsync it. */ + if ((fd = open(server.configfile,O_RDONLY)) != -1) { + fsync(fd); + close(fd); + } + } else { redisLog(REDIS_WARNING,"WARNING: Senitnel was not able to save the new configuration on disk!!!: %s", strerror(errno)); - return; - } - if ((fd = open(server.configfile,O_RDONLY)) != -1) { - fsync(fd); - close(fd); } + server.hz = saved_hz; return; } |