From: antirez Date: Fri, 10 Jun 2011 13:15:29 +0000 (+0200) Subject: Make sure an automatic rewrite only gets triggered when no other child is in execution. X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/19b46c9a0938ccda1bfd61afb06c63bb2f468398?hp=0ec932208e6a3162955de1fe75efd0346439f005 Make sure an automatic rewrite only gets triggered when no other child is in execution. --- diff --git a/src/redis.c b/src/redis.c index bf51db9d..33cef015 100644 --- a/src/redis.c +++ b/src/redis.c @@ -692,14 +692,16 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } /* Trigger an AOF rewrite if needed */ - if (server.auto_aofrewrite_perc && + if (server.bgsavechildpid == -1 && + server.bgrewritechildpid == -1 && + server.auto_aofrewrite_perc && server.appendonly_current_size > server.auto_aofrewrite_min_size) { int base = server.auto_aofrewrite_base_size ? server.auto_aofrewrite_base_size : 1; long long growth = (server.appendonly_current_size*100/base); if (growth >= server.auto_aofrewrite_perc) { - redisLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld growth",growth); + redisLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld%% growth",growth); rewriteAppendOnlyFileBackground(); } }