summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-11-01 22:39:39 +0100
committerantirez <antirez@gmail.com>2012-11-01 22:41:57 +0100
commit36f026a3a0049fdf924c709a1e7ff00fea4e70bb (patch)
tree8c2957fdd797e669912185fddb6f96690b8d18ac
parentcc017c58398480b0b1976a58463954b4bfc084a4 (diff)
downloadredis-36f026a3a0049fdf924c709a1e7ff00fea4e70bb.tar.gz
More robust handling of AOF rewrite child.
After the wait3() syscall we used to do something like that: if (pid == server.rdb_child_pid) { backgroundSaveDoneHandler(exitcode,bysignal); } else { .... } So the AOF rewrite was handled in the else branch without actually checking if the pid really matches. This commit makes the check explicit and logs at WARNING level if the pid returned by wait3() does not match neither the RDB or AOF rewrite child.
-rw-r--r--src/redis.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/redis.c b/src/redis.c
index 87f5e812f..b42fac354 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -902,8 +902,12 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
if (pid == server.rdb_child_pid) {
backgroundSaveDoneHandler(exitcode,bysignal);
- } else {
+ } else if (pid == server.aof_child_pid) {
backgroundRewriteDoneHandler(exitcode,bysignal);
+ } else {
+ redisLog(REDIS_WARNING,
+ "Warning, detected child with unmatched pid: %ld",
+ (long)pid);
}
updateDictResizePolicy();
}